Repository navigation
fix(agents): retain compaction references in adapters - #5309
Merged
Merged
Conversation
giuliolovisotto
force-pushed
the
codex/fea-518-codex
branch
from
October 29, 2026 13:53
a5f6f83 to
027a6f2
Compare
marta-sd
reviewed
Nov 2, 2026
giuliolovisotto
force-pushed
the
codex/fea-518-codex
branch
from
November 2, 2026 10:59
027a6f2 to
198f85d
Compare
giuliolovisotto
force-pushed
the
codex/fea-518-codex
branch
from
November 2, 2026 17:00
325b2ed to
eb69d58
Compare
marta-sd
previously approved these changes
Nov 3, 2026
giuliolovisotto
force-pushed
the
codex/fea-518-codex
branch
from
November 3, 2026 14:15
eb69d58 to
47ffe35
Compare
giuliolovisotto
enabled stacked auto-merge
November 3, 2026 14:27
marta-sd
previously approved these changes
Nov 3, 2026
giuliolovisotto
force-pushed
the
codex/fea-518-codex
branch
from
November 3, 2026 15:11
47ffe35 to
f9a0fd9
Compare
Signed-off-by: Giulio Lovisotto <[email protected]>
Signed-off-by: Giulio Lovisotto <[email protected]>
Signed-off-by: Giulio Lovisotto <[email protected]>
Signed-off-by: Giulio Lovisotto <[email protected]>
Signed-off-by: Giulio Lovisotto <[email protected]>
marta-sd
approved these changes
Nov 4, 2026
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/41802882054 |
This branch was previously deployed
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.
Codex persists compaction summaries in its native transcript, but Gym drops the events and cannot identify the helper calls. Claude already observes compaction, but resolves its helper calls through a harness-specific import in the core collector. Assemble these references in each adapter before returning its observation bundle, leaving collection generic.
Codex parses native
compactedrecords and matches them against completed responses identified byrequest_kind: "compaction"in the nativeclient_metadata["x-codex-turn-metadata"]JSON. Its session transport uses this structured marker without a prompt-text fallback. The response stream is forwarded unchanged; only helper evidence is buffered, with an 8 MiB limit. Missing, failed, truncated, oversized or ambiguous evidence leaves a gap. The event and its owning invocation both receive model-scoped references.Claude performs its existing exact summary/boundary association while preparing observations, on both local and sandbox paths. It waits for pending capture writes, reads the rollout's capture off the event loop, and restricts matching to its configured model server. Read failures preserve the bundle and record a gap. The matcher also accepts the one-newline continuation suffix emitted by Claude Code 2.1.108, alongside the existing two-newline form.
The core collector imports neither adapter and retains its generic verifier exclusion and reference join. Compaction helpers remain captured and invocation-owned for accounting, but are excluded from policy turns.
Compatibility
Claude's agent-server host must be able to read the configured shared
model_call_capture_dir; the task sandbox does not need access. Missing or unreadable capture leaves explicit gaps. Execution, retry policy and production compaction thresholds are unchanged. No separate issue is needed for this scoped evidence fix and review follow-up.Validation
Latest validation: the full Codex suite passed 506 tests with 7 runtime-dependent skips. Tests cover metadata-based detection with different prompt wording, rejection of prompt-only detection, and missing or malformed metadata.
uvx pre-commit run --all-filespassed.Earlier Claude association validation: 926 tests passed:
uvx pre-commit run --all-filespassed, including package layering. Tests cover both Claude execution paths, missing/foreign capture, delayed writes, read failures, ambiguous helpers, summary matching, turn exclusion and retained usage.A fresh Claude Code 2.1.108 run against a controlled local provider executed the shell command and automatically compacted: four captured calls (title, policy, compaction, policy), two policy turns, one linked event, summary reuse and helper usage retained in captured-call metrics. The smoke used synthetic input usage plus
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=10andCLAUDE_CODE_DISABLE_1M_CONTEXT=1; these settings are confined to the smoke.Claude's emitted
response.usagestill reports policy-only usage in this smoke; auxiliary-token aggregation in that field is outside this association cleanup.A fresh Codex 0.144.4 compaction scenario with metadata-based detection passed all five behavioral checks and schema validation: 16 captured model calls, 15 policy turns, one linked helper, summary reuse and retained aggregate usage. Reproduce on the scenario layer with
python scripts/run_harness_conformance.py --harness codex --scenario context_compaction --gate-tier P1 --output results/codex-compaction. The prior implementation was also validated across all nine scenarios with P1 gating. These runs validate local pinned runtimes and controlled providers; remote sandbox infrastructure, model quality and full repository CI are not qualified. Commits carry DCO sign-off and SSH signatures.Based on #5308; #5310 and #5311 follow, then #5439 enables the shared scenario as the final PR of the original stack.