GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix(acp-adapter): reconcile pending prompts when the event stream reconnects (#4617) by dezren39 · Pull Request #4632 · developing-today/code Conversation
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 36 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Codex Review Summary: ❌ FailedThis 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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: e0dc2d77e9
Your 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".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: ae30e1d78c
Your 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".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const type = status[sessionId]?.type; | ||
| if (type === 'busy' || type === 'retry') continue; | ||
| const wasCancelled = cancelledSessions.has(sessionId); | ||
| cancelledSessions.delete(sessionId); | ||
| finishPrompt(sessionId, { stopReason: wasCancelled ? 'cancelled' : 'end_turn' }); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Wait for prompt submission before reconciling its status
If a client submits a prompt during the stream outage and its POST is still in flight when reconnection triggers reconciliation, /session/status can reach the server first and report the session as idle or absent. The remaining race is evidenced by session/prompt registering its pending entry before awaiting prompt_async (lines 448–452): the entry is already in pendingAtRequest and passes the identity check even though server-side execution has not started. This prematurely returns end_turn, and subsequent output from the accepted prompt is discarded. Coordinate reconciliation with completion of the captured prompt's submission before treating an absent status as completion.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 595e5c9 (already on this branch; replying now to close the disposition loop): session/prompt registers the pending entry with submitted: false, the flag flips only after the serve accepts the prompt POST, and reconciliation snapshots the flag up front and skips entries that were not yet submitted — so an idle/absent active-set snapshot taken while the POST is in flight cannot finish the prompt. Regression test: "reconciliation does not finish a prompt whose submission is still in flight". Verified again on the current head (dc5d3f4): node --test bin/opencode-acp-adapter.test.mjs passes 22/22.
— repo queue worker lane code-n, task 12842 (shepherding this PR)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
🤖 Agent note · picked up + parked
Shepherd status: finding 1 dispositioned (fixed in |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Reconcile snapshots the submitted flag with each pending entry and leaves entries whose prompt_async POST had not resolved when reconciliation began. Their completion arrives on the reconnected stream; an idle/absent status snapshot that predates server-side execution no longer ends them early and discards later output. Regression test: prompt_async delayed past a stream drop + reconnect with absent status; asserts the later streamed chunk is delivered. Addresses Codex P2 finding on ae30e1d (in-flight POST race).
|
Shepherd disposition of the open Codex P2 (in-flight POST race, reviewed commit ae30e1d): Fixed in 595e5c9. Each pending entry now carries a submitted flag flipped only after the prompt_async POST resolves, and reconcilePendingPrompts snapshots that flag with the pending entries. Entries unsubmitted when reconciliation began are skipped: their completion arrives on the reconnected stream, and the POST failure path still cleans up if submission itself fails. Laptop verification: node --test bin/opencode-acp-adapter.test.mjs 8/8 pass; the new regression test (prompt_async delayed past a stream drop plus reconnect with absent status) fails on the pre-fix adapter with the streamed chunk discarded, confirming it covers this race. CI note: guard workflow on 595e5c9 queued with no runner pickup; repo-wide backlog visible on other fresh runs. Merge once green. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@codex review |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Codex Review: Didn't find any major issues. More of your lovely PRs 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". |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…econnect-reconcile # Conflicts: # bin/opencode-acp-adapter.mjs # bin/opencode-acp-adapter.test.mjs
|
🤖 Agent note · shepherd update (task 12170, lane code-o)
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: 0f6458719e
Your 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".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if (activeIds.has(sessionId)) continue; | ||
| const wasCancelled = cancelledSessions.has(sessionId); | ||
| cancelledSessions.delete(sessionId); | ||
| finishPrompt(sessionId, { stopReason: wasCancelled ? 'cancelled' : 'end_turn' }); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fence late terminal events before accepting the next prompt
If a prompt finishes just after the SSE connection is re-established, the active-set response can report it absent before its terminal event arrives over the independent SSE connection. This call completes the old ACP request and allows the client to submit another prompt, but the delayed session.execution.succeeded or .failed event then completes that newer prompt: handleServeEvent checks only the session ID against pendingPrompts. The pending-object identity check protects against stale status responses, not stale SSE events. Correlate terminal events with their execution, or otherwise fence the old execution's events before accepting another prompt.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in dc5d3f4 (task 12842, lane code-n shepherding this PR). Terminal events carry only the session id, so the fence arbitrates with the active set:
staleTerminalFences), since that finish completes the ACP request without consuming the serve's terminal event for the prompt.resolveTerminalEvent: it consumes the fence and checks GET /api/session/active (reading factored into fetchActiveSessionIds, shared with reconciliation). Session active again → the event is the stale one for the already-finished prompt and is dropped; session no longer active → the event is the newer prompt's own and finishes it. If the probe itself fails, it falls back to the pre-fence finish behaviour rather than hanging the prompt.Regression test: "late terminal event from a reconciled prompt does not finish the next prompt (#4617)" — prompt 1 is reconciled during a drop, its late execution.succeeded arrives while prompt 2 is running (session active) and is dropped, and prompt 2 completes only on its own event after leaving the active set. node --test bin/opencode-acp-adapter.test.mjs: 22 passed, 0 failed on dc5d3f4.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
🤖 Agent note · parked
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
🤖 Agent note · verified / awaiting CI (parked)
Independent verification of the current head
Blocked on CI, not on code: all five checks sit QUEUED — the repo has 100+ queued workflow runs and no run has started for this head commit. Per the worker 5-minute CI rule this task is parked with a 20-minute resume; on resume, re-read checks and merge if green (targeted tests already verified, diff matches intent, no hold/Drew-owned restriction). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…iation (#4617) A reconciliation finish completes the ACP request without consuming the serve terminal event for that prompt; the event can still arrive on the reconnected stream carrying only the session id, and would finish the next prompt (Codex P2 on PR #4632). Reconciliation now arms a per-session stale-event fence; the first terminal event while a fence is armed is arbitrated against GET /api/session/active: session active again = stale event, dropped; session no longer active = the newer prompt's own event, finishes it; probe failure falls back to the previous finish behaviour. Active-set reading is factored into fetchActiveSessionIds, shared with reconciliation. Regression test: late terminal event from a reconciled prompt does not finish the next prompt. node --test bin/opencode-acp-adapter.test.mjs: 22 passed. Task 12842, lane code-n (shepherding PR #4632).
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
agent-note:v1 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
openclaw ACP adapter: pending prompts are never reconciled when the SSE event stream reconnects (#3997)
There was an error while loading. Please reload this page.