amend(§4): budget_cycles default 5->3; spec_ambiguous exempt from budget #2

Merged
kaykayyali merged 1 commits from amendment/budget-cycles-3-spec-ambiguous-exempt into main 2026-06-23 18:43:08 +00:00
Owner

Implements amendment §4 from docs/multi-project-orchestration-plan_amendments.md. Two small changes:

1. Schema default: budget_cycles 5 → 3 (per-row override remains supported).

2. cycle.py: when a spec phase emits spec_ambiguous, the cycle now rolls back the claim's attempts increment before routing to awaiting_human. Rationale: spec_ambiguous is the spec-refiner raising a question to the human; penalizing the autonomous budget for asking the question is wrong. Budget resumes counting only on autonomous retries after the human answers and the item returns to spec.

Tests (19/19 contract+unit pass against live MySQL after ALTER TABLE applied):

  • test_budget_default_three_per_amendment_section4 — codifies the schema default
  • test_spec_ambiguous_does_not_consume_budget — codifies the rollback rule

Live DB: also ALTER TABLE work_items ALTER COLUMN budget_cycles SET DEFAULT 3'd the running MySQL so new rows get the new default. Existing rows keep their per-row budget_cycles value (e.g. e2e-reviewer-01 still has budget=5).

Out of scope: the migration PR (#1, Postgres+Taskiq) carries spec_wrong plumbing changes that overlap with cycle.py. Once that PR merges, a follow-up rebase will reconcile the two cycle.py edits — they touch different lines.

Implements **amendment §4** from `docs/multi-project-orchestration-plan_amendments.md`. Two small changes: **1. Schema default**: `budget_cycles` 5 → 3 (per-row override remains supported). **2. `cycle.py`**: when a spec phase emits `spec_ambiguous`, the cycle now rolls back the claim's `attempts` increment before routing to `awaiting_human`. Rationale: `spec_ambiguous` is the spec-refiner raising a *question* to the human; penalizing the autonomous budget for asking the question is wrong. Budget resumes counting only on autonomous retries after the human answers and the item returns to `spec`. **Tests** (19/19 contract+unit pass against live MySQL after `ALTER TABLE` applied): - `test_budget_default_three_per_amendment_section4` — codifies the schema default - `test_spec_ambiguous_does_not_consume_budget` — codifies the rollback rule **Live DB**: also `ALTER TABLE work_items ALTER COLUMN budget_cycles SET DEFAULT 3`'d the running MySQL so new rows get the new default. Existing rows keep their per-row `budget_cycles` value (e.g. `e2e-reviewer-01` still has budget=5). **Out of scope**: the migration PR (#1, Postgres+Taskiq) carries `spec_wrong` plumbing changes that overlap with `cycle.py`. Once that PR merges, a follow-up rebase will reconcile the two cycle.py edits — they touch different lines.
kaykayyali added 1 commit 2026-06-23 18:42:58 +00:00
amend(§4): budget_cycles default 5->3; spec_ambiguous exempt from budget
Some checks failed
test / contract-and-unit (pull_request) Failing after 9s
b911a4c2a5
Amendment §4 (docs/multi-project-orchestration-plan_amendments.md):

- Schema: budget_cycles default 5 -> 3 (per-row override remains
  supported). Codified by test_budget_default_three_per_amendment_section4.

- cycle.py: when a spec phase emits spec_ambiguous, the cycle now rolls
  back the claim's attempts increment before routing to awaiting_human.
  A spec-ambiguous verdict is the spec-refiner raising a *question* to
  the human; penalizing the autonomous budget for asking the question
  is wrong. Budget resumes counting only on autonomous retries after
  the human answers and the item returns to spec.

  Codified by test_spec_ambiguous_does_not_consume_budget.

Live MySQL also ALTERed to apply the new default (the orchestrator's
schema.sql is the source of truth but the running DB needs the same
default for new rows).

Tests: 19/19 contract+unit pass against the live MySQL stack.
kaykayyali merged commit dffacca3cb into main 2026-06-23 18:43:08 +00:00
kaykayyali deleted branch amendment/budget-cycles-3-spec-ambiguous-exempt 2026-06-23 18:43:08 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kaykayyali/damascus-orchestrator#2