voyage/docs
Kjell Tore Guttormsen 32e20fc0dc fix(cap): move the enforcement boundary to a denial tombstone, not the turn count
allowTurn() appends BEFORE the turn runs, so during granted turn N the
ledger holds N records. The hook denied at `used >= budget`, which blocked
every tool call of the FINAL granted turn: the primitive granted B turns
and the harness permitted B-1. Worse, an exhausted run therefore always
terminated through an exit-2 tool denial instead of the graceful "cap
exhausted" exit at commands/trekresearch.md - and the prose says in as
many words that exit 2 is not exit 1, so the model was pushed out through
the one exit it is told NOT to treat as a cap.

The review recommended denying at `used > budget`. Taken alone that fixes
the count and breaks the hook: once the O_EXCL claim (previous commit)
makes a breached ledger impossible, `granted > budget` can no longer fire,
and the case this hook exists for - the loop consults the gate, is denied,
and issues the tool call anyway - would be allowed. A deny branch that
cannot be reached is a dead security claim, which is the same thing S82
removed two of rather than leave standing.

So the denial itself became a record. allowTurn() appends a tombstone
{runId, exhausted: true} when it denies for budget, and the hook denies on
the tombstone. Both properties now hold at once:

  granted == budget, no tombstone  -> turn B is in flight   -> ALLOW
  tombstone present                -> the gate already said no -> DENY
  granted  >  budget               -> breached, any cause   -> DENY

A tombstone is not a turn: readLedger reports {granted, exhausted}
separately so it can never consume budget. allowTurn short-circuits on an
existing tombstone, so a hammered gate neither re-walks every slot nor
grows the ledger. The tombstone write is best effort on purpose - the
denial is already the correct answer, so a ledger that cannot take the
record must not turn a denial into a grant.

The parallel-boundary test now asserts GRANTED turns rather than raw
ledger lines, because the denied callers legitimately add tombstones.

Review finding 8eb53458ac3efec778094f9f03b09e1cc1077a09 (MINOR).
Operator decision: tombstone over the literal recommended_action.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LuGhWAbWyRFBFeemfhxoVv
2026-08-12 22:56:55 +02:00
..
eval-corpus feat(eval): SKAL-1·4b offline gold-scored output eval 2026-06-30 09:00:33 +02:00
agent-description-token-trim-brief.md docs(voyage): track agent-description token-trim brief (M4 input) 2026-06-26 20:15:34 +02:00
architecture.md fix(cap): move the enforcement boundary to a denial tombstone, not the turn count 2026-08-12 22:56:55 +02:00
balance-backlog-plan.md chore(voyage): S34 — V30 economy-profile self-declares experimental (uncalibrated Jaccard floor) 2026-06-20 10:18:38 +02:00
cc-upgrade-2.1.181-decision-matrix.md docs(voyage): S20 — CC-04/T3 verified clean (research-agent MCP degradation under --strict-mcp-config) 2026-06-19 14:08:51 +02:00
claudemd-token-trim-brief.md docs(claude-md): trim CLAUDE.md to invariants (always-loaded token trim, S53) 2026-06-29 14:49:32 +02:00
command-modes.md fix(research-loop-cap): floor the turn cap before the guard, not after 2026-08-12 22:46:35 +02:00
deep-research-engine-brief.md docs(research): resolve deep-research-engine topic-1 (/deep-research trigging) 2026-06-30 10:39:03 +02:00
deep-research-engine-research.md docs(research): remove literal keyword tripping verify SC1 2026-08-12 20:29:35 +02:00
devils-advocate-plan.md docs(voyage): plan S14 devil's-advocate audit via Dynamic Workflow 2026-06-18 18:30:05 +02:00
devils-advocate-results.md docs(voyage): S22 — happy-path dogfood results (blind spot #1/#4 measured) 2026-06-19 20:53:21 +02:00
HANDOVER-CONTRACTS.md docs(voyage): fable-aware allowlist prose in contracts, architecture, templates, CLAUDE.md 2026-07-02 17:14:35 +02:00
observability.md docs(observability): document token-usage schema + main-context v1 scope 2026-06-26 14:47:24 +02:00
operations.md docs(voyage): add fable profile row and correct model-allowlist prose 2026-07-02 17:13:15 +02:00
profiles.md docs(voyage): add fable profile row and correct model-allowlist prose 2026-07-02 17:13:15 +02:00
S22-happy-path-dogfood.md docs(voyage): S27 — close version-skew (S22 defect #4) as no-op 2026-06-19 22:11:25 +02:00
SLDC-AI.pdf fix(cap): fail closed when the ledger cannot be READ, in both modules 2026-08-12 22:49:08 +02:00
spike-pretooluse-subagent-reach.md feat(trekresearch): wire Phase 5 scope marker so the cap hook enforces 2026-08-12 20:55:55 +02:00
storm-measurement.md fix(storm-measure): restore the pre-registered OR decision rule 2026-08-12 22:15:07 +02:00
subagent-delegation-audit.md feat(voyage)!: bulk content rewrite ultra -> voyage/trek prose [skip-docs] 2026-05-05 15:08:20 +02:00
T1-cc26-delegated-orchestration.md docs(voyage): S7 (W1/CC-26 gate) — T1 feasibility probe + measurement design 2026-06-18 13:21:09 +02:00
T1-synthesis-poc-results.md feat(voyage): S12 — NW3 synthesis-agent built + measured → declined per measurement [skip-docs] 2026-06-18 17:58:39 +02:00
T2-bakeoff-results.md fix(voyage): S21 — close IPv4-mapped IPv6 SSRF bypass + security/safety audit (blind spot #2) 2026-06-19 20:02:56 +02:00
T2-cc27-workflow-substrate.md docs(voyage): S8 (W1/CC-27 gate) — T2 Workflow-substrate probe + measurement design 2026-06-18 13:34:05 +02:00
voyage-vs-cc-balance-analysis.md chore(voyage): S34 — V30 economy-profile self-declares experimental (uncalibrated Jaccard floor) 2026-06-20 10:18:38 +02:00
voyage-vs-cc-balance-charter.md docs(voyage): add Voyage-vs-CC balance-analysis charter (next-session launch spec) 2026-06-20 06:34:40 +02:00
W1-narrow-wins-plan.md docs(voyage): plan W1 narrow-wins implementation (NW1/NW2/NW3, S9->) 2026-06-18 13:41:20 +02:00