Skip to content

Add a live, on-demand summary-quality harness for the codex exec provider (#492) - #529

Merged
fdaviddpt merged 2 commits into
mainfrom
fix/492
Sep 4, 2026
Merged

fdaviddpt merged 2 commits into
mainfrom
fix/492

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

Closes #492.

#406's plan for the codex exec summarizer provider was two things, not one: the provider itself, plus a way to judge summary quality, because "a green contract suite passes while summaries quietly become useless." Only the provider shipped (v0.24.0). tests/test_summarizer_routing_460.py and tests/test_nested_summarizer.py pin routing and liveness -- which provider a call resolves to, how an unavailable/empty/declined spawn is reported -- entirely with a mocked subprocess.run. None of it looks at what a summary actually says, while prompts/*.prompt.txt were tuned against Claude and now also run under codex exec against a different model.

What this adds

tests/test_summary_quality_492.py: two recorded session fixtures under tests/fixtures/summary_quality/ (an auth CSRF bugfix, a rate-limiting feature with an explicit still-blocked-on-ops status) with a short list of facts a correct save-session summary must preserve -- specific filenames, an underlying cause, a numeric limit, a blocking status. Each test builds the real save-session prompt via pipeline.prompts.build_save_prompt(), forces the codex route (REMEMBER_SUMMARIZER=codex, the same explicit-override convention tests/test_summarizer_routing_460.py already uses under mock), sends it through the live, unmocked pipeline.haiku.call_haiku(), and asserts every fact survives into the summary as a case-insensitive substring.

Why fixture+substring, not an LLM judge

The issue named two candidate shapes and left the choice open: a fixture set with substring/judge-call checks, or a differential run against both providers. Substring presence against a small, hand-picked fact list is the cheaper, deterministic option -- an LLM judging another LLM's prose needs its own calibration, which is a materially bigger scope than this issue asks for. A differential-diff engine was ruled out for the same reason: it is a bigger build than a bounded harness needs.

Why it is skipped by default

The issue is explicit that this needs to be "runnable on demand rather than in CI (it needs a live provider and costs a call)." The new file is gated behind RUN_LIVE_SUMMARY_JUDGE=1 (pytest.mark.skipif), matching CLAUDE.md's "suite runs locally on demand, never on push" and the same opt-in-costs-tokens shape scripts/run-tests.sh already uses for its own live Haiku test (section 8, --live). No workflow under .github/workflows/ sets the env var, so it is unconditionally skipped in CI.

TDD, proven against a real live call

With RUN_LIVE_SUMMARY_JUDGE=1 set and the codex route forced: an injected impossible fact ("Kubernetes pod eviction", absent from the auth-csrf-bugfix fixture) failed with a real assertion diff against a live codex-routed call; restoring the correct fact list passed both cases green against two more live calls. Re-run is not automatic on every edit after that -- each run is a real, billed API call, which is exactly the cost this file exists to keep out of CI and out of the default local suite.

Self-review

Spawned Explore and oss:auditor against the committed diff. The auditor found nothing (0 findings across the absence/guard/untrusted-text/platform-band classes). Explore found 3, all fixed in a follow-up commit:

  1. The harness never forced the codex route, so on any ordinary dev shell or CI runner it silently only ever exercised the pre-existing claude route -- exactly the gap the issue is about. Fixed: REMEMBER_SUMMARIZER=codex is now forced, and TDD red/green was re-verified against the corrected, codex-forced shape with two more live calls.
  2. The hand-rolled prompt builder's Lines: count used the filtered message count where production uses the raw physical line count. Fixed: now uses pipeline.extract.count_lines(), matching production.
  3. One fact ("100") was a weak, generic substring. Tightened to "100 req".

Scope note

The fourth prompt, prompts/session-history-hint.txt, is a static string printed at session start -- it is never sent through a summarizer call, so it has no summary-quality question to test and is out of scope here.

#406's plan for the codex exec provider was two things: the provider
itself, plus a way to judge summary quality. Only the provider shipped
in v0.24.0. tests/test_summarizer_routing_460.py and
tests/test_nested_summarizer.py pin routing and liveness with a mocked
subprocess.run and never look at what a summary actually says, while
prompts/*.prompt.txt were tuned against Claude and now also run under
codex exec against a different model.

Add tests/test_summary_quality_492.py: two recorded session fixtures
under tests/fixtures/summary_quality/ with a short list of facts a
correct save-session summary must preserve, run through the real
build_save_prompt() + live call_haiku() and checked by substring.
Skipped by default (RUN_LIVE_SUMMARY_JUDGE=1 opts in), matching
CLAUDE.md's "runs locally on demand, never on push" and the same
shape scripts/run-tests.sh already uses for its own live Haiku test.
Chose fixture+substring over an LLM-judge call per the issue's own
steer -- cheaper, deterministic, no separate judge calibration needed.

Proven both ways against a real live call before committing: an
injected fact absent from a fixture failed with a real diff, and the
correct fact lists passed against two live calls.

Co-Authored-By: Max <noreply>
…fact (#492)

Three findings from the Explore self-review of 60d84a6, all applied:

- The harness never forced REMEMBER_SUMMARIZER=codex, so on any ordinary
  dev shell or CI runner _choose_summarizer_provider()'s "auto" default
  resolved to the pre-existing claude route, not codex -- the harness
  silently never judged the one provider #492 is actually about. Now
  forced via monkeypatch, the same explicit-override convention
  tests/test_summarizer_routing_460.py already uses under mock.
- _build_prompt_for()'s Lines: count used len(messages) (filtered) where
  production's extract_session() uses count_lines() (raw physical lines),
  contradicting the file's own "same shape production sends" claim. Now
  uses pipeline.extract.count_lines(), matching production.
- The rate-limit-feature case's "100" fact was a bare, generic numeral
  that could pass on an unrelated appearance. Tightened to "100 req".

Re-verified TDD red/green against the corrected, codex-forced shape with
two more live calls: an injected impossible fact ("Kubernetes pod
eviction") failed with a real diff under the codex route, and restoring
the correct facts passed both cases green under the same route.

Co-Authored-By: Max <noreply>
@fdaviddpt
fdaviddpt merged commit 0dcf881 into main Sep 4, 2026
13 checks passed
@fdaviddpt
fdaviddpt deleted the fix/492 branch September 4, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The codex exec provider shipped without the means of judging summary quality that #406 said had to come with it

1 participant