Skip to content

[codex] bound deadline process cleanup - #2047

Closed
hqhq1025 wants to merge 1 commit into
apache:mainfrom
hqhq1025:codex/bound-deadline-process-cleanup
Closed

[codex] bound deadline process cleanup#2047
hqhq1025 wants to merge 1 commit into
apache:mainfrom
hqhq1025:codex/bound-deadline-process-cleanup

Conversation

@hqhq1025

@hqhq1025 hqhq1025 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

What changed

  • bound buffered stdout/stderr replay to 60 seconds and mark replay processes for scope cleanup
  • bound TERM and KILL cleanup commands to 10 seconds each
  • let a successful KILL settle the deadline even if the TERM transport failed
  • add regressions for blocked output replay and Claude Code cancellation cleanup
  • document timeout settlement semantics

Root cause

When a pinned CLI reached its task-native deadline, the command wrapper could block replaying buffered output into an abandoned Docker exec pipe. After that was bounded, Claude Code still exposed a second failure mode: the TERM cleanup transport could hang indefinitely. Harbor remained in n_running_trials=1, never invoked the verifier, and the outer watchdog eventually recorded a false infrastructure failure.

The affected run showed Claude output stopping exactly at the task-native deadline while Harbor stayed alive for the full agent + verifier + teardown watchdog window.

Behavior

TERM and KILL remain ordered. If TERM transport fails but KILL succeeds, the original budget-exhausted cancellation propagates and Harbor can grade the deadline workspace. If KILL also fails, cleanup still fails closed as infrastructure because the workspace cannot be proven frozen.

Validation

  • node --test packages/headless/dist/__tests__/harbor-adapter.test.js
  • local: 21 passed, 5 environment-dependent skips
  • Harbor 0.13.2 isolated worktree: 25 passed, 1 clean-worktree-only skip
  • python3 -m py_compile packages/headless/harbor/process_scope.py
  • biome check and git diff --check

@jackwener

Copy link
Copy Markdown
Member

感谢补上 process cleanup deadline 这一重要的 lifecycle invariant。

这个 patch 的 3 个变更文件全部位于已经删除的 packages/headless。#2605 已将公开 Eval 完整迁移到 packages/eval,并要求执行统一通过 shared executor 与 Runtime Host。对应的 bounded cleanup 也已经在 current packages/eval/harbor/relay_agent.py 中由 TERM/KILL deadline 实现,分别覆盖 trial/process-group cleanup 路径。

因此旧 Headless patch 已无法也无需合入,关闭这个已迁移完成的 PR。如果 current Eval cleanup 仍存在一个具体漏口,欢迎直接针对 packages/eval 的现有 owner 提一个聚焦修复。

Thank you for tightening this lifecycle boundary. packages/headless was retired by #2605, and current packages/eval/harbor/relay_agent.py now owns bounded TERM/KILL cleanup. Since all files changed here belong to the removed Headless implementation and the invariant has moved to Eval, I am closing this PR as superseded.

@jackwener jackwener closed this Aug 20, 2026
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.

2 participants