fix: clarify capability preflight lifetime across safe reads (Closes #470)
Add preflight_contract helpers with explicit re-resolve error messages, document the read-only tool set and consumption rules, and extend tests for close_pr sequencing and task replacement. Validation: ./venv/bin/python -m pytest tests/test_preflight_read_survival.py tests/test_mcp_server.py::TestPreflightVerification -q Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
+8
-5
@@ -502,7 +502,7 @@ def verify_preflight_purity(
|
||||
)
|
||||
if not _preflight_capability_called:
|
||||
raise RuntimeError(
|
||||
"Pre-flight order violation: Task capability (gitea_resolve_task_capability) has not been resolved (fail closed)"
|
||||
preflight_contract.format_missing_capability_error(task)
|
||||
)
|
||||
if (
|
||||
task is not None
|
||||
@@ -510,9 +510,9 @@ def verify_preflight_purity(
|
||||
and task != _preflight_resolved_task
|
||||
):
|
||||
raise RuntimeError(
|
||||
"Pre-flight task mismatch: "
|
||||
f"resolved '{_preflight_resolved_task}' but mutation requires "
|
||||
f"'{task}' (fail closed)"
|
||||
preflight_contract.format_task_mismatch_error(
|
||||
_preflight_resolved_task, task
|
||||
)
|
||||
)
|
||||
|
||||
ctx = _resolve_author_mutation_context(worktree_path)
|
||||
@@ -600,6 +600,7 @@ import issue_lock_adoption # noqa: E402
|
||||
import merge_approval_gate # noqa: E402
|
||||
import already_landed_reconcile # noqa: E402
|
||||
import author_mutation_worktree # noqa: E402
|
||||
import preflight_contract # noqa: E402
|
||||
import issue_claim_heartbeat # noqa: E402
|
||||
import issue_work_duplicate_gate # noqa: E402
|
||||
import reviewer_pr_lease # noqa: E402
|
||||
@@ -6886,7 +6887,9 @@ def gitea_acquire_conflict_fix_lease(
|
||||
task_capability_map.required_permission("comment_issue"))
|
||||
if blocked:
|
||||
return blocked
|
||||
verify_preflight_purity(remote, worktree_path=worktree_path)
|
||||
verify_preflight_purity(
|
||||
remote, worktree_path=worktree_path, task="comment_issue"
|
||||
)
|
||||
comments = _list_pr_lease_comments(
|
||||
pr_number,
|
||||
remote=remote,
|
||||
|
||||
Reference in New Issue
Block a user