fix: tier-aware cadence reset — T1 captures no longer starve T2 (issue #364) - #365
fix: tier-aware cadence reset — T1 captures no longer starve T2 (issue #364)#365ranxianglei wants to merge 3 commits into
Conversation
…3 growthFloor wait (issue #364)
[bot] 🏷 Reviewing PR #365 (fix for #364). Initial findings so far: Bug verified on master. Diff reviewed (6 files, +470/−9): the boundary-prefix classification matches the convention already documented at Now checking out |
📦 Built Plugin ArtifactBranch: Option A — Install from npm PR tag (recommended)opencode plugin opencode-acp@pr-365 --globalEach push to this PR publishes a new version under the Option B — Install from GitHubopencode plugin "github:ranxianglei/opencode-acp#2026-09-04_t2-cadence-capture-fix" --globalOption C — Download artifact
tar xzf opencode-acp-pr365.tgz
cp -r package/dist ~/.cache/opencode/packages/opencode-acp@latest/node_modules/opencode-acp/dist
This comment is automatically updated on each push. |
[bot] 🏷 ## Review complete — APPROVE (no code changes required) Full verification + dual-agent review (§5.3 code / §5.6 test, two independent sessions) done at head 1. Bug verification (precondition for the fix)Confirmed on 2. Verification results on PR head
3. Dual-agent reviews — both APPROVE-WITH-NITSCode reviewer verified: Test reviewer traced every assertion to its code path (cycle-test turn B: Non-blocking nits (all minor, optional follow-ups):
None of these affect correctness or the #235/#364 guarantees. Happy to take nit #1 as a small follow-up if you want it. 4. Status & next steps
|
…ouched (post-#364 semantics)
… hardcodes scenario paths; bot PAT lacks workflow scope to edit it); re-scoped content only
Problem
Issue #364 (P1): the compress-processing handler in
lib/messages/inject/inject.tsreset the tier cadence baselines (lastTier2NudgeTokens/lastTier3NudgeTokens = currentTokens) on every compress — including raw-message T1 captures, which increase tier-1 quality instead of consuming it. In compression-active sessions every T1 capture re-armed thegrowthFloorwait (22.5K on defaults), so T2 could only fire in the gap between two T1 captures. Observed in a 21-day hub session: tier-1 quality stayed above the 50K trigger threshold for 1222h with 2325 T1 captures in between, T2 firing only after the lag.Fix
Classify the just-processed compress call by its range-boundary prefix — the convention already documented in
lib/compress/state.ts:81-83(m-prefix = raw T1 capture;b-prefix = T2+ distillation):m-only boundaries → capture → baselines untouched (the fix).b-prefix (incl. mixed batches) → real distillation → baselines reset as before — preserves the fix: T2/T3 nudge loop — preserve cadence baseline after compress #235 loop-prevention invariant (neverundefined).New
isCaptureOnlyCompressinlib/messages/query.ts(with tolerantextractCompressBoundaryIds: input as object or JSON string). The reset ininject.tsis wrapped inif (!isCaptureOnlyCompress(lastCompressMsg)). No new state fields, no persisted-format change.Tests
tests/query-pure.test.ts: +11 unit tests (m/b/mixed/string/malformed/user/undefined).tests/inject.test.ts: +3 integration tests per AGENTS.md §5.7 — multi-turn capture with production preserve-recent knobs asserting baselines unchanged across turns (side-effect assertion onlastTier2NudgeTokens), distill-reset contrast (fix: T2/T3 nudge loop — preserve cadence baseline after compress #235 lock), full cadence cycle: capture → baseline held → growth → T2 fires.scripts/ci/check-pr.shall checks pass.Deferred (tracked in #364 discussion)
nudgeGrowthTokens): awaiting owner's ruling on the default value (absolute ~20K vs anchor-count vs dual) — interacts with Feature: Support percentage-based nudgeGrowthTokens for cross-model portability #300.growthFloor, so the residual T2 delay is one turn, not hours.Devlog
devlog/2026-09-04_t2-cadence-capture-fix/(REQ.md + WORKLOG.md).