fix(mothership): thinking and subagent text#3613
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR improves how the mothership chat renders AI thinking blocks and subagent text by parsing Key changes:
Confidence Score: 3/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[SSE stream: content event] -->|activeSubagent set| B[Tag text block with subagent name]
A -->|no activeSubagent| C[Plain text block]
D[SSE stream: subagent_end] --> E[Push subagent_end block]
E --> F[activeSubagent = undefined]
B --> G[parseBlocks]
C --> G
E --> G
G -->|block.subagent && group| H[Append to AgentGroup items]
G -->|block.type === subagent_end| I[Flush current group to segments]
G -->|plain text block| J[Flush group → push TextSegment]
G -->|tool_call isDispatch| K[Open new AgentGroup]
G -->|tool_call calledBy| L[Nest under matching AgentGroup]
M[MessageContent renders segments] --> N{showTrailingThinking?}
N -->|isStreaming && !hasTrailingContent && hasSubagentEnded or allToolsDone| O[Show PendingTagIndicator]
N -->|else| P[No indicator]
style O fill:#f9a,stroke:#c55
style H fill:#afa,stroke:#585
|
...space/[workspaceId]/home/components/message-content/components/special-tags/special-tags.tsx
Outdated
Show resolved
Hide resolved
...space/[workspaceId]/home/components/message-content/components/special-tags/special-tags.tsx
Outdated
Show resolved
Hide resolved
...rkspace/[workspaceId]/home/components/message-content/components/agent-group/agent-group.tsx
Outdated
Show resolved
Hide resolved
PR SummaryHigh Risk Overview Enhances tool call display by passing tool results through message blocks and rendering successful tool calls for certain tools as expandable “card” outputs; swaps the executing spinner to a new animated Adjusts orchestration behavior by gating “requiresConfirmation” waits behind a new Adds CSV/TSV → Tables import via a new Also includes various UI/layout tweaks (navbar/pricing spacing, sidebar headers, text wrapping/overflow) and updates deployment tool outputs/handling to include Written by Cursor Bugbot for commit ceba8cf. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Hardcoded
isProdandisHostedbreak self-hosted deployments- Restored isProd to check NODE_ENV and isHosted to check NEXT_PUBLIC_APP_URL instead of being hardcoded to true.
- ✅ Fixed: Logging full tool output may leak sensitive data
- Removed the output field from the tool success log entry to prevent sensitive data from appearing in logs.
Or push these changes by commenting:
@cursor push 3eed0e0545
Preview (3eed0e0545)
diff --git a/apps/sim/lib/copilot/orchestrator/sse/handlers/tool-execution.ts b/apps/sim/lib/copilot/orchestrator/sse/handlers/tool-execution.ts
--- a/apps/sim/lib/copilot/orchestrator/sse/handlers/tool-execution.ts
+++ b/apps/sim/lib/copilot/orchestrator/sse/handlers/tool-execution.ts
@@ -455,7 +455,6 @@
logger.info('Tool execution succeeded', {
toolCallId: toolCall.id,
toolName: toolCall.name,
- output: result.output,
})
} else {
logger.warn('Tool execution failed', {
diff --git a/apps/sim/lib/core/config/feature-flags.ts b/apps/sim/lib/core/config/feature-flags.ts
--- a/apps/sim/lib/core/config/feature-flags.ts
+++ b/apps/sim/lib/core/config/feature-flags.ts
@@ -1,12 +1,12 @@
/**
* Environment utility functions for consistent environment detection across the application
*/
-import { env, isFalsy, isTruthy } from './env'
+import { env, getEnv, isFalsy, isTruthy } from './env'
/**
* Is the application running in production mode
*/
-export const isProd = true
+export const isProd = env.NODE_ENV === 'production'
/**
* Is the application running in development mode
@@ -21,7 +21,9 @@
/**
* Is this the hosted version of the application
*/
-export const isHosted = true
+export const isHosted =
+ getEnv('NEXT_PUBLIC_APP_URL') === 'https://www.sim.ai' ||
+ getEnv('NEXT_PUBLIC_APP_URL') === 'https://www.staging.sim.ai'
/**
* Is billing enforcement enabledThis Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
| * Is the application running in production mode | ||
| */ | ||
| export const isProd = env.NODE_ENV === 'production' | ||
| export const isProd = true |
There was a problem hiding this comment.
Hardcoded isProd and isHosted break self-hosted deployments
High Severity
isProd and isHosted are hardcoded to true, replacing the previous environment-based checks. This makes isAuthDisabled always false (line 40: isTruthy(env.DISABLE_AUTH) && !isHosted), completely breaking self-hosted deployments that rely on DISABLE_AUTH. It also disables billing bypass in development (!isProd guards in subscription.ts will never trigger), and isProd and isDev can now both be true simultaneously.
Additional Locations (1)
| logger.info('Tool execution succeeded', { | ||
| toolCallId: toolCall.id, | ||
| toolName: toolCall.name, | ||
| output: result.output, |
There was a problem hiding this comment.
Logging full tool output may leak sensitive data
Medium Severity
The newly added output: result.output field in the success log dumps the entire tool execution result at info level. Tool outputs can contain file contents, database rows, API keys, user data, or other sensitive information. This could lead to sensitive data appearing in logs and potentially very large log entries for tools that return substantial payloads.
bdd1cf8 to
17c12ea
Compare
|
@greptile |



Summary
Improves the Mothership chat experience and redesigns key landing/home UI surfaces.
Mothership Chat:
<thinking>tag support — model reasoning traces are parsed viaparseSpecialTagsand suppressed from the UIsubagentfield onContentBlock, so text emitted inside a subagent context stays grouped within itsAgentGroupsubagent_endblock type to properly close subagent groups and trigger a delayedPendingTagIndicatorwhen a subagent/tool run finishes without trailing textsearch_online,scrape_page,function_execute, etc.) now render as expandable card outputs with formatted result bodiesLoaderspinner with a new animatedPillsRingicon for executing tool callsToolCallResulttype (success,output,error) and passes result data through toToolCallItemLanding Page:
Home Templates:
grid-cols-1→grid-cols-3) and addscontentVisibility: 'auto'for rendering performanceTemplateCardandWorkflowMiniBlockcomponentsBlog:
/studioto/blogacross all pages, content, and static assetsOther:
isProdandisHostedfeature flags totrueChatSkeletonloading stateFixes #(issue)
Type of Change
/studio→/blog)Testing
PendingTagIndicatorappears briefly after a subagent/tool finishes when no trailing text is present/blogroutes work and/studioredirects are configured innext.config.tsisProdandisHostedare hardcoded totrue— verify this doesn't break self-hosted/dev environments (see Cursor Bugbot flag)Checklist