fix: preserve agent task run metadata across Lab offload#7894
Merged
Conversation
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.
Closes #7887
Root cause
The controller created a typed
agent_task_runobservation record under the durable cook run ID. Lab evidence mirroring later reused that same ID for a genericrunner-execupsert, replacingmetadata_jsonand deleting the typed lifecycle payload required by status and finalization.Fix
When a mirror target is an existing typed agent-task run, bind the accepted Lab job through the lifecycle handoff operation and merge Lab evidence into the existing observation metadata. Generic runner mirrors retain their prior behavior.
Regression tests
cargo test --lib core::runner::evidence::tests::mirroring_lab_job_preserves_agent_task_lifecycle_metadata. It creates the persisted controller proxy, mirrors both running and successful Lab job evidence under its durable ID, then verifies lifecycle rehydration, runner/job identity, typed metadata, and Lab evidence.cargo test --lib core::agent_task_lifecycle::tests::controller_proxy_is_queued_before_handoff_then_binds_runner_child. It verifies the existing proxy-to-runner handoff contract.cargo test --lib core::runner::evidence::teststo exercise the complete evidence-mirroring module.Backwards compatibility
No schema or CLI contract changes. Existing generic runner-exec mirroring is unchanged. Existing typed agent-task records now retain their lifecycle metadata and gain merged Lab evidence instead of being converted to generic runner records.
Test results
cargo fmt --check: passed.cargo test --lib core::runner::evidence::tests: passed, 15 passed; 0 failed; 7,205 filtered out.cargo test --lib core::runner::evidence::tests::mirroring_lab_job_preserves_agent_task_lifecycle_metadata: passed, 1 passed; 0 failed; 7,219 filtered out.cargo test --lib core::agent_task_lifecycle::tests::controller_proxy_is_queued_before_handoff_then_binds_runner_child: passed, 1 passed; 0 failed; 7,219 filtered out.cargo test --lib: started 7,220 tests but exceeded the 600-second command limit after unrelated release tests reported failures.RUST_TEST_THREADS=1 cargo test --lib: exceeded the 1,200-second command limit; unrelated rig-install lint tests reported failures before timeout.AI assistance