Repository navigation
fix(context): context veto outranks classifier retry; exhausted preflight not retryable - #217
Conversation
the desktop surfaced retryable=true for turns whose compaction was vetoed by lineage_integrity_mismatch while unchanged retries deterministically re-vetoed (5x in 5 minutes, 2026-10-26); recovery is a context-recovery action, not a resend. - build_error_surface_from_result: lineage_integrity_veto maps to runtime/lineage_integrity_mismatch, retryable=false - build_error_surface_from_exception: CONTEXT_PREFLIGHT_EXHAUSTED and raised lineage vetoes map non-retryable; unrelated gateway exceptions keep the legacy retryable verdict (control test) - RED/GREEN: tests/agent/test_context_veto_error_surface.py
…ptions Verifier F1 (2026-10-26, VERDICT: FAIL on 1c05eeb5b7): in build_error_surface_from_exception's API-like branch, surface['retryable'] = bool(classified.retryable) overwrote the veto's retryable=False, so a lineage_integrity_mismatch (or CONTEXT_PREFLIGHT_EXHAUSTED) carried by an exception with status 404/408/413/429/500/502/503/504 still surfaced retryable=true — the exact resend-loop symptom the commit was meant to remove. - the deterministic context verdict is computed before classification and, when present, overrides the classifier's retry guess on the API-like path (context_veto=true marker) - ordinary API errors keep the classifier verdict (control test) - RED (on 1c05eeb5b7): test_f1_api_like_veto_stays_non_retryable; plus preflight-exhausted variant and no-veto control
Verifier run-2 medium finding: a NON-API exception carrying the Hermes-owned CONTEXT_PREFLIGHT_EXHAUSTED sentinel (re-raised as a plain RuntimeError by a transport wrapper) still surfaced gateway/retryable=True — same deterministic-resend symptom the F1 fix removed from the API-like path. The message is a Hermes-owned sentinel, not provider text, so the exception type does not change the verdict. - the non-API branch now maps the sentinel to runtime/context_preflight_exhausted, retryable=False (before the generic gateway fallback) - two tests: plain-RuntimeError sentinel and plain-RuntimeError lineage text; 9/9 in the veto suite, 50 error-surface/failover tests green
Verifier run-1 'not checked' item: the drift INFO line added in 8ef3f74722 had no test. Drives the real build_turn_context branch with the measured incident shape (estimate 1,086,932 vs real provider prompt 898,481, +21.0%): the line is logged with both numbers; below the 15% threshold and without a real reading, no line. Harness mirrors tests/agent/test_api_content_sidecar.py.
Codex Review SummaryThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 914811c175
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
૮ >ﻌ< ა ci reviewran on ad5060f — Merge branch 'main' into fix/context-compaction-port-2026102
|
The acceptance test (test_preflight_drift_telemetry.py) expected a 'Preflight estimate drift' INFO line that the ported commits never implemented. When the rough estimate exceeds the last real provider prompt by >=15%, one bounded line names rough, real, and the +X.X% gap.
|
Fixed in c9e970c: the drift telemetry implementation (agent/turn_context.py) now logs the 'Preflight estimate drift' line at >=15% gap — the acceptance test's missing counterpart is implemented. Verified the exact log format matches the test's assertions. |
…ction-port-20261027
…mpt trackers The preflight drift line assumed last_real_prompt_tokens is numeric. MagicMock compressors in tests auto-create the attribute (so the getattr default never applies), and any non-int tracker value exploded on the '>' comparison (TypeError at agent/turn_context.py:1003). Gate the telemetry on isinstance(int) so mock and non-numeric trackers skip the line. Restores the two CI-failing suites (compression budget rearm, api content sidecar preflight compaction).
Ported from the local context-compaction worktree (4 commits, Oct 26, authored by Josh Stevenson, authorship preserved via cherry-pick).
Verified NOT on main before porting (main's agent/error_surface.py has zero veto handling; test files absent).