Skip to content

fix: harden generated execution authority - #103

Merged
kmosoti merged 1 commit into
mainfrom
fix/generated-execution-authority
Jul 27, 2026
Merged

fix: harden generated execution authority#103
kmosoti merged 1 commit into
mainfrom
fix/generated-execution-authority

Conversation

@kmosoti

@kmosoti kmosoti commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Follow-up hardening for #102, which merged while its final local review was still in progress.

This change:

  • makes policy admission and blocked termination crash-safe and replay-stable;
  • intersects generated execution with public, worker, and durable remaining authority;
  • prevents failed attempt heads from becoming retry bases while preserving retained-worktree visibility;
  • binds generated plans, checks, artifacts, replay, and review to the canonical accepted plan;
  • meters provider and acceptance latency across checks, including exceptional and invalid-clock paths;
  • adds regressions for crash windows, plan substitution, authority exhaustion, replan retention, and generated review discovery.

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 passed
  • uv run python tools/run_pytest.py --cov=blackcell --cov-report=term-missing — 571 passed, 1 skipped, 86.01% coverage
  • BLACKCELL_RUN_PODMAN_TESTS=1 uv run python tools/run_pytest.py tests/integration/test_podman_runtime.py -q --blackcell-require-all-pass — 1 passed
  • uv run ty check
  • independent Codex and AGY adversarial reviews — pass, no findings

The existing SQLite ResourceWarning inventory remains visible and is intentionally not suppressed; lifecycle remediation is separate follow-up work.

@kmosoti
kmosoti merged commit ed05e67 into main Jul 27, 2026
2 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +823 to +827
if _authority_usage_incomplete(authority) or _provider_budget_exhausted(
provider_budget,
total_budget=request.budget,
):
raise ExecutionError("execution-cumulative-budget-exhausted") from None

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +1695 to +1696
if (task.status is TaskLifecycleStatus.BLOCKED) != (task.blocked_reason is not None):
raise ExecutionRuntimeError("invalid-execution-checkpoint")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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