Repository navigation
feat(site): stop and resume workflow runs from the card and panel - #346
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 15a7616c45
ℹ️ 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".
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 15a7616c45
ℹ️ 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".
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. 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". |
@codex review |
|
Codex Review: Didn't find any major issues. 👍 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". |
…sue #323) Stop and Resume on the run_workflow tool card, next to the heading in the Workflows panel run detail, and a composer prefill for Resume. - ForkWorkflowStopButton: pure move of the panel's stop control (confirm dialog, mutation, cache updates) so the card and the panel share it. - ForkWorkflowResumeButton: dispatches a fork-workflow-resume request. - ForkWorkflowResumePrefill: listens for that request, appends the resume prompt to the composer without wiping a draft, and focuses it. Never sends. - useCanWriteChat: shared update check; both controls stay hidden while the check is pending or false, since the stop route authorizes as a chat update and a resume sends a chat message. - LiveForkWorkflowTool mounts the controls for running and interrupted runs; the static interrupted card stays read-only. The composer hook line is the single upstream-file change (AgentChatInput.tsx passes inputRef to ForkComposerSlot). Closes #323
#323) P1s: - Prefill preserves the draft's structured nodes (file references, skill chips) by appending through restoreEditorState instead of rewriting the editor as plain text. - The live card passes its Run row as the stop dialog's focus fallback, so keyboard focus returns somewhere after a successful stop unmounts the button. P2s fixed: - ResumeButton test installs the dispatch spy before clicking, so it no longer depends on test order. - The resume event helper narrows with instanceof CustomEvent and validates the detail instead of asserting the shape. - The RunDetail stories' write-access override carries the chat seed, since story-level queries replace the meta-level array. - The NoWriteAccess story's play no longer asserts; the screenshot shows the absent controls and the assertions live in the Vitest test. - The StopButton header no longer narrates where the code moved from. P2s answered on the review thread, not changed: - Surfacing authorization-check failures separately from pending: the controls hide on any non-true result by design; the failed query stays inspectable. - Gating Resume on composer send eligibility: Resume only prefills and the user sends, so a wider permission set is acceptable for now. - Routing already-interrupted tool results through the live path: that is a #324 run-detail gap, not a regression from this PR.
…ser (issue #323) A mounted Lexical editor serializes to a non-empty JSON tree even when it has no text, so the old editor-state branch never took setValue and a fresh composer ended up with two blank lines before the resume prompt. Branch on the composer's text content instead, and make the test double match the real handle so the empty-composer path stays covered.
4a5449f to
46b9ed7
Compare
Rebased onto main (no code changes; head is now 46b9ed7). @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 46b9ed7cd9
ℹ️ 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".
Merged main in (merge commit 8b97cc4, no code changes to this PR's files). @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8b97cc4ffe
ℹ️ 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".
Merged main in again (merge commit f24e592, no code changes to this PR's files; fork-ci green on this head). @codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! 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". |
Address Opus review findings before the next Codex round:
- P1: Resume no longer wipes a chip-only draft. ForkWorkflowResumePrefill
branches on getContentParts().length === 0 instead of empty text,
since FileReferenceNode/SkillInvocationNode report empty text.
- restoreEditorState no longer adds a stray space before appends that
already start with whitespace.
- Double-click Resume no longer prefills the same prompt twice; the
resume dispatch is guarded per run via skipIfPrompted.
- Stop 409 now shows an info toast ("already ended") instead of an
error toast.
- Card Stop button gets aria-label "Stop workflow run".
- ForkWorkflowTool stop test asserts the settled mutation data instead
of a cache entry the running refetch evicts.
- Tests: shared seedChatWriteAccess helper in testHelpers/forkWorkflows,
mockApiError carries top-level status (matching AxiosError), drop dead
helpers and toBeInTheDocument per FE1, no as CustomEvent cast (FE2),
story Date.now spy uses mockName("spy") instead of disabling actions.
- Hide Stop/Resume for archived chats via useCanWriteChat.
…story seeds (#323) Address the open Codex P2 threads before the next review round: - Remove the unused optional label prop from ForkWorkflowResumeButton; both callers render "Resume run", and the only override consumer was the test created for it. - Narrow dispatched events with instanceof CustomEvent instead of casting Event to CustomEvent in the workflow tests, per the frontend rule against avoidable casts. - Inline the chat and update-check query seeds in each live-card story instead of a shared pre-wired helper, so each story's cache state is visible in the story.
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1457f3f6bd
ℹ️ 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".
) The resume dedup marker was never cleared, so after the composer listener consumed a prompt every later Resume click for that run was a silent no-op until another run was clicked or the page reloaded. The listener now clears the marker when it accepts the prompt, so the marker only deduplicates the immediate double click. Covers the later-click path in the button and prefill tests.
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5582e646bb
ℹ️ 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".
…arker (#323) The dedup marker never worked while a composer was mounted: dispatchEvent runs the listener synchronously, and the listener consumed the marker before requestForkWorkflowResume returned, so a double click prefilled the prompt twice. Drop the marker entirely. The listener now only focuses the composer when its text already ends with the resume prompt, which is the signature of the first click having landed; it prefills again otherwise, so a cleared or sent draft can still be prefilled again, and a request for another chat is dropped without side effects. Also revert the needsSpace tweak in ChatMessageInput.restoreEditorState (upstream file) now that the prefill appends "\n\n" plus the prompt: the leading whitespace already separates it, and the upstream behavior is unchanged for every other caller. Tests: a double-click test with the real listener mounted, a test that a dropped request for another chat does not block the next one, and a test that an archived chat hides Stop and Resume in the run detail.
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5df0ef06c0
ℹ️ 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".
…323) Address the Codex review on 5df0ef0: - Hide Resume on the live card and in the Workflows panel while the chat is in plan mode: plan-mode turns omit run_workflow, so a resume request could not run the workflow. Stop stays. Both components read the chat's cached plan_mode, so no props change hands. - The run row that receives focus after Stop keeps a visible focus-visible ring (outline-hidden plus ring-2) instead of hiding the outline, so keyboard users see where focus landed. - ForkWorkflowsPanel.test replaces its duplicated seed block with seedChatWriteAccess. - Tests: plan mode hides Resume on the panel detail and the live card, Stop stays in plan mode on both, and the panel uses the shared seed.
@codex review |
|
Codex Review: Didn't find any major issues. 👍 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". |
Merged as c71b3ab (squash), parent 29781c8 (#360). The merge ran after 29781c8 had deployed ( Gates on head 00c62e7:
Independent Opus reviews covered f24e592, the delta to 5582e64, and I reviewed the last delta to 00c62e7 (plan-mode Resume gate, focus ring, test helper). All P1 and P2 findings were fixed. Not exercised: a live run against a dev server (Stop on a real running workflow, Resume after a real restart), and Storybook visual checks. |
Closes #323
What
Stop and Resume controls for fork workflow runs, plus a composer prefill for Resume.
ForkWorkflowStopButtonis a pure move of the Workflows panel's stop control (confirm dialog, mutation, cache update, focus fallback), so the card and the panel run detail stop runs through the same component. The live card mounts it while a run is running.ForkWorkflowResumeButtondispatches afork-workflow-resumerequest scoped by chat ID. The panel shows it next to the heading of an interrupted run; the live card shows it once its poll reports the run interrupted.ForkWorkflowResumePrefill(mounted fromForkComposerSlotbehind thefork-workflowsexperiment) listens for the request, appends the resume prompt on a new line without wiping a draft, and focuses the composer. It never sends. Listeners clean up on unmount and drop requests for other chats.useCanWriteChatruns thecanUpdateChatcheck for the run's chat. Both controls stay hidden while the check is pending or false, because the stop route authorizes as a chat update and a resume sends a chat message. The interrupted detail keeps its "ask the agent" hint only when the viewer cannot write.AgentChatInput.tsxthat passesinputReftoForkComposerSlot. Polling is unchanged (site, coderd: five fork panels poll; publish one chat watch event and invalidate on it #304 owns it).Test plan
pnpm teston the touched tests: 26 unit tests pass (ForkWorkflowTool.test.tsx10,ForkWorkflowRunDetail.test.tsx4,ForkWorkflowsPanel.test.tsx3,ForkWorkflowResumePrefill.test.tsx4,ForkWorkflowStopButton.test.tsx3,ForkWorkflowResumeButton.test.tsx2), covering stop from the card updating the panel's cached detail, hidden controls while the check is pending or false, the child-chat cross-cache guard, the 409 path, and prefill append/focus/scope/unmount.pnpm test:storybookon the touched stories: 33 story tests pass (17 tool-card, 12 run-detail, 4 run-list), including new stories for the card's Stop, interrupted Resume and no-write-access states.npx tsc --noEmit -p tsconfig.json: exit 0.biome check,pnpm lint:oxlint,biome format: clean on the touched tree.node scripts/check-compiler.mjs: same single pre-existing warning asmain(ForkHtmlAttachmentViewer.tsx: onFrameLoad), verified by stashing this branch's changes.