Conversation
Fixes #5350's IssueTerminalTicket exit-detection: it flagged the agent 'exited' whenever ANY agent terminal was closed/failed, but every resume closes the old terminal and opens a new one, so a resumed session was always mis-reported as exited (410) even with a live open terminal. Now only exits when a dead terminal exists AND no live one does. Belongs to #5350's lineage (main), parked here so the combined deploy carries it; should become a standalone main fix.
Collaborator
|
Fixed two issues in this PR: a terminal is now considered live only when it has not expired and its worker is still connected. This prevents old terminal records from blocking the correct “agent exited” result fixed the flaky backend test cleanup by waiting for the shared authentication read to finish before the test ends. Also ran the Cloud build, vet, and race tests successfully. |
Collaborator
|
@Pritom14 please resolve the merge conflicts |
Resolve the one conflict in backend/internal/service/agent/codex_accounts_test.go toward main: main hardened this test (shared-call wait + TempDir-race fix, the 'shared' rename) and this branch carried the older version. The branch's actual change — the false-410 exit-detection narrowing in worker_transport_store.go — auto-merged cleanly on top of #5350's relay (both AND NOT EXISTS(opening/open) blocks intact). Taking main's test also fixes the flaky TestAuthenticationRequestCancellationDoesNotCancelSharedRead CI failure. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
TestRunInstallScriptCancellationCleansUp flaked on loaded CI runners. The 50ms context deadline can fire while the download is still in flight, before RunInstallScript creates installers/tmp, so os.ReadDir returned ENOENT and the test treated "nothing leaked" as a failure. Accept a non-existent scratch dir as a clean outcome and only fail on surviving entries. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
mohakchakraborty2004
self-requested a review
September 17, 2026 16:18
mohakchakraborty2004
approved these changes
Sep 17, 2026
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.
Code changes: +32 -2
Tests: +14 -12
Others: +0 -0
What
Fixes a false-positive "agent terminal has exited" (HTTP 410 TERMINAL_SESSION_EXITED) on any resumed cloud session.
Why
IssueTerminalTicketdecided the agent had exited if ANY agent terminal for the session wasclosedorfailed. But every resume closes the previous agent terminal and opens a fresh one, so a session that has been paused and resumed even once always carries a closed terminal. The result: the browser terminal-ticket mint returned 410 in a loop for a live session, and the UI showed "Connected" with no terminal. This came in with #5350 and only surfaces once a session has been resumed.How
The agent is treated as exited only when a dead terminal exists AND no live one does. Both occurrences of the check in
worker_transport_store.gonow requireNOT EXISTSanopening/openagent terminal, so a resumed session with a live open terminal is no longer misreported.Testing
cloud gofmt, build, vet, and
go test ./internal/httpapi/pass. Verified against the l-a run where a resumed orchestrator with a live open terminal was being 410-blocked.