# NousResearch/hermes-agent · Compaction dead-loop fix: stale reasoning budget handling

## Open now

- Nothing open on GitHub.

These issues and PRs address a compaction dead-loop caused by mismatched treatment of stale reasoning tokens—preflight charges them but tail-budget walks exclude them, leading to infinite loops in Codex and Responses API sessions. Fixes involve correctly counting or excluding stale thinking tokens in both preflight and tail-budget calculations.

## TL;DR

- 6 member(s): 0 open issue(s), 1 closed issue(s), 0 open PR(s), 1 merged PR(s), 4 PR(s) closed without merging.
- A fix was merged to main in PR #98998. Verify it addresses your case.
- **Recommended:** read PR #98998 (and any competing PRs below) before filing. Confirm the merged change covers your symptom.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `resolved` · deciding PR(s): `pr-98998`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_SPANNING`): every member is connected by structural evidence: shared changed files, or a closing/superseded reference.
- Pairwise link density `0.33`: the share of member pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. `1.00` means every pair is linked.

## Closed / duplicate issues

- #84371: Compaction dead-loop: preflight charges full reasoning replay but tail-budget walk excludes it (middle=0 on codex_responses sessions)

## Prior & competing PRs

- **#98998: fix(compression): compaction dead-loop ended — trigger and tail walks charge stale thinking by wire truth (#84371)**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`; implication `superseded`
  - files: `agent/context_compressor.py`, `agent/conversation_compression.py`, `agent/conversation_loop.py`, `agent/message_sanitization.py`, `agent/model_metadata.py`, `agent/turn_context.py`, `tests/agent/test_estimator_parity_84371.py`
- **#84398: fix(compression): count stale reasoning in Codex tail budgets**. closed without merge
  - maintainer direction: category `silent_close`; implication `active`
- **#84401: fix(compression): count stale reasoning in Responses API tail budgets**. closed without merge
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `64cc87e668`, `#84371`, `#98998`
- **#84433: fix(compression): exclude stale thinking from preflight to prevent dead-loop (#84371)**. closed without merge
  - maintainer direction: category `superseded_by_pr`; implication `superseded`
- **#84436: fix(compression): exclude stale thinking from preflight to prevent dead-loop (#84371)**. closed without merge
  - maintainer direction: category `uncategorized`; implication `needs_llm`; refs `#84371`, `#84371`

## Fix status

- Merged to main in PR #98998 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-08-31`.
- Subsystem: `agent`
