Repository navigation
fix(codex): preserve background waits when a turn ends - #832
Merged
lastobelus merged 1 commit intoNov 23, 2026
Merged
Conversation
Session-scoped wait marks are already persisted when the run finalizes with an older provider snapshot. Preserve the stored roster in the terminal transaction, keeping explicit cleanup authoritative. Implemented with GPT-6.2 Sol in Codex. Carry-Group: incubator Carry-Fix: #824 Carry-Observation: Keeps session-scoped Codex wait marks across normal root turn finalization after PR #791.
lastobelus
marked this pull request as ready for review
November 23, 2026 03:13
Owner
Author
|
@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. |
|
Codex Review: Didn't find any major issues. Chef's kiss. 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". |
This was referenced Nov 23, 2026
lastobelus
added a commit
that referenced
this pull request
Nov 23, 2026
Codex could drop the result of a command a thread was waiting on. If the command exited just before the marking turn ended, the result landed in the command item, and the thread and its delegated parent could finish before Codex saw it. ## What changed - **Owed results** stay pending until the turn's completion is saved, then go out through the existing continuation path. - **Automatic wraps** use Codex's token-usage notification to tell when the launch tool has returned and the shell is still running. Codex sends that notification after the batch's tools finish. - **Explicit marks** confirm on their own when `t3_background_wait` matches the command. - **Foreground commands** still get their result in the launch response. - **Unsuccessful turns**, including interruptions, clear the owed result. - **Instructions** now ask Codex for manual registration unless `lc-run` reports a registered wake. The `lc-run` launch line says LastCode already registered the wake and to end the turn without calling a tool. The standing instruction is 23 bytes shorter, and the wrapper prints the 316-byte launch line from the eval. The setting remains opt-in. ## Proof - **Adapter replay** failed before the fix on mark → command exit → turn completion. It now covers that order, automatic marking, duplicate completion events, a foreground exit, interrupted turns, and withdrawing the wait. - **Luna tool-use eval** passed 15 of 15 samples. The new wrapped case went from 0 of 3 passing to 3 of 3. - **Changed-file checks** passed across 6 files, including 273 tests. - **Recorded sessions** showed no token-usage update between launch and exit in all three foreground prepares. All three early exits from the eval had at least one update in that interval. - **Real-session acceptance** against the pushed head is pending. An automatically marked wrapper can still miss its wake if it yields and exits before the other tools in the same batch finish. Track that case in the #824 soak. Follow-up to #791, #831 and #832. Tracks #824 and convergence under #823. The same settled-turn condition is present in [upstream pingdotgg#37572](https://redirect.github.com/pingdotgg/t3code/pull/37572) at `5e048c23d68396b46e7a2e387755da157dd04bee`. Local review: 3 rounds with GPT-6.1 Terra (xhigh) at 02b382a, approved. Implemented with GPT-6.2 Sol in Codex. PR copy reviewed with Claude Sonnet 5.5 in Claude Code. Carry-Source-Ref: refs/lastcode/carry-sources/pr-833/02b382ae1173d8cc78425b824595e1d931f9592f Carry-Source-Base: 4e02407 Carry-Source-Head: 02b382a
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.
A Codex command marked with
t3_background_waitlost its hold as soon as the marking turn finished. The mark was saved withawaited: true, and then normal turn completion erased it.Cause
#791 ported opt-in background waits from upstream #37572, pinned at
5e048c23d68396b46e7a2e387755da157dd04bee. Upstream publishes marks to the run stream. The LastCode change moved marks to the session's roster-only stream, outside the run subscriber.Turn finalization still wrote the run's older provider snapshot. That snapshot omitted the new mark, so it overwrote the saved roster and cleared
awaited. The live bisect identified02ce8cbf9a5, which landed ina1c871f1062.Fix
When Codex turn finalization commits, it now keeps the stored roster in the same database transaction. Explicit Stop and recovery clears still apply, as does withdrawal of pending results from exited commands.
Test
The new server integration test sends a session-scoped mark through real ingestion and normal turn finalization. It checks that the thread's pending tasks still include the awaited command. It failed before the fix and passed afterward. The earlier adapter replay skipped server-side finalization. The new test uses a provider fixture with the real server pipeline.
All 360 tests selected by the changed-files check passed, along with lint and typecheck.
Live testing on
fe34e67ccb8301b6e1b616b8d0ff1362dae81308used Codexgpt-6-lunawithlastcodeBackgroundWaitEnabledenabled:Upstream convergence #823 · Feature tracking #824
Implemented with GPT-6.2 Sol in Codex. PR copy reviewed with Claude Sonnet 5.5 in Claude Code.