fix: harden generated execution authority - #103
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 06b21798df
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if _authority_usage_incomplete(authority) or _provider_budget_exhausted( | ||
| provider_budget, | ||
| total_budget=request.budget, | ||
| ): | ||
| raise ExecutionError("execution-cumulative-budget-exhausted") from None |
There was a problem hiding this comment.
Terminate unaffordable runs instead of crashing the worker
When an accepted generated plan provides no planning-token authority—for example, a read-only PlanNode may legally set either token limit to zero—this branch raises before EXECUTION_GOAL_ADMITTED is persisted. ExecutionWorkerProcess._run_generated_once() does not catch the error, so the daemon exits while the public run remains queued; every restart selects the same run again, preventing later runs from executing. Persist a terminal/reconciliation outcome or reject such plans during admission instead.
AGENTS.md reference: AGENTS.md:L5-L8
Useful? React with 👍 / 👎.
| if (task.status is TaskLifecycleStatus.BLOCKED) != (task.blocked_reason is not None): | ||
| raise ExecutionRuntimeError("invalid-execution-checkpoint") |
There was a problem hiding this comment.
Clear blocked reasons when terminal events replace task status
If cancellation lands after EXECUTION_TASK_BLOCKED is appended but before EXECUTION_RUN_TERMINATED, the runtime-event projection changes the task from BLOCKED to CANCELED while retaining blocked_reason. This new checkpoint invariant then rejects the projection's own dumped state, so a subsequent snapshot/load cannot recover that valid crash-window state. Clear blocked_reason when terminal runtime events rewrite task statuses.
AGENTS.md reference: AGENTS.md:L5-L8
Useful? React with 👍 / 👎.
Follow-up hardening for #102, which merged while its final local review was still in progress.
This change:
Verification:
uv run ruff format --check .uv run ruff check .uv run python tools/run_pytest.py tests/architecture/test_dependencies.py -q --blackcell-require-all-pass— 8 passeduv run python tools/run_pytest.py --cov=blackcell --cov-report=term-missing— 571 passed, 1 skipped, 86.01% coverageBLACKCELL_RUN_PODMAN_TESTS=1 uv run python tools/run_pytest.py tests/integration/test_podman_runtime.py -q --blackcell-require-all-pass— 1 passeduv run ty checkThe existing SQLite
ResourceWarninginventory remains visible and is intentionally not suppressed; lifecycle remediation is separate follow-up work.