Repository navigation
[AI-1762] §2.6: activate envelope-sourced transcript for hosted app-server - #624
Conversation
…erver Flip the app-server path from the dormant hook-sourced transcript to the live envelope source. One envelopeSourced decision in StartAppServerAsync now drives all four coupled facts so they can never desync: the guard-1 marker (BuildEnv → KCAP_HOSTED_APPSERVER, stands the rollout watcher down), the runtime's envelope emission (emitEnvelopeTranscript), the deferred first turn behind the source claim (deferFirstTurn), and the forwarder wiring (Transcript: runtime on HostedRuntimeStart). Everything downstream was already built and merged and keys off these: the orchestrator drains the runtime's envelopes through AcpTranscriptForwarder and, seeing RequiresSourceClaimBeforeFirstTurn, runs source-claim → BeginFirstTurn → confirm (#612); guard-2 refuses any stray hook write server-side (#1547); death-close is the existing finalize → EndAgentSession, and the 60-min rollout-idle fallback disengages automatically because the stamped marker suppresses the hook's watcher (#617). So this is a four-value flip in one method, not new machinery. Scope: this activates the app-server path, which today is reviewers only (UsesAppServer stays `active && IsReviewFlow`) — the interactive routing flip is deliberately the LAST step, after §2.6 lifecycle + §2.7. Gated behind codex.transport=app-server (default pty), so a default daemon is byte-unchanged; requires a server carrying #1530/#1547 (server-before-CLI); and AI-2110's live cert validates it before app-server becomes the default. Only the dormant-marker factory test inverts (now asserts the marker is stamped, the Transcript is wired, and the first turn is deferred). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
PR Summary by QodoActivate envelope transcripts for hosted Codex app-server
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1.
|
|
Two-vendor review complete: Copilot clean, Kiro clean / ship-ready. Kiro raised one non-blocking resilience item — a daemon crash between spawning Codex and |
…turn (qodo) qodo reliability bug (latent in #612, armed by this activation): a launch that finalized during the source-claim / forwarder setup could still release the held first turn. StartForwarderAfterBind aborts silently when finalize cancelled acpCts and/or removed the agent, but StartEnvelopeSourcedSessionAsync then called BeginFirstTurnAsync unconditionally, and BeginFirstTurnAsync unsealed the dispatcher (sending turn/start) BEFORE observing its token — so turn/start could race the teardown. Two-part fix: BeginFirstTurnAsync now ThrowIfCancellationRequested BEFORE Unseal (the dispatch runs on CancellationToken.None and can't be recalled, so this is the only safe gate); and StartEnvelopeSourcedSessionAsync re-checks the SAME liveness StartForwarderAfterBind guards on (cancelled OR agent-removed) before dispatching, so the agent-removed-but-token-live arm is covered too. Both land in the OCE/return arms that already tear down or log-and-abort. Added Cancelled_BeginFirstTurn_does_not_ dispatch_the_held_turn. Also trimmed the activation test comment qodo flagged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
What
Flips the hosted-Codex app-server path from the dormant hook-sourced transcript to the live envelope source. One
envelopeSourceddecision inStartAppServerAsyncnow drives all four coupled facts so they can never desync:BuildEnv→KCAP_HOSTED_APPSERVER, stands the rollout watcher down),emitEnvelopeTranscript),deferFirstTurn),Transcript: runtimeonHostedRuntimeStart).Why it's a 4-value flip, not new machinery
Everything downstream is already built + merged and keys off these values:
AcpTranscriptForwarderand — seeingRequiresSourceClaimBeforeFirstTurn— runs source-claim →BeginFirstTurn→ confirm (Codex app-server: orchestrator deferred-first-turn source-claim sequence #612);FinalizeAgentRunAsync→EndAgentSession, and the 60-min rollout-idle fallback disengages automatically because the stamped marker suppresses the hook's watcher ([AI-1762] guard-1: suppress the codex hook watcher for envelope-sourced sessions #617).Scope + safety
UsesAppServerstaysactive && IsReviewFlow; the interactive routing flip is deliberately the LAST step (after §2.6 lifecycle + §2.7), so interactive stays on PTY.codex.transport=app-server(defaultpty) — a default daemon is byte-unchanged.Tests
Only the dormant-marker factory test inverts — it now asserts the marker is stamped, the
Transcriptis wired, and the first turn is deferred. Runtime (19), orchestrator forwarding (8), and source-claim (4) tests pass unchanged, confirming the built path activates end-to-end.Part of AI-1762.