agents proxy: opencode M6 — reconnect with replay_from, hardening, TestedVersion 1.18.27 - #1952
Open
julia-ye wants to merge 1 commit into
Open
agents proxy: opencode M6 — reconnect with replay_from, hardening, TestedVersion 1.18.27#1952julia-ye wants to merge 1 commit into
julia-ye wants to merge 1 commit into
Conversation
… 1.18.27 The event loop now survives transient harness-stream drops inside one client SSE response: reconnect with a replay_from cursor (last event id SEEN, recorded unconditionally and never compared — event ids are random UUIDv4s, so a max-id ratchet would skip events), backoff with a healthy-duration budget reset, and terminal-error classification. When the loop gives up with a turn in flight it fails loudly — pending permission dialogs dismissed, dangling tools and the assistant message closed, session.error, idle — instead of leaving the TUI spinning. A stream end with no turn in flight still ends the SSE response, as before. Of the plan's remaining M6 items, GetSession-before-bind, signal handling, and context-rooted shutdown already landed in M1, and the unhandled-route/ event log has been empty since M4 — the stub inventory is complete. TestedVersion bumps to 1.18.27 (re-captured: attach burst identical) and the start-proxy help now documents the opencode bridge and its tested version. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1951 (M5). PR 6 of 6 — the final milestone of the opencode facade ladder (plan doc in the hosted-agents subtree).
What
SSE reconnect with a
replay_fromcursor. The event loop now survives transient harness-stream drops inside one client SSE response: it reconnects with the last event id seen as the resume cursor — recorded unconditionally, never compared, because event ids are random UUIDv4s and a max-id ratchet skips events (the codex facade's shippeddrainStreambug; the test harness mints random ids precisely to catch this). Backoff mirrors the codex facade /doctl agents attachschedule (5 attempts, 1s→30s, budget reset after a 30s-healthy connection), with terminal-error classification (401/403/404/409 — including the single-consumer conflict with a concurrentdoctl agents attach).Loud failure on give-up. If reconnecting is exhausted or pointless while a turn is in flight, the client is told: pending permission dialogs dismissed, dangling tool parts and the assistant message closed,
session.error, idle — never a silent spinner. A stream end with no turn in flight still just ends the SSE response (the TUI re-attaches itself), exactly as before.TestedVersion → 1.18.27 (re-captured during M5: attach burst identical to 1.18.25, plus the permission surface), and
start-proxy --helpnow documents the opencode bridge, theopencode attach … --continueconnect line, and the tested version (pinned by a help test so it can't rot).Plan items that turned out to be already done
Checked rather than re-implemented:
GetSessionvalidation before bind, SIGINT/SIGTERM handling, and context-rooted shutdown all landed with M1; the unhandled-route/unhandled-event log has been empty since M4's stubs (/diff,/todo) and event no-ops — the live M5 runs logged nothing. The stub inventory is complete at 1.18.27.Testing
reconnect_test.go: mid-turn drop resumes with the cursor (each delta arrives exactly once — dedup is the replay_from contract, not id comparison), no-turns stream end still closes the response, a terminal error fails the tracked turn loudly (dialog dismissed, assistant finalized,session.error+ idle), and open-retries are bounded. Tests warm the history cache first so the harness's error/drop injection deterministically hits the live stream, not the facade's backgroundreplay_onlywarm.ResolveHITL(rolled back on error) — the harness can deliverrun.human_input_receivedthe instant the resolve lands, racing a write placed after it, which could makepermission.repliedecho the wrong string for analwaysreply.agentproxytree race-clean; codex untouched; live turn (including a permission approval) verified against the dev stack on this build.🤖 Generated with Claude Code