Repository navigation
fix(turn): refuse a run-once preparation claim that was not consumed #8776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
BigDataDZ
wants to merge
1
commit into
loopx-project:main
Choose a base branch
from
BigDataDZ:codex/run-once-preparation-refusal-20261114
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -106,6 +106,7 @@ def project_preparation_effects(value: dict[str, Any]) -> None: | |
| ): | ||
| from ..control_plane.turn_driver.codex_execution_preparation import ( | ||
| builtin_execution_preparation_claim, | ||
| unconsumed_preparation_refusal, | ||
| ) | ||
|
|
||
| from .turn_host_request import prepare_turn_host_arguments | ||
|
|
@@ -362,6 +363,27 @@ def read_decision_owner(): | |
| or (decision.get("selected_todo") or {}).get("todo_id") != prepared_todo | ||
| or decision.get("normal_delivery_allowed") is not True): | ||
| raise ValueError(preparation_error) | ||
| else: | ||
| refusal = unconsumed_preparation_refusal(decision) | ||
| if refusal is not None: | ||
| # The advertised claim was not consumed, so this route | ||
| # stays blocked. Refuse with the typed action boundary | ||
| # instead of the generic not-host-executable rejection | ||
| # a bounded caller would otherwise retry identically. | ||
| blocked_plan = build_loopx_turn_plan( | ||
| decision, host=args.host, execution_mode=args.execution_mode, | ||
| scheduler_owner=args.scheduler_owner, session_binding=session_binding, | ||
| turn_instance_id=args.turn_instance_id, iteration_context_policy=args.iteration_context, | ||
| session_scope=args.session_scope, goal_ref=goal_ref, | ||
| ) | ||
| transaction = blocked_plan.get("transaction") | ||
| if isinstance(transaction, dict): | ||
| transaction.pop("settlement_plan", None) | ||
| blocked_plan.update(mode="run_once", status="execution_preparation_required", | ||
| execute=True, executed=False, **refusal) | ||
| project_preparation_effects(blocked_plan) | ||
| print_payload(blocked_plan, output_format(args), _render_loopx_turn_plan_markdown) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] 默认终端没有给出申领恢复动作,JSON 则用成功计划表示拒绝。 两库中退出码都为 1。显式 JSON 有原因和命令,却仍是 ok=true 的 loopx_turn_plan_v1;默认 Markdown 只显示 Turn Plan / blocked,省掉状态、原因和命令。成功计划读法与拒绝的机器退出语义冲突,终端用户也仍得再查 guard。 沿用现有 run-once 执行结果及渲染边界输出明确未执行、非成功的准备拒绝。只在原 guard 授权并绑定准确身份时展示原命令及就地复核要求,保留零 Host/零扣额。 |
||
| return 1 | ||
| # Operation-equipped app-server sessions retain their Todo-bound | ||
| # approval/handoff contract; this option controls exec conversation reuse. | ||
| session_scope = (args.session_scope if args.host in {"codex-cli", "codex-app-server"} | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] 已持租约的 App Server 任务在执行前被拒绝。 拒绝分支进入两种 Host 共用的代码块;helper 只在 builtin CLI 的分支导入。File 和 SQLite 的原生 Steward 测试中,基线均完成并结算,候选两条 ready 路径均报未绑定局部变量,Host 未启动、额度未扣。需要领租约的原生路径仍通过;另一个独立反例也证实原生回调拒绝从原受控阻断变成异常。 将新拒绝限定在 builtin Codex CLI 实际安装的准备回调,原生回调沿用既有拒绝路径;若确有共用需求,让 adapter 提供明确的处置结果并先验证两条路径。