Repository navigation
Prepare an agent whose native release inspection was blocked - #361
Merged
Merged
Conversation
The thread snapshot held every agent whose saved nativeRelease phase was not resumed or released. A blocked inspection never unsubscribed, so the thread stayed loaded, and Python prepares such an agent normally. The Rust backend has no release driver to settle the record, so the hold never cleared, and each new input failed with thread-preparation/NativeRelease. Hold only where Python Runtime.prepare_locked and reconcile_unknown do not prepare: a pending tool reset, or an unsettled unknown, checking or unsubscribing release that waits for a captured reset or retries thread/unsubscribe on the current thread and connection. The new test runs the real Python preparation over each saved release and compares it with the production Rust preparation. Co-Authored-By: Claude Opus 5.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.
Problem
A live lead agent (
00399ad7) isfailedwiththread-preparation/NativeRelease. Its pendingruleinput from 2026-10-19 never runs. Its savednativeReleaseis{"phase":"blocked","error":"native background command is active", "resetPending":false, ...}from 2026-10-18, on a connection of an earlier backend.blockedmeans the idle-release inspection found native work and never sentthread/unsubscribe. The thread stayed loaded.Root cause
account_worker/preparation/snapshot.rs(thread_snapshot, admission) held every agent whosenativeRelease.phasewas notresumedorreleased. The Rust backend has no native release driver, so nothing settles such a record. Every new input re-admits the agent, and the hold maps toPreparationRefused, so the agent fails again (prepare_readyinpipeline.rs).Python prepares such an agent.
Runtime.prepare_lockedrefuses only a truthyresetPending, andcodex_native_release.reconcile_unknownacts only onunknown,checkingorunsubscribing.Change
The new
native_release_heldfunction holds only in the cases where Python does not prepare:resetPendingis truthy.unknown,checkingorunsubscribing, and the release is a captured reset (resetActorEpoch) that waits for exact native closure.unknown,checking(withoutinspectionPhase) orunsubscribingon the current thread and connection. Python retriesthread/unsubscribehere. This adapter has no release driver, so it holds.All other releases prepare normally. This includes
blocked, a superseded inspection, and an unsettled release on an earlier connection.A failed hold that remains is still a failed start, as in Python (
start_errorafter a raise fromprepare_locked).Tests
account_worker::tests::preparation_review::native_release_phases_match_python. It runs the real PythonRuntime.prepare_lockedandreconcile_unknownover 13 saved releases, with only the runtime host replaced. Then it runs the production Rust turn preparation over the same rows. It fails onmainatblocked-earlier-connection(the live record shape).account_transfer_executortest: the fabricated{"phase":"pending"}blocker is now a real hold (resetPending: true).cargo test -p studio-runtime-services --lib -- account_worker account_transfer thread_prepare: 292 passed. The 7 failures are the known failures on base (auth_holdx5,publication_off_pathx2).--test thread_prepare_corpus,--test account_transfer_corpus,--test account_transfer_driver: all pass.cargo clippy -p studio-runtime-services --lib --tests: no findings in the changed files.just test-fast(local): it stopped at "server safety witnesses". The failure waslimit-reset-http-contract.pysetUpClass: the backend did not start in my isolated environment. This PR changes no Python. The later stages did not run locally, so hosted CI is the fast-tier evidence.Live state (read-only check)
13 agents have
nativeRelease.phasenot in (resumed,released). 12 areblockedand 1 ischecking. 11 of them are deleted. The two that are not deleted:00399ad7(failed, 2 pending inputs).d5dd7220(completed, no pending input). It would fail on its next input without this fix.