composition detail=true: soft-cap co-occurrence, spill the full dump to full_result_path - #140
Merged
Merged
Conversation
…to full_result_path On a large frontier the detail=true co-occurrence list is every sometimes-but-not-always option pair — O(options^2), 413 KB on the 300-option showcase — which blows past the MCP tool-result ceiling. Mirror marginal_analysis detail=true (PR #129): past EXPLORE_DETAIL_CAP pairs the response keeps the top-ranked head of the list (already ranked by departure from independence, so the head IS the summary view scaled up), echoes truncated {total_pairs, shown}, and writes the full payload beside the run's own result file, pointed at by full_result_path — same field, same <run_id>-composition path scheme, same cap, same best-effort degradation on an unwritable data dir. Explore docstring, architecture.md composition row, and the solution_interpreter field table say so.
cafzal
force-pushed
the
claude/composition-detail-path
branch
from
August 4, 2026 02:18
34ccbb3 to
a2e3803
Compare
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.
Defect
explore composition detail=trueon a large frontier blows past the MCP tool-result ceiling — the payload is truncated by the transport or unusable. Measured engine-direct on the bundled examples:capital_project_selection_300returns 5,253 co-occurrence pairs, 413 KB (~100k tokens);research_cohort_selection2,346 pairs / 193 KB.Root cause
detail=true's only effect on composition is lifting the co-occurrence top-N from a summary handful (8) to every sometimes-but-not-always option pair — O(options²) — and the server returned that list inline with no cap, unlike its siblings (solutions detail=trueand, since #129,marginal_analysis detail=true), which soft-cap and spill to disk.Fix
The exact treatment #129 gave
marginal_analysis, same conventions throughout:mcp_server/server.py: new_cap_composition_detailbeside_cap_marginal_detail— pastEXPLORE_DETAIL_CAPpairs, the full payload is written viastore.write_run_result(problem_id, f"{run_id}-composition", result)(same path scheme as{run_id}-marginal), the response carriesfull_result_path, and an unwritable data dir degrades best-effort to the full inline payload. Wired into thecompositioncase exactly as themarginal_analysiscase is.engine/explorer.py: newcap_composition_detailbesidecap_marginal_detail— keeps the top-max_rowspairs (the list is already ranked by departure from independence, so the head is the summary view scaled up; the ASCII visualization never reads the pair list, so no re-render is needed) and echoestruncated: {total_pairs, shown}, mirroring marginal'struncatedblock. Nothing mutated — the caller keeps the full payload for the on-disk dump.full_result_pathparagraph and the composition action entry, architecture.md's composition row, andsolution_interpreter'sco_occurrencefield row all name the behavior.Result on the showcase: 413 KB → ~35 KB inline plus
full_result_path.Tests
Written failing against main's behavior first, in
tests/test_server.py::TestCompositionmirroringTestMarginalAnalysis's inline/spill pair:test_small_frontier_detail_stays_inline— no cap, no path on a small frontier.test_large_frontier_detail_writes_full_result_path— oncapital_project_selection_300: inline list ==EXPLORE_DETAIL_CAP,truncatedtotals, inline JSON < 100 KB, the on-disk file parses, carries the full pair list with notruncatedmarker, and the inline pairs are the head of the ranked full list.Full suite: 1049 passed, 2 skipped.