Skip to content

fix(#806): give staging consolidation its own configurable Haiku timeout - #813

Merged
fdaviddpt merged 2 commits into
mainfrom
fix/806
Sep 27, 2026
Merged

fdaviddpt merged 2 commits into
mainfrom
fix/806

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

Adds thresholds.consolidate_timeout_seconds (default 180) and reads it at the staging-consolidation call_haiku call site in pipeline/consolidate.py, replacing the hardcoded timeout=180 literal the issue names. Threaded through cmd_consolidate() in pipeline/shell.py (both the normal path and the oversized-archive rotation-retry path) and the pipeline.shell consolidate CLI dispatch, and read in scripts/run-consolidation.sh with a digit-only guard mirroring the sibling thresholds.ndc_timeout_seconds guard from #788/#792. Documented in config.example.json and docs/configuration.md; changelog fragment at changelog.d/806.fixed.md.

Closes #806

Tests

Red (with the fix stashed): python3 -m pytest tests/test_consolidate.py::TestConsolidateTimeoutIsConfigurable tests/test_shell.py::test_cmd_consolidate_passes_timeout_to_consolidate tests/test_shell.py::test_cmd_consolidate_default_timeout_is_still_180 tests/test_shell.py::test_main_dispatches_consolidate tests/test_shell.py::test_main_dispatches_consolidate_with_timeout -q --no-cov -> 5 failed, 1 passed (TypeError/AssertionError on the missing timeout kwarg).

Green: python3 -m pytest tests/test_consolidate.py tests/test_shell.py -q --no-cov -> 98 passed. Also ran the two real end-to-end shell-script tests exercising run-consolidation.sh directly (test_consolidation_append_race.py, test_windows_glob_backslash_517.py): 27 passed.

Full pytest was not run locally (per repo policy CI's cross-OS/interpreter matrix is the source of truth for that).

Self-review

Two reviewers (Explore, oss:auditor) ran independently; tree confirmed clean before/after via tree_snapshot.py.

  • Fixed: a stale comment in pipeline/shell.py claiming a fixed "180s budget", now naming the config key and this issue.
  • Logged, not fixed: scripts/run-consolidation.sh's new digit-only guard silently substitutes the default 180 on a malformed config value with no logging, so an operator can't tell a deliberate 180 from a discarded typo. Byte-for-byte the same shape as the already-shipped sibling guard in scripts/save-session.sh for thresholds.ndc_timeout_seconds (NDC compression deadlocks once now.md grows past ~35 KB: fixed 180s timeout, no chunking, no fallback #788/fix(#788): configurable NDC timeout, tolerate a short reply preamble #792); fixing it properly means touching both scripts, wider than this issue's scope. Ranked misreports, non-blocking, not a release blocker -- logged rather than filed, since it mirrors already-shipped behavior rather than something this diff introduces. Recorded at trap.d/806.timeout-guard-silent-substitution.md.

🤖 Generated with Claude Code

[AI-generated]

fdaviddpt and others added 2 commits September 27, 2026 01:18
`pipeline/consolidate.py:324` carried a hardcoded 180s `call_haiku` timeout
with no config key, in the staging -> recent/archive consolidation path.
Output length scales with input length, so a large enough staging batch
could time out on every run, be left uncompressed, and grow further every
round with no recovery -- the same shape #788 reported and #792 fixed for
the sibling NDC now.md -> today-*.md path via `thresholds.ndc_timeout_seconds`.

Threads a new `timeout` parameter through `consolidate()`, `cmd_consolidate()`
and the `pipeline.shell consolidate` CLI dispatch (new positional argv[7]),
read by `run-consolidation.sh` from the new `thresholds.consolidate_timeout_seconds`
config key (default 180, same digit-only guard as the NDC key). Documents the
key in config.example.json and docs/configuration.md, and adds a changelog
fragment.

Regression tests mirror tests/test_ndc_reject_gate.py's own
TestNdcTimeoutIsConfigurable shape: a configured-value-reaches-the-call test
plus a default-stays-180 negative control, at both the consolidate() and
cmd_consolidate() layers, plus CLI-dispatch coverage for the new argv
position. Also fixes a pre-existing test's consolidate() stub
(TestConsolidateSnapshot.test_the_snapshot_is_what_gets_read) that did not
accept the new timeout kwarg.

Closes #806.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Self-review follow-up for the previous commit:

- pipeline/shell.py: a comment near STAGING_PATHS_FILE's byte-count rationale
  still described the Haiku call's budget as a fixed "180s", which the
  previous commit made configurable. Updated to say "configurable budget
  (180s by default, thresholds.consolidate_timeout_seconds, #806)".

- trap.d/806.timeout-guard-silent-substitution.md: logs a non-blocking
  finding from the auditor spawn -- the new digit-only guard in
  run-consolidation.sh (and its pre-existing sibling in save-session.sh for
  thresholds.ndc_timeout_seconds) silently falls back to the default 180 on
  a malformed config value, with nothing in the daily log distinguishing a
  deliberate 180 from a discarded typo. Ranked `misreports`, non-blocking,
  not a release blocker -- logged rather than filed, since it mirrors
  already-shipped behavior rather than something this diff introduces.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@fdaviddpt
fdaviddpt merged commit c6127f5 into main Sep 27, 2026
16 checks passed
@fdaviddpt
fdaviddpt deleted the fix/806 branch September 27, 2026 00:13
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.

pipeline/consolidate.py still hardcodes its staging-consolidation call_haiku timeout (reopens the intent of #793)

1 participant