Repository navigation
fix: commit spawn-failure tool results and converge the promoted queue - #27498
ibetitsmike wants to merge 7 commits into
Conversation
…ails A failed user_prompt_submit dispatch during subagent spawn admission returned before the commit, discarding the whole step. A sibling tool in the same batch had already run and mutated the workspace, so its result was lost and the tool would be re-executed on retry. The step now commits and the turn fails afterwards through the existing PostCommitError path, which runs CommitStep and FinishError atomically. Spawn admission takes precedence over a concurrent post_tool_use failure because it is the causal root; the other error is logged. post_tool_use no longer fires for a refused spawn result, since that tool never ran.
…eneration The manual-compaction contract claimed the chat always returns to waiting with no assistant follow-up. The generation decision reads user-visible history, so a post_compact effect that commits a user-visible message leaves the history incomplete and the turn continues. A model-only effect reaches the model without resuming. No behavior change. TestManualCompactionPostCompactEffects pins both sides of the distinction, and the existing hooks-disabled manual compaction test is scoped to that case.
A send that promotes the queue head suppresses that ID locally, but a concurrent queue mutation in another tab can leave the row queued server-side, so the transcript and the queue both showed it until the next authoritative snapshot. The page now issues one uncursored messages request after the promotion and hands the result to the store, which clears the promotion markers and applies the snapshot in a single transition. The store counts every authoritative snapshot, including the stale ones it discards, so a queue_update arriving during the fetch makes the refetch a no-op.
…ve chat The queue store is shared across chats, so a promote convergence request that resolves after the user navigates away applied the previous chat's queue to the one now displayed. Pass the originating chat ID through to applyPromoteRefetchQueuedMessages and drop the response when it no longer matches the active chat.
Docs previewCheck off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here. |
Documentation CheckUpdates Needed
The other two changes need no docs:
Automated review via Coder Agents |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b31356291
ℹ️ 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".
…efetch applyAuthoritativeQueuedMessages advanced the queue version before deciding whether to discard a snapshot as stale, so a delayed queue_update naming a promoted ID both failed to apply and invalidated the in-flight convergence refetch. Any message another tab queued in that window stayed invisible until the next update. Advance the version only when a snapshot is accepted. Route the convergence request through react-query per FE7, using a dedicated uncursored query so it gains request deduplication, retry, and error handling without refetching every loaded infinite-scroll page.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fda7c2f0c6
ℹ️ 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".
Return the queue the store actually applied, so the caller mirrors the filtered result into its cache instead of the raw server snapshot. The raw snapshot can still list a row suppressed by an overlapping explicit promotion, which reappeared after navigating away and back. Advance the convergence fence whenever the active chat changes, so a request issued before an A to B to A round trip cannot apply to the later visit.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c20b97343b
ℹ️ 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".
… story The convergence response matched the optimistic queued message, so the assertions were already satisfied by the optimistic reconciliation and stayed green with the settle fetch removed. Have the server also report a message queued by another tab, which only the convergence fetch can reveal.
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! 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". |
|
Closing: this change is now folded into the base PRs of the stack, so it no longer needs a separate PR. The spawn-failure tool result commit moved into #27429, and the five frontend queue-convergence commits were squashed into a single commit in #27430.
|
Second of two follow-up PRs from review of the chat lifecycle hooks stack. Stacked on #27497.
Addresses three findings that were escalated rather than fixed in place, because fixing them inside the reviewed PRs would have restacked the whole stack and invalidated exact-head approvals.
Commit tool results when a spawn hook dispatch fails
When a
user_prompt_submithook refused a subagent spawn,executeLocalToolsreturned immediately. Sibling tools in the same batch had already run, but their results were discarded, so the model never saw them and the chat errored with no record of the work.The turn now falls through to the normal commit path and passes the classified dispatch error as
PostCommitError.commitGenerationStepalready commits the step and finishes with the error atomically, so sibling results persist while the chat still parks in error.Two details worth reviewing:
post_tool_usedispatch also fails. Spawn admission is the causal root and preserves the expectedlast_error. The concurrent error is logged.PostToolUseResultssweeps every non-provider result, which would have firedpost_tool_usefor a spawn that never ran. It now skips results carrying a dispatch failure, reusing the same per-result predicate asDispatchFailureFromResults. Siblings still dispatch.GenerationDispatchErrorleavesRetryablefalse, so this does not introduce a retry loop.Document that post_compact effects can resume generation
Documentation only, no behavior change. Manual compaction normally returns to
waitingwith no assistant follow-up, but apost_compacthook effect that commits a user-visible message leaves visible history incomplete and resumes generation. A model-only effect such asmodel_contextdoes not, because it is filtered out of the query that the completeness check reads.The existing manual compaction test ran with hooks disabled, so this interaction was uncovered. It is renamed to say so, and a new table-driven test pins both cases.
Converge the queue after a promoted send
After a promote, the client suppressed the promoted head locally, but only the server knows the resulting queue when another tab queued or promoted concurrently. The page now issues one uncursored
getChatMessagesrequest and applies the result through a single new store action.Three traps this avoids, all found while designing it:
invalidateQuerieswould refetch every loaded page, becausequeued_messagesrides on page 0 of the infinite query.queue_updatehas arrived, so a cache-driven fix would be inert.The store tracks a convergence fence that advances whenever an in-flight request goes stale: an accepted authoritative snapshot, or a change of active chat. The apply is dropped when the fence moved, which covers both a server update landing mid-request and navigation away from the chat, including an A to B to A round trip. The apply is additionally scoped to the originating chat by identity, since the fence is a token the caller captures and a late capture would otherwise carry another chat's queue into the shared store.
The store action returns the queue it actually applied, which the caller mirrors into the react-query cache. Returning the raw server response would have re-cached a row that an overlapping explicit promotion had suppressed.
Validation
make lintcleango test ./coderd/x/chatd/... -race -count=1greenAgentChatPage.stories.tsxsuite (25 stories), AgentsPage unit suites, tsc, biome, knip, and React compiler lint all green