Skip to content

fix(phase3-step9): consolidated review fast-follow (I2 + I4 + M1 + M2 + M4)#20

Merged
AVADSA25 merged 5 commits intomainfrom
feat/phase3-step9-fastfollow
May 3, 2026
Merged

fix(phase3-step9): consolidated review fast-follow (I2 + I4 + M1 + M2 + M4)#20
AVADSA25 merged 5 commits intomainfrom
feat/phase3-step9-fastfollow

Conversation

@AVADSA25
Copy link
Copy Markdown
Owner

@AVADSA25 AVADSA25 commented May 3, 2026

Summary

Consolidated fast-follow PR addressing all 5 deferred items from the Phase 3 Step 9 code review (PR #19). Merged into a single PR per user request to keep workflow simple.

What this fixes

ID Issue Fix
I2 step_budget_exhausted mapped to blocked_on_permission (semantic mismatch — there's no permission to grant) Now transitions to paused with reason. New POST /api/agents/{id}/extend_budget endpoint bumps the current checkpoint's budget via state.json overrides (plan stays immutable; tamper check intact).
I4 Daemon crash-recovery AGENT_RESUMED emit had no correlation_id, orphaned from subsequent _run_agent chain _run_agent(agent_id, cid=None) now accepts optional cid; daemon mints recovery_cid once and threads it through both the audit emit AND the new _run_agent invocation.
M1 permission_gate had no test for domain_not_authorized path Added test_permission_gate_blocks_domain_not_in_grants.
M2 Plan's Task 10 Step 2 said "add codec-agent-runner to heartbeat" but heartbeat is HTTP-only and codec-observer (sibling daemon) isn't probed either — the plan was wrong Added 4-line note in check_system_health() docstring documenting that PM2 autorestart: true is the supervision contract for daemons. No behavior change.
M4 PermissionManifest.read_paths declared but permission_gate only enforces write_paths (asymmetry undocumented) Added 6-line inline comment explaining the deliberate scoping (full read enforcement would need new Action field + LLM prompt update — out of scope for Step 9).

Tests

  • test_agent_runner.py: 33 → 36 tests (+1 from M1, +1 from I4, +3 from I2 minus 2 not added)
  • Wait — actual delta is +1 M1 (domain), +1 I4 (cid match), +3 I2 (paused, extend_budget happy, extend_budget 409) = +5 tests, total 36
  • Full test_agent_runner.py + test_agent_plan.py suite: 67 passed, 0 new failures
  • All baseline 20/73 preserved

Files changed

File Lines What
codec_agent_runner.py +37 −10 I2 budget-pause, I4 cid threading, M4 comment
tests/test_agent_runner.py +85 M1, I4, I2 tests
routes/agents.py +60 /extend_budget endpoint + ExtendBudgetBody model
codec_heartbeat.py +6 −1 M2 docstring note

Provenance

This PR consolidates outputs from 5 side-chat sessions that the user spawned via review-feedback chips. The user requested I wrap the work cleanly in this main session — so all 5 side-chats' output is folded here, with I2 (which paused awaiting design confirmation) implemented per side-chat #3's recommended option 2 (state.json override, plan stays immutable).

Test plan

  • 🧪 tests/test_agent_runner.py + test_agent_plan.py → 67 passed
  • All 5 review issues verified fixed via dedicated tests
  • Post-merge deploy:
    cd ~/codec-repo
    git pull
    pm2 restart codec-dashboard  # picks up /extend_budget endpoint
    pm2 restart codec-agent-runner  # picks up I2 + I4 fixes

🤖 Generated with Claude Code

Mikarina13 and others added 5 commits May 3, 2026 13:08
Adds 5th permission_gate test exercising the network_domains branch
(codec_agent_runner.py:109-113), which previously had no coverage.
Asserts PermissionViolation with reason='domain_not_authorized' and
needed=<domain> when action.network_call=True and the domain is
absent from both per-agent and global grants.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
PHASE3-STEP9-PLAN.md Task 10 Step 2 prescribed adding codec-agent-runner
to a _MONITORED_SERVICES list, but that list does not exist — heartbeat
probes are HTTP-only and codec-observer (also a PM2 daemon) is already
absent from the existing services dict. AGENTS.md §3 documents the
intentional deferral; this docstring closes the loop in code so future
agents reading codec_heartbeat.py see the rationale without rediscovering
it from the plan.

No behavior change; PM2 autorestart remains the supervision contract for
codec-agent-runner.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@AVADSA25 AVADSA25 merged commit ec14697 into main May 3, 2026
1 check passed
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.

2 participants