Repository navigation
docs(decisions): ADR 0033 (Proposed) — idle-time auto-compaction design at the plan gate (#99) - #162
Conversation
…gn, parked at the plan gate (#99)
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…pt/provider resets, episode-start TTL anchor, no-progress latch, announce-policy seam, bounded stage-2 retry, honest context-push render claim, derivation question first
…section refs, log-not-render for the stage-2 give-up
Hostile design review — the arcReviewer: fresh-context Round 1 — VERDICT: FIX-FIRST. 4 BLOCKER + 6 FIX + 4 NIT. The architecture held (timer → arming predicate → the shared
Round 2 (fix commit Round 3 (residuals One governance rider, disclosed: the README diff introduces the Proposed status vocabulary (one word in the format list + its definition line) — the plan-gate workflow's new status, riding this PR because this is the first ADR to use it. Flagged for the owner's nod at the gate. Lane staffing: architect |
Closes nothing — #99 stays OPEN: this is the design-only lane (the plan gate). ADR 0033 lands in Proposed status and parks at Terence's morning read; the implementation lane opens only on his go.
The design (ADR 0033, Proposed)
A cache-TTL-derived idle timer in the agent, firing the same
eviction_pass/compact fires — third caller of one pass, never a third implementation.status: :idle, the same gate /compact uses — reached by exactly two code paths,reset_turn/1andfill_cancelled/1) arms the timer; user-idle (@min_quiet60 s without TUI-forwarded activity) gates the fire. The TTL clock starts at the last episode start (the site that mintsrequest_len— not usage-frame arrival, which is one generation late) and is not reset by typing — the cache's clock is the provider's.arm_delay = max(@min_quiet, (last_request_at + effective_ttl − margin) − now),margin = max(60 s, 10 % of ttl). Epoch-guarded{:idle_compact, epoch}fire (the suggester's pattern — a stale timer racingcancel_timerinto the mailbox is dropped by construction). Monotonic time only; a suspend-paused clock fires late (post-expiry), the safe direction.settings.compaction.idleTtlSeconds→ seeded per-provider (verified numbers only, table filled at implementation) → 300 s default, conservative because assuming-short never misses a harvest while assuming-long fires post-expiry — the unrecoverable mistake (with the honest cost recorded: on an hour-tier provider stage 2 pays a summarize per 300 s window; that trade is open question 4).cached_tokenscannot be the primary TTL derivation (misses are retroactive, confounded by capacity eviction) — argued over the issue's initial lean, and that reversal is gated as open question 1, the owner's to confirm or overturn. Observation gets the two jobs it can do: the telemetry gate (no positive cached-count ever observed ⇒ the timer never arms) and calibration (deferred phase-2 ledger).div(window*4,5); the estimate cannot change between arm and fire (the two idle mutators —{:adopt_session, _},{:set_provider, _}— cancel and clear), so below-threshold sessions never compact by construction. Whole-turn/one-remaining-turn/pinned-system floors inherited unchanged; a no-progress latch bounds oversize sessions to one silent pass per turn."source"key); a no-drop fire is silent, latched, and the pass gains an announce policy (one parameter, two policies — no forked loop). The TUI hears a fire through the two messages it already renders for any mutation (entry + context push). No status-line changes, no new render events; the no-timers contract of ADR 0007/the agent moduledoc is the one deliberate bend, amendment note promised at acceptance. No /undo added.5 open questions park at the gate (ADR §9): the derivation itself (chain vs observation-first — the issue's written lean, contravened with argument) · no-telemetry hard-off vs degraded variant · any-key vs submit-only activity · the 300 s default + silent timing · the m1 gate + stage-2 contract.
Also in this PR: the decisions README gains the Proposed status vocabulary (one word + its definition line) — the plan-gate workflow's status, riding here because 0033 is the first ADR to use it. Flagged for the owner's nod.
Captures
Non-visual: docs-only PR (ADR 0033 + decisions README index row); no UI surface to capture.
CI (raw)
Review disclosure
Hostile DESIGN review: fresh-context agent on
zai-coding-plan/glm-5.3, own tab, own read-only worktree, same host — disclosed (the capture-convention charter's arrangement). It attacked the trigger formula, the idle definition, and the failure modes, verifying every code claim in-tree. Arc: FIX-FIRST (4 BLOCKER + 6 FIX + 4 NIT — false choke-point claim, unmodeled{:adopt_session, _}/{:set_provider, _}paths, the{:context, _}render push, the agent's no-timers contract, a one-generation-late TTL anchor, an oversize re-arm loop, an unbounded stage-2 retry) → fixed in54241c6→ CLEARED → two residual NITs in7200f37→ CLEARED. Full arc in the review comment.Lane staffing: architect on
zai-coding-plan/glm-5.3; reviewer the same model, fresh context.