🤖 fix: render kernel-launched workflow runs as live cards in chat - #4001
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 14e2691a58
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
This comment has been minimized.
This comment has been minimized.
…ts, replay nested calls
|
@codex review |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 916ee813df
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…pletion for replay
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
This comment has been minimized.
This comment has been minimized.
…cards # Conflicts: # src/browser/features/Tools/Shared/getToolComponent.test.ts # src/browser/features/Tools/Shared/getToolComponent.ts # src/node/services/streamManager.test.ts
This comment has been minimized.
This comment has been minimized.
…rker #4001 added a shared isKernelBoundedMarker type guard in src/common/utils/tools/kernelBoundedMarker.ts and wired it into the renderer, but left the producer side spelling the same predicate by hand: applyRetainedResultFields (added in that same commit) and the pre-existing preserveSuccessBit each re-inlined the typeof/null/ __kernelBounded === true chain with its own cast. Both now call the guard, making it the single definition of the marker test in quickjsRuntime.ts and removing the file's last two marker casts.
…rker #4001 added a shared isKernelBoundedMarker type guard in src/common/utils/tools/kernelBoundedMarker.ts and wired it into the renderer, but left the producer side spelling the same predicate by hand: applyRetainedResultFields (added in that same commit) and the pre-existing preserveSuccessBit each re-inlined the typeof/null/ __kernelBounded === true chain with its own cast. Both now call the guard, making it the single definition of the marker test in quickjsRuntime.ts and removing the file's last two marker casts.
Summary
Workflow runs launched inside
code_execution(the persistent kernel) now render as live workflow timeline cards in the chat transcript, instead of falling back to a generic raw-JSON tool card inside the Code Execution card.Background
Follow-up to #3987, which added live workflow cards for top-level
workflow_runtool calls. Kernel-launched runs still rendered as raw JSON because three independent things broke down for nested calls:ToolBridgegenerated its own synthetic ID for bridgedexecute()calls, while the QuickJS runtime recorded the nested transcript call under a differentcallId.workflow-run-attached(and other tool-emitted UI events such astask-createdand live bash output) therefore targeted an ID no rendered card carried.{ __kernelBounded: true, bytes, preview }marker. The marker fails the canonicalworkflow_runargs schema (so the call bounced to the generic renderer) and stripped therunId/statusneeded to re-fetch the durable run after reload.StreamManageronly attached workflow runs to top-level dynamic-tool parts, andWorkspaceStore's stale live-state sweep pruned nested call IDs mid-run.Implementation
QuickJSRuntimehands the nested record'scallIdtoToolBridgethrough a synchronous clear-on-read window (IJSRuntime.takeActiveHostCallId); bridgedexecute()uses it astoolCallId, so tool-emitted UI events land on the transcript's nested record.script_pathon boundedworkflow_runargs, andrunId/statuson boundedworkflow_run/workflow_resumeresults (via the newcaptureResultRetainedhook). Workflow results stay bounded; nothing is exempted from the caps, and marker fields win on key collisions.StreamManager.attachWorkflowRunToToolCallfalls through to nested calls and persists the attachment on the nested record (flushed immediately), so a kernel-launched run's identity survives interruption/reload even when both args and result are markers.WorkspaceStore.cleanupStaleLiveToolStatealso collects nested call IDs, so nested workflow/bash/advisor live state is no longer swept mid-run.getToolComponentroutes boundedworkflow_runargs toWorkflowRunToolCall(render-only union; the canonical tool schema is unchanged), and the card recovers the durable run from the persisted nested attachment or the retained result identity.Validation
ptc/types), bridged-ID handoff end to end through the kernel (code_execution), nested attachment persistence (streamManager), marker routing (getToolComponent), and marker-args + attachment/bounded-result rendering and recovery (WorkflowRunToolCall).make static-checkgreen on this head; targeted node + browser suites all pass on top of currentmain.Risks
__kernelBounded/bytes/preview) and by the success-bit preservation tests.await; the contract is documented onIJSRuntime.takeActiveHostCallIdand regression-tested with sequential distinct-ID assertions.Generated with
xum• Model:anthropic:claude-fable-5• Thinking:xhigh• Cost:$129.20