Repository navigation
🐛 fix: Wait for Side Chat Target Readiness - #18480
Conversation
|
/quality ignore |
|
@codex review |
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. |
Quality reportGate: open. Quality checks explicitly ignored for this commit.
The gate opens only when the workflow, source selection, tooling verification, and every report job succeed. A report job fails on a failed test in its workspace's own Jest run, a tool error, a job timeout, or an incomplete mutation report, including a mutation shard that reaches its execution budget. A cancelled workflow keeps the gate closed. Scores are advisory. A change-risk file marked incomplete or unavailable, for example by a failed |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the change that defers side-chat continuation until saved-agent metadata settles.
No open issues 🎉
What changed in this PR
Fixes side-chat continuation sending too early by waiting for saved-agent metadata alongside conversation history. This lets the existing one-shot send run after the target query settles, while preserving readable history and an editable draft if metadata fails.
Changes:
- Passes the optional
agent_idthrough the shared side-chat host interface. - Reuses cached metadata and shares in-flight queries without loading history and metadata serially.
- Adds regression coverage for delayed metadata, failed target reads, cache reuse, and refused drafts without automatic replay.
| File | Description |
|---|---|
packages/chat/src/react/side/host.tsx |
Adds agent_id to the host’s conversation input. |
packages/chat/src/components/side/__tests__/panel.spec.tsx |
Tests editing and clearing refused drafts without automatic replay. |
e2e/specs/mock/subagent-activity.spec.ts |
Delays agent metadata in the continuation browser test. |
client/src/Providers/SideChatHostContext.tsx |
Coordinates history and target readiness using the shared agent query. |
client/src/Providers/__tests__/SideChatHostContext.spec.tsx |
Tests readiness, failure handling, cache reuse, and request deduplication. |
Review effort: Balanced
|
Codex Review: Didn't find any major issues. Nice work! 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". |
Summary
Continuing a finished subagent in a side chat can leave the question in the composer without starting a reply. This happens when conversation history loads before the saved agent's details: the one automatic send runs too early, the submission guard refuses it, and the question becomes an unsent draft.
Wait for the existing authoritative agent query alongside history before attempting that send. A successful continuation sends once and replies in the side chat. If the target cannot be read, the history stays visible and the question remains an editable draft.
How it works
The app's side-chat host warms the same React Query entry that the submission guard checks. It reuses a matching successful entry and shares an in-flight request with existing agent consumers. History and metadata load in parallel. A metadata failure settles separately so it cannot hide successfully loaded history. The existing one-shot composer and refusal behavior remain unchanged.
Type of change
Testing
Tested environments/configuration:
Local production app in Chrome, deterministic provider and MCP fixtures, disposable local storage. The same continued-child scenario delays only the agent-detail response by 500 ms: it fails on current
devand succeeds with this change, using the existing assertions and timeouts.Automated tests:
depcheckis absent.Screenshots / recordings
Continue a finished child's conversation with “What did you find?” while its metadata response is delayed. Before, the question remains unsent in the composer. After, it appears as a message, receives a reply, and the composer clears. Both captures use the same 1280×720 viewport and frame the same portion of the side chat without scaling.
Risk / compatibility
The side-chat host receives the conversation's existing optional
agent_id; no wire, configuration, or persisted-data shape changes. Other endpoint types and ephemeral agents keep their existing loading behavior. Closing the panel retains the shared query's ownership, while the existing follower fence prevents a late send.A cold saved-agent target may require a metadata request; existing consumers share the same query. Matching successful metadata adds no fetch, including subsequent history reads. Initial readiness waits for the slower of history and target metadata rather than adding a serial wait. No polling or automatic retry of refused messages is introduced. Production latency and fleet-level request volume have not been measured.
Checklist