Skip to content

Commit c29833b

Browse files
authored
Merge pull request #101 from dmoliveira/my_opencode-e20-budget-verification
Complete E20-T4 budget verification coverage
2 parents 61a857d + 8ea6489 commit c29833b

File tree

4 files changed

+40
-7
lines changed

4 files changed

+40
-7
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ All notable changes to this project are documented in this file.
132132
- Integrated budget runtime evaluation into `/start-work` and `/start-work recover`, including `budget_stopped` hard-stop behavior and actionable continuation recommendations.
133133
- Integrated budget diagnostics into unified `/doctor` summary checks and expanded selftest/install smoke coverage for budget profile+override workflows.
134134
- Updated README and roadmap notes to document budget workload tuning commands and Epic 20 Task 20.3 completion.
135+
- Expanded budget verification coverage for invalid override input handling and usage guidance in selftest.
136+
- Marked Epic 20 Task 20.4 complete and promoted Epic 20 status to done in the roadmap.
135137

136138
## v0.2.0 - 2026-02-12
137139

IMPLEMENTATION_ROADMAP.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ Every command-oriented epic must ship all of the following:
734734

735735
## Epic 20 - Execution Budget Guardrails
736736

737-
**Status:** `in_progress`
737+
**Status:** `done`
738738
**Priority:** High
739739
**Goal:** Prevent runaway autonomous runs by enforcing configurable limits for time, tool calls, and token usage.
740740
**Depends on:** Epic 2, Epic 11
@@ -754,12 +754,13 @@ Every command-oriented epic must ship all of the following:
754754
- [x] Subtask 20.3.2: Expose budget consumption in doctor/debug outputs
755755
- [x] Subtask 20.3.3: Document budget tuning by workload type
756756
- [x] Notes: Added `scripts/budget_command.py`, wired `/budget*` aliases in `opencode.json`, integrated budget checks into unified `/doctor`, and expanded README/install/selftest flows for profile+override diagnostics.
757-
- [ ] Task 20.4: Verification
758-
- [ ] Subtask 20.4.1: Add tests for threshold crossings and stop behavior
759-
- [ ] Subtask 20.4.2: Add tests for override and reset flows
760-
- [ ] Subtask 20.4.3: Add install-test smoke checks
761-
- [ ] Exit criteria: runaway loops are prevented by hard and soft limits
762-
- [ ] Exit criteria: budget stops provide actionable continuation guidance
757+
- [x] Task 20.4: Verification
758+
- [x] Subtask 20.4.1: Add tests for threshold crossings and stop behavior
759+
- [x] Subtask 20.4.2: Add tests for override and reset flows
760+
- [x] Subtask 20.4.3: Add install-test smoke checks
761+
- [x] Notes: Expanded `scripts/selftest.py` with threshold-stop, override/reset, and invalid-override checks; install smoke now exercises `/budget status|override|doctor|override --clear` flows.
762+
- [x] Exit criteria: runaway loops are prevented by hard and soft limits
763+
- [x] Exit criteria: budget stops provide actionable continuation guidance
763764

764765
---
765766

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ Examples:
158158
/budget doctor --json
159159
```
160160

161+
Task 20.4 verification notes:
162+
163+
- selftest covers PASS/WARN/FAIL budget threshold evaluation and `budget_stopped` hard-stop behavior in `/start-work`.
164+
- selftest covers override apply/clear paths plus invalid override input rejection with deterministic usage guidance.
165+
- install smoke includes `/budget status`, `/budget override`, `/budget doctor`, and `/budget override --clear` checks.
166+
161167
## Installed plugin stack 🔌
162168

163169
- `@mohak34/opencode-notifier@latest` - desktop and sound alerts for completion, errors, and permission prompts.

scripts/selftest.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2223,6 +2223,30 @@ def run_bg(*args: str) -> subprocess.CompletedProcess[str]:
22232223
"budget override should persist explicit limits and reason",
22242224
)
22252225

2226+
budget_override_invalid = subprocess.run(
2227+
[
2228+
sys.executable,
2229+
str(BUDGET_SCRIPT),
2230+
"override",
2231+
"--tool-call-count",
2232+
"0",
2233+
"--json",
2234+
],
2235+
capture_output=True,
2236+
text=True,
2237+
env=refactor_env,
2238+
check=False,
2239+
cwd=REPO_ROOT,
2240+
)
2241+
expect(
2242+
budget_override_invalid.returncode == 2,
2243+
"budget override should reject non-positive numeric values",
2244+
)
2245+
expect(
2246+
"usage: /budget" in budget_override_invalid.stdout,
2247+
"budget override invalid path should emit usage guidance",
2248+
)
2249+
22262250
budget_doctor = subprocess.run(
22272251
[sys.executable, str(BUDGET_SCRIPT), "doctor", "--json"],
22282252
capture_output=True,

0 commit comments

Comments
 (0)