Skip to content

Phase 2: compensation saga, manifest gate fix, runbook - #37

Open
cryptoxdog wants to merge 1 commit into
claude/new-session-br7qjb-phase-1from
claude/new-session-br7qjb-phase-2
Open

Phase 2: compensation saga, manifest gate fix, runbook#37
cryptoxdog wants to merge 1 commit into
claude/new-session-br7qjb-phase-1from
claude/new-session-br7qjb-phase-2

Conversation

@cryptoxdog

Copy link
Copy Markdown
Collaborator

Stacked PR — 2 of 3

Stacked on #36 (Phase 1). Base is claude/new-session-br7qjb-phase-1; this PR's diff shows only Phase 2. Merge #36 first (or retarget this to main once #36 lands).

What this does

Phase 2 of the remediation (R-03, R-08, R-06).

R-03 — activate CompensationRegistry (saga rollback)

Wires a compensation saga into serp:execute-surpass-plans (src/services/plan-executor.ts). Each gap advanced to executing on the strength of a real dispatch registers a status-rollback; if the batched Vercel deploy throws, compensations run LIFO to revert those gaps to planned before the job rethrows, so the next run retries. This fixes a genuine pre-existing bug — a deploy failure previously stranded planned work silently. Proven by an end-to-end deploy-failure test plus new unit suites for both CompensationRegistry and AgentBudgetGuard.

AgentBudgetGuard is unit-tested here but intentionally left unwired in this phase — the executor path has no real per-call USD signal, and inventing costs would be a fabrication. Recorded in TODO.md with its activation trigger. (It gets wired to the real LLM cost seam in Phase 3 / #38.)

R-08 — fix the manifest gate

MANIFEST.json was missing from the tree, so npm run manifest:check crashed with ENOENT on every clean checkout. Generated MANIFEST.json (144 entries) and refreshed MANIFEST.md; the gate now passes.

R-06 — RUNBOOK

Documents the migration --check dry-run, the compensation saga, the budget-guard status, and the manifest gate.

Validation

tsc --noEmit 0 errors · eslint src/ 0 errors · vitest 145/145 · manifest:check clean


Generated by Claude Code

…e, runbook

R-03: activate CompensationRegistry in the surpass-plan executor. Each gap
advanced to 'executing' on a real dispatch now registers a status-rollback
compensation; if the batched Vercel deploy throws, compensations run LIFO to
revert those gaps to 'planned' (so the next run retries) before the job
rethrows. Adds unit tests for CompensationRegistry and AgentBudgetGuard and an
end-to-end deploy-failure saga test in plan-executor.

AgentBudgetGuard is unit-tested but intentionally left unwired: the executor
path carries no real per-call USD signal, and inventing costs would be a
fabrication. Recorded as an externally-gated item in TODO.md with its activation
trigger; per-run TokenBudget remains the active token safety control.

R-08: fix the manifest gate. MANIFEST.json was missing from the tree, so
`npm run manifest:check` crashed with ENOENT on every clean checkout. Generated
MANIFEST.json (144 entries) and refreshed MANIFEST.md via manifest:generate;
the gate now passes.

R-06: document the migration --check dry-run, the compensation saga, the budget
guard status, and the manifest gate in RUNBOOK.md.

Validated: tsc --noEmit 0 errors, eslint src/ 0 errors, vitest 145/145,
manifest:check clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SjcHn8jZErKo37ZJi6qybX
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant