Repository navigation
Let heartbeat benchmarks use their full remaining phase budget #8148
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
Changes from all commits
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 |
|---|---|---|
|
|
@@ -16,7 +16,8 @@ | |
|
|
||
| from benchmark.runtime.codex import Execution, prepare_codex_home, process_environment | ||
|
|
||
| PHASE_WORK_RESERVE_SECONDS = 160 | ||
| from benchmark.runtime.scheduler import PHASE_WORK_RESERVE_SECONDS as PHASE_WORK_RESERVE_SECONDS | ||
| from benchmark.runtime.scheduler import phase_work_reserve | ||
|
|
||
|
|
||
| def read_json(text: str) -> dict: | ||
|
|
@@ -556,16 +557,18 @@ def run_once(env: dict[str, str]) -> dict: | |
| try: | ||
| if stage == "execute" and env.get("LOOPX_PHASE_DEADLINE_EPOCH"): | ||
| remaining = float(env["LOOPX_PHASE_DEADLINE_EPOCH"]) - time.time() | ||
| # Reserve startup and settlement on every wake, then allow the | ||
| # remaining time for work instead of reusing the initial timeout. | ||
| if remaining <= PHASE_WORK_RESERVE_SECONDS: | ||
| # Heartbeat work uses the whole remaining phase. Cleanup is bounded | ||
| # by its existing host transport, not subtracted from each wake. | ||
| # Native Goal and managed-turn transports retain their own reserve. | ||
| reserve = phase_work_reserve(execution.mode) | ||
| if remaining <= reserve: | ||
| receipt.update(ok=True, budget_exhausted=True, host_invoked=False) | ||
| return receipt | ||
| if execution.mode == "heartbeat": | ||
| phase_work_deadline = float(env["LOOPX_PHASE_DEADLINE_EPOCH"]) - PHASE_WORK_RESERVE_SECONDS | ||
| phase_work_deadline = float(env["LOOPX_PHASE_DEADLINE_EPOCH"]) | ||
|
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] 请求准入仍扣除旧的 160 秒 新的完整 phase deadline 会让剩余 140 秒的 heartbeat 启动,但 native_child_process 随后创建的 ProviderRequestAdmission 仍在 provider_request_admission.py:70–71 从同一个截止时间减去 PHASE_WORK_RESERVE_SECONDS。真实 SQLite/native child/本地 HTTP 对照中,选项关闭时成功 POST,开启时立即 provider_request_budget_exhausted,upstream POST=0,最终是 unknown、retryable=false 的 Host failure;剩余 300 秒开启选项则正常。请让网关复用相同 heartbeat deadline/模式规则,同时保留显式较早 cap、存活及 Stop/quota 检查,并补 gate on/off 短剩余窗口回归。 |
||
| execution = replace( | ||
| execution, timeout_seconds=(remaining - PHASE_WORK_RESERVE_SECONDS if execution.timeout_seconds is None | ||
| else min(execution.timeout_seconds, remaining - PHASE_WORK_RESERVE_SECONDS)) | ||
| execution, timeout_seconds=(remaining - reserve if execution.timeout_seconds is None | ||
| else min(execution.timeout_seconds, remaining - reserve)) | ||
| ) | ||
| prepare_codex_home( | ||
| home, | ||
|
|
||
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] 更新受新截止规则影响的现有规划测试
这里将 heartbeat 耗尽边界改为零,但 test_task_entry.py 仍把剩余 150 秒视为耗尽,Harbor/worker 的其他断言也仍期望旧预留后的 140/40/440。相同 planning+request-admission suite 在不可变 base 为 122 passed/5 failed,当前 head 为 116 passed/11 failed;额外六项正是这些 cutoff/cap 断言,五项相同的 quota preflight KeyError 单独保留。请更新这六项 oracle,保留真正零/过期预算、blocked plan、不可重新充时和无错误 dispatch 的负例。复核 python -m pytest -q benchmark/tests/test_task_entry.py benchmark/tests/test_provider_request_admission.py。