Skip to content

Keep scheduled successor waits from triggering heartbeat stalls - #8825

Merged
huangruiteng merged 1 commit into
mainfrom
codex/quota-preserve-future-wait-20261115
Nov 15, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/quota-preserve-future-wait-20261115

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

A scheduled successor and a watch-only Monitor can leave an agent with nothing due. Two early heartbeats previously recorded two stalls, which could reopen the plan before either deadline. The automatic recorder now uses the scheduler’s existing proof of a future wait and preserves the original deadlines.

The normal path still selects work when the successor or Monitor becomes due. An unproven wait still records a stall, and an existing receipt can be replayed.

Author Declaration

Written by OpenAI Codex. The exact blocked-successor wait contract provides the requirements for source proof, normal work when due, and receipt replay.

Validation

Tested revision 0e1dd3f2de049edc80f5c3ac6c3f6863804c99ea with synthetic inputs.

Check kind Result Evidence
real_entrypoint passed Eight File and SQLite cases through quota should-run --codex-app. Both early wakes remain quiet, same-turn replay uses the original receipt, either due item is selected, and an unproven wait still records a stall. The early-wake cases check stored observations and quota.
regression_parity passed The early-wake regression fails against the previous code with a spurious stall on both providers.
unit passed 44 TypeScript cases covering wait proof and scheduler arbitration.
static passed Control-plane typecheck, Ruff, configured mypy, semantic vocabulary and public boundary scans.
integration passed CLI output budget smoke and the standard premerge run with its scope-specific quality receipt.
integration failed Full TypeScript suite. 6,538 passed, 89 skipped, and one digest ownership test failed. The same test and command reproduce the failure on the exact base 8ade78cddeb and on this commit. It reports the matcher in loopx/control_plane/capabilities/native_child_result_inbox.ts:109.
integration running Full local Python suite. GitHub CI will report the merge checks for this commit.

The standard premerge commands passed before the full TypeScript result. The quality receipt now records the failed validator. The PR is available for review while the baseline failure is addressed.

Frontend / Visual Evidence

UI impact is none.

Type of Change

  • Bug fix
  • Test update

LoopX Area

  • Control plane (goals, todos, quota, scheduler, registry, runtime)

Boundary Checklist

  • The diff and description use public-safe source and synthetic fixtures.
  • This change does not run or duplicate maintainer-owned benchmarks.
  • The diff covers the reproduced heartbeat error and its regression.
  • The bilingual diff check passes.
  • UI impact is none.
  • The commit includes a DCO Signed-off-by trailer.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent / gpt-6.1-sol / OpenAI / runtime_reported / reasoning effort max

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

动机 / Motivation

为定时后继与 Monitor 提前检查状态的 Agent。 在一个待恢复 Todo 和 watch-only Monitor 都未到期时,基线两次提前唤醒分别记下一次停滞,第二次触发重规划。 候选在 File 与 SQLite 上保持提前唤醒安静,留下的停滞与扣额都是 0。原回执重放保持同一 ID。 在同一 Goal 上推进运行时时钟到真实截止点。先到期的是后继时,准入选择原后继并返回显式恢复;先到期的是 Monitor 时,准入选择原 Monitor。 独立验证使用本地源码、两种实际存储和受控时间。已安装 App 的真实调度与真实模型采用待验证。

改动思路 / Approach

本 PR 的边界是 Codex App heartbeat 的自动停滞记录。 在原自动记录前复用 scheduler arbitration 已核实的未来时钟,保留原准入和回执拥有方。 把经过完整来源验证的等待期限交给已有 TypeScript 决策,原记录器只在尚需监督时追加。参考 docs/reference/protocols/goal-vision-replan-contract-v0.md 在 8ade78c 的 原定时等待契约。

具体改动 / Changes

  • positive-wait-proof 已验证。record_automatic_heartbeat_stall 先探测原 Turn 的既有记录,再对还未记录的 monitor_quiet_skip 求证。scheduler arbitration 继续使用原范围、条件和运行时时钟,只有完整的正向等待能抑制自动追加。实际记录器 · 共享证明
  • due-selection 已验证。同样的两个 deferred Todo 和 watch-only Monitor,在一份隔离 Goal 状态里取得相反的首次到期顺序。两种后端均选择对应原任务。定向回归
  • receipt-and-unknown-source 已验证。当等待条件不受支持时仍记录一次停滞,随后重放保留原回执。只有定时后继的 Agent 路径与真实权限检查沿原契约。 新的 Python adapter 通过已有 transport 调用 projectBlockedSuccessorWaitObservation,原路继续核对绑定和 scope。Python adapter · typed 判定

对主干的风险 / Risks

受控时钟下四组对照都能在基线复现提前的两次停滞。源状态读回保持原期限,候选在到期前和选择到期工作时均无额度扣减。定向 Python 基线 76 项、候选 84 项通过,双方定向 TypeScript 62 项和 typecheck 通过。原摘要所有权检查在两个精确版本都指向 native_child_result_inbox.ts 第 109 行同一模式。该失败的代码和扫描规则没有被本 PR 改动。

我的整体评价 / Verdict

通过当前提交的代码审查。保留原时间证明及监督,使有效等待到期后仍能按现有入口选择原后继或 Monitor。实际 App 采用另行验证。

English verdict: APPROVE at 0e1dd3f. Proven timed waits no longer create stalled heartbeat observations. File and SQLite preserve the original receipt and select either due item through fresh admission.

@huangruiteng
huangruiteng merged commit 08cc6ef into main Nov 15, 2026
34 of 50 checks passed
@huangruiteng
huangruiteng deleted the codex/quota-preserve-future-wait-20261115 branch November 15, 2026 15:03
loopx-agent added a commit that referenced this pull request Nov 15, 2026
…000 commits (#8759)

* Deliver verified images in private Lark answers

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Keep image retries behind new private Lark replies

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Recover missing images from one verified private Lark reply

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Use one wall clock for private Lark image retries

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Recheck the original Lark reply before historical image writes

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Verify private Lark image sources before every redirect

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* feat(coordination): add postgresql authority checkpoints and local-to-pg-seed exporter

- Add authority_checkpoints table DDL and tenant-scoped RLS policies.
- Store incremental delta in authority_commits and bounded checkpoints every 64 commits and on genesis cursor 1, resolving table bloat and the 20,000 commit recovery ceiling.
- Implement scanCommitted bounded delta replay from covering checkpoint via AuthorityStateReplay.
- Add setupPostgreSqlAuthoritySchemaAndRole for explicit schema installation and least-privilege restricted role assembly.
- Add exportLocalToPgGenesisSeed with sanitization (expired leases, local absolute paths, .local/ references, Feishu IDs, private materials) and fail-closed privacy boundary scan.
- Add loopx postgres setup and loopx postgres local-to-pg-seed CLI commands.
- Add test suites for checkpoints, sanitization, role assembly, and CLI invocation.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Recheck the historical Lark reply before each media write

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Retry Lark image uploads after an explicit App scope rejection

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Honor original Lark stop and closure before deferred images

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Recheck private answer control after Lark source read

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Read the current Core session after delayed image controls

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Fence private answer media dispatch with original controls

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Keep Lark media checks with private delivery

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Recheck Lark image sources after recording upload intent

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Read both original Feishu messages together before media upload

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Verify Feishu sources at the guarded image dispatch

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Preserve pre-dispatch Feishu source and session validation

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Recover and verify PostgreSQL checkpoint history with append-only privileges

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Verify backup history to its captured cursor beyond 20000 commits

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Generate explicitly synthetic secret fixtures at test time

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Recover private image uploads when the Lark CLI cannot start

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* fix(chat): preserve the first Goal's registered conversation (#8798)

* fix(chat): preserve the first Goal's registered conversation

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

* test(chat): keep original Goal adoption compatible with Python 3.11

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

---------

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

* Avoid rereading delivered Lark settings records and empty queues

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Recover private Lark images after a CLI descriptor limit

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Enable existing checks and the original authorized Task in managed Chat

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

* Reuse the canonical boundary projection and narrow Task JSON types

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

* Keep confirmed Goal creation attached to its original Task (#8805)

Reuse the existing C1 source observation guard

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

* Assert the lease source probe returned an observation (#8796)

(cherry picked from commit 2c099be)

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Recover an owed replan debit before the next host Turn (#8794)

* Recover an owed replan debit before the next host Turn

Consider the original Todo binding when an admitted replan has verified writeback. Require the exact spend receipt before another guard grants delivery, even if the Todo lifecycle has changed. Keep explicit selection on the same recovery path and let the existing settlement owner replay the original debit.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Preserve ordinary completed-Todo successor admission

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Replay one validated Turn debit across concurrent observations

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Validate original Turn spend terms before debit and replay

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

---------

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Keep conversation history rendering off the typing path (#8781)

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* feat(coordination): complete remote task lifecycle and opt-in gateway access (#8747) (#8765)

* feat(coordination): add complete remote task lifecycle and opt-in gateway access (#8747)

Align with PR #8747 (multi-loopx-agent-cloud-collaboration-v0) and
remote-authority-task-service-v0 (#8508):

1. Extend RemoteAuthorityService with full remote task settlement:
   - Add 'complete', 'block', 'defer', 'todo_add', and 'snapshot' operations.
   - Enforce hard-lease fencing and claim-request ownership checks.
   - Settle completion receipts and deterministic cross-machine snapshot digests.
   - Maintain default-deny Tenant/Goal/Actor authorization and incarnation pinning.

2. Introduce controlled remote authority gateway in Python control plane:
   - Default-disabled access: local private Goals never connect to remote
     authority or leak local credentials.
   - Opt-in gateway metadata projection for explicitly configured goals and
     the 'loopx-quality-review' canary.
   - Fail-closed should-run health check when remote authority is unconfigured
     or unreachable.

3. Conformance and unit test coverage across TypeScript and Python suites.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* test(coordination): assert subprocess readback before decoding

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* fix(coordination): qualify explicit remote task reads and lifecycle receipts

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* fix(coordination): preserve existing successors on remote completion

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* test(remote-authority): prove ordinary admission stays local

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

---------

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* test(chat): preserve create-only intent in workspace selection smoke

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Defer material inventory during configuration discovery (#8807)

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

* Defer report providers during Turn reads

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

* test(core): require installed provenance before qualification

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

* Reuse the final source check for staged Turn requests (#8820)

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

* Defer PR wait provider loading until permission is checked (#8821)

Load the optional PR reconciler only after the invocation-time observation permission check, inside the existing provider failure boundary. Preserve original permission, cadence, result and unknown-effect owners, and document the bounded default-closure and timing-window change.

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

* Load provider options only for the selected capability editor (#8822)

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

* docs: describe README session continuity directly (#8823)

* Skip automatic usage observers for supported opt-outs (#8824)

* Skip automatic usage observers for supported opt-outs

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

* Record installed Core and C1 observer qualification

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

---------

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

* docs(blog): add EdgeBench controlled Context ON vs OFF 10-task score comparison (#8760)

* docs(blog): add EdgeBench controlled Context ON vs OFF 10-task score comparison

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* docs(blog): use declarative mechanism-led opening in zh context-delivery score section

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

---------

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* fix(heartbeat): preserve proven waits before their due time (#8825)

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Fix manager discovery in ordinary installs (#8830)

* Package the manager discovery projection

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

* Record selected manager discovery distribution qualification

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

---------

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

* test(workspace): verify confirmed Goal creation against the current contract (#8816)

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Fix Windows CLI output probe reader invocation (#8817)

Port the probe fixture and native Windows regression coverage from e6eb92d and 8d200aa. Decode the generated PowerShell literals into argv before launching the pinned reader.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* refactor(issue_fix): fold reviewer source trust/freshness vocabularies into one owner (#8826)

reviewer_recommendation.py restated the trust and freshness sets that
repository_context.py already owns. Import both as aliases of the owner
objects so the decision has a single source, and add an architecture guard
that pins single ownership by value, by identity, and by wiring through both
public builders. REVIEWER_SOURCE_KINDS stays local (deliberately narrower).

Signed-off-by: psychologister <230141834+psychologister@users.noreply.github.com>
Co-authored-by: psychologister <230141834+psychologister@users.noreply.github.com>

* fix(scheduler): reject superseded heartbeat receipts on the Python follow-up route (#8708)

* fix(scheduler): reject superseded heartbeat receipts on the Python follow-up route

The Python compatibility route for scheduler-ack-current/scheduler-fail-current
checked only that the receipt for --turn-instance-id exists; a receipt already
superseded by a newer heartbeat Turn still committed scheduler state, while the
native TypeScript transaction rejects it as heartbeat_receipt_stale.

Thread the Turn from build_scheduler_followup_payload through
record_quota_scheduler_ack / record_quota_scheduler_ack_for_decision /
record_quota_scheduler_failure_for_decision into _run_native_followup, which now
sends turn_instance_id with require_heartbeat_receipt=true. The TypeScript
transaction remains the single owner of the missing/stale/superseded fence (it
also rechecks under the scheduler state lock); optional parameters keep the
in-process API, which has no Turn, unchanged.

Fixes #8605

Signed-off-by: Lihua <1017343802@qq.com>

* Keep scheduler follow-up hint reads out of legacy migration

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

---------

Signed-off-by: Lihua <1017343802@qq.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Co-authored-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Resume the original quota settlement after lifecycle writeback (#8728)

* fix(replan): resume settlement after lifecycle review writeback

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Recover committed replan settlement before rebuilding its review

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

---------

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* fix(antigravity): keep the project registry in generated wakes (#8768)

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* fix(chat): keep workspace checker reads portable (#8814)

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Reject external Turn retries when the captured work changes (#8828)

* Recheck captured work before launching an external Turn host

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Keep complete-source metadata assembly outside Turn planning

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

---------

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Preserve PostgreSQL runtime access and recover seed output retries

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Validate recovery cursor metadata without a fixed history ceiling

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

---------

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Signed-off-by: psychologister <230141834+psychologister@users.noreply.github.com>
Signed-off-by: Lihua <1017343802@qq.com>
Co-authored-by: Lusen Dong <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Co-authored-by: Lusen Dong <cicomaple@gmail.com>
Co-authored-by: psychologister <st040325@gmail.com>
Co-authored-by: psychologister <230141834+psychologister@users.noreply.github.com>
Co-authored-by: Lihua <1017343802@qq.com>
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