Repository navigation
Protect bound Turn dispatch against work and lease changes #8800
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
base: main
Are you sure you want to change the base?
Changes from all commits
aa16c47
21a925c
6028bb9
497a97f
ae407f2
e65b074
0f99d80
79de0cd
0243ed7
954ec7c
25f49f6
b589d5d
8e6f980
ea9b0b6
9d58445
58c114b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -145,13 +145,21 @@ def child_process(command: list[str], *, env: dict[str, str], stdout, stderr, | |
| if check_current_launch is not None and goal_admission is None: | ||
| raise ValueError("current Host launch check requires its original Goal admission") | ||
| if check_current_launch is not None: | ||
| goal_admission = goal_admission.with_launch_decision(check_current_launch) | ||
| # The live heartbeat can select hard-lease work even on a new Turn. | ||
| # Use its canonical writer fence for the decision and actual spawn. | ||
| goal_admission = goal_admission.with_launch_decision( | ||
| check_current_launch, work_runtime_root=Path(env["LOOPX_RUNTIME_ROOT"]), | ||
| ) | ||
| # Session selection may precede rendering/capture. Serialize only actual | ||
| # launch with the existing Goal lifetime owner, never the whole model run. | ||
| with (goal_admission.launch_lifetime(operation="codex_agent_host_launch") | ||
| if goal_admission is not None else nullcontext()): | ||
| if goal_admission is not None else nullcontext()) as expires_at_ms: | ||
|
Collaborator
Author
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] 在已绑定 checkpoint 启动时持有租约 writer fence 恢复已绑定 hard lease 的 Benchmark checkpoint。Gateway 保持默认关闭,在 live admission 和 expiry 检查已经通过后暂停
Collaborator
Author
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] 为已绑定 checkpoint 的 native spawn 保留原租约写锁 恢复已绑定 hard lease 的 Benchmark checkpoint。Gateway 保持默认关闭,在 live admission 和时钟检查通过、启动进程之前暂停 |
||
| # The child can write a native event before Popen returns. | ||
| launch_started_at_unix = time.time() | ||
| if expires_at_ms is not None and launch_started_at_unix * 1000 >= expires_at_ms: | ||
|
Collaborator
Author
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] 在启动结果跨过硬租约期限时拒绝投递 checkpoint 输入 保留同一个 hard lease,在 |
||
| from loopx.control_plane.goals.first_party_host_admission import FirstPartyHostLaunchRejected | ||
|
|
||
| raise FirstPartyHostLaunchRejected("goal_launch_not_allowed") | ||
| process = subprocess.Popen( | ||
|
Collaborator
Author
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] 在子进程启动跨过硬租约期限后拦住原工作输入 在已绑定 hard lease 的 checkpoint 上打开默认 native 派发。保留 live check 通过,将同一个 lease 续到可控的短期限,在真正 |
||
| command, | ||
| cwd=env["LOOPX_PROJECT"], | ||
|
|
||
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.
[P2] 最后一段 POST 过期后仍记为正常发送 Benchmark 的 provider admission 已读到有效的 hard lease。网络发送线程在为最后一个 POST body 分片设置 socket timeout 后暂停,等原租约过期才调用真实 send。
ProviderRequestAdmission.lifetime会把现有 deadline 收紧到租约。_dispatch_bounded在最后一次 send 前设置相对 socket timeout,真实调用返回后缺少绝对 deadline 核对,外层把forwarded设为 true。 File 和 SQLite 的当前提交分别把 socket timeout 收紧至 1.254 秒和 1.314 秒,loopback 上游仍在租约到期约 34 ms 和 31 ms 后收到完整 body 并返回 HTTP 200。两个后端都记录sent=1、unknown=0,基线同样正常转发。夹具额度扣减为零。 在现有 gateway 检查最后一次真实写入是否在绝对 deadline 内完成。可能已经送达时保留原 invocation 的 unknown 观察,避免返回正常成功或自动重发。 租约截止时间 · 实际发送 · 发送观察