Skip to content

Default Antigravity heartbeat Turns to the complete work contract - #8748

Merged
huangruiteng merged 27 commits into
codex/c1-work-contract-review-20261107from
codex/c1-antigravity-default-review-20261114
Nov 14, 2026
Merged

huangruiteng merged 27 commits into
codex/c1-work-contract-review-20261107from
codex/c1-antigravity-default-review-20261114

Conversation

@loopx-agent

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

Copy link
Copy Markdown
Collaborator

A saved Antigravity heartbeat now enters C1 automatically when it runs work bound to a Turn. The saved thin loader and generated sidecar use the checked TypeScript work contract, retiring the unsigned work-source writer for this profile. The Turn-less sidecar still receives Core's scheduler decision, cadence, backoff and follow-up arguments.

Recovery keeps the original Turn and its capture, preserves the caller's stateless delivery options including explicit context delivery off, and writes back before spending. The historical reader still recovers admitted work. Delta still requires a supported native host.

Validation

  • At 5f0aa50ba9a3, 93 focused source tests passed; seven standalone-install tests were skipped in that source invocation. Separately built the standalone Core wheel, installed it into an isolated environment, and passed the SSH complete-Turn settlement test.
  • The installed LoopX wheel ran the saved Antigravity sidecar command and packaged Stop hook on File and SQLite. Both recovered the same C1 Turn after an interrupted writeback, preserved the original capture digest, and settled once across replay. User cancellation, wrong input, duplicate trigger and exhausted quota stayed suppressed. The trajectory RPC used a local test fixture.
  • Earlier isolated Core tests exercised eight File/SQLite interruption cases with both the original and following Turn using C1. The source tests cover the explicit private-capture and inline recovery paths.

Dependency and release qualification

Tested on #8266's current branch tip b5dc37fad58c. The child can be reviewed separately while #8266 is under independent review. Retarget once the base lands.

Before enabling this default in a release, verify the native Antigravity schedule and Stop lifecycle, and complete the matched outcome and total-cost comparison in RFC §9.

For rollback, pause new wakes for this profile, settle any admitted Turn with the compatible reader and its original receipts, then restore the prior profile version for new work.

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

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

评审提交 48d6b5bedcec735ab481b7187357335e7cd13c53;对照目标基线 2a863df8e7af9df0379a4016af7d8809c6ade54f。

[P2] 升级会给已准入的 Antigravity Turn 更换工作契约版本。 在目标基线用已有 Antigravity guard 和显式 context-delivery off 准入一个普通工作 Turn。保留原 capture 和 validation 回执,在写回前切到候选,用同一 Goal、Agent、Todo 和 Turn ID 恢复。 候选在原 Turn 写回前和仅剩 spend 的恢复阶段都输出带 contract_binding 的 loopx_turn_envelope_v1。目标基线重跑同一 Turn 两阶段仍用原未签名版式。File 和 SQLite 均保留原 capture、原身份和一次扣额,版本依然在已有 Turn 中途改变。 触发分支

动机 / Motivation

这项改动影响在 Antigravity 使用已保存 heartbeat 的操作者。 执行中的工作可能在升级时尚未写回。操作者需要续接原工作,完成后才让下一次唤醒使用新契约。 当前目标基线是 #8266 的工作分支,普通 Antigravity Turn 使用未签名决策。 同一恢复调用可能在没有新的准入时收到不同契约。读取端无法仅凭原 Turn ID 推断应使用哪个版本。 候选的新 Turn 走现有 TypeScript 工作契约。生成的 sidecar、保存的 loader、显式 inline off 和私有 capture 都可进入普通结算;中断回放保留原身份和一次扣额。无 Turn 的调度探测与 Stop 仍按原结果处理。 验证针对 #8266 当前分支作为基线的源码 CLI、实际 File/SQLite 和本地生成的 Antigravity 命令。真实安装的 App 调度、长程匹配对照与发布采用待验证。

改动思路 / Approach

现有 scheduler profile 识别 Antigravity 工作场景。Core 继续选中工作和结算。CLI 负责编排 C1 来源与显示传输,现有回执持有原 Turn、Todo、写回与扣额。 新工作可以复用现有 C1 composer 和分页读取。已准入工作应从原 capture 或版本绑定恢复,不能只靠当前 profile 和 Turn ID 是否存在区分新旧。 现有 composer 校验工作契约,原 reader 按绑定的摘要交付内容,结算沿用原回执。

具体改动 / Changes

关键代码讲解

默认路径按解析出的 profile 和是否提供 Turn ID 选择 C1。Antigravity 的旧 Turn 也满足该条件。随后调用既有 TypeScript composer,原以 unsigned 格式捕获的旧 Turn 在恢复时因此收到 v1。默认来源选择 完整契约调用

恢复命令沿用 stateless flags,包括显式 inline off。这个开关决定如何显示,仍会得到候选选择的完整来源。原回执、原文件摘要与历史 reader 都有效。无 Turn 的 sidecar 和 Stop 依旧返回现有调度动作。恢复参数绑定 Stop 观察

使用候选时仍需完成发布要求的安装端验证与匹配成本比较。版本迁移约束 发布资格与成本验收

按 docs/architecture/rfcs/controller-executor-unified-contract-v0/contract-and-context.md 的当前基线约束,新工作使用完整契约 已验证;无 Turn 的调度与 Stop 已验证;原身份与一次结算 已验证;已准入工作保留原版本 未满足。基线验收依据

对主干的风险 / Risks

源基线先真实准入,再在两个构建中分别对同一个 Turn 读取写回前与仅剩扣额的结果。只有候选把两处恢复都改成 v1。两种构建最后都只扣一次。读取旧文件仍能取得准入时的原始字节,但发送给恢复调用者的响应已变为 v1。对照普通生成 sidecar 和 Stop,File 与 SQLite 的可运行与已停止状态、无扣额行为保持一致。已覆盖的新契约中断路径

语义与 CI 对齐

本地 standard premerge 18 项选中检查通过。68 项契约及中断用例和 19 项调度相关用例通过。独立对照从基线实际准入旧 Turn,再以两种存储比较精确基线和候选的恢复格式与结算回读。托管 CI 未查询。 验证针对 #8266 当前分支作为基线的源码 CLI、实际 File/SQLite 和本地生成的 Antigravity 命令。真实安装的 App 调度、长程匹配对照与发布采用待验证。

我的整体评价 / Verdict

请求修改。在现有 Turn 预备或恢复边界依据原捕获或已记录的来源版本确定恢复格式。将 Antigravity 默认 C1 只应用于迁移后新准入的 Turn,旧 Turn 沿原来源恢复或通过已支持的旧版继续,直到原回执结算。 用目标基线实际准入旧 Turn,跨版本按生成的恢复、写回和扣额命令验证结束。File 和 SQLite 都核对旧来源、原摘要和一次扣额,再验证下一次新准入使用 C1。

English verdict: REQUEST_CHANGES at 48d6b5b. An Antigravity Turn admitted on the target base switches to C1 on same-Turn recovery. File and SQLite preserve its original identity and one debit; the recorded source version still changes.

profile = scheduler_runtime_profile_for_execution_context(context.scheduler_context)
# Antigravity also uses this command for turnless sidecar and Stop probes.
antigravity_work_turn = (
profile is SchedulerRuntimeProfile.ANTIGRAVITY_APP and heartbeat_turn_id is not None

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.

[P2] 升级会给已准入的 Antigravity Turn 更换工作契约版本。 在目标基线用已有 Antigravity guard 和显式 context-delivery off 准入一个普通工作 Turn。保留原 capture 和 validation 回执,在写回前切到候选,用同一 Goal、Agent、Todo 和 Turn ID 恢复。 候选在原 Turn 写回前和仅剩 spend 的恢复阶段都输出带 contract_binding 的 loopx_turn_envelope_v1。目标基线重跑同一 Turn 两阶段仍用原未签名版式。File 和 SQLite 均保留原 capture、原身份和一次扣额,版本依然在已有 Turn 中途改变。 在现有 Turn 预备或恢复边界依据原捕获或已记录的来源版本确定恢复格式。将 Antigravity 默认 C1 只应用于迁移后新准入的 Turn,旧 Turn 沿原来源恢复或通过已支持的旧版继续,直到原回执结算。 用目标基线实际准入旧 Turn,跨版本按生成的恢复、写回和扣额命令验证结束。File 和 SQLite 都核对旧来源、原摘要和一次扣额,再验证下一次新准入使用 C1。

loopx-agent and others added 15 commits November 14, 2026 17:02
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…-antigravity-default-review-20261114

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(todos): preserve arguments in claim recovery commands

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

* fix(todo): reconcile reviewed updates after claim recovery

Use the same targeted readback when execution proof is omitted or the original managed claim has expired. Render the new claim reference and the reconciled provider revision in the retry command.

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: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…8720)

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: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
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 the clock-derived first due time out of the create request identity. Derive it at the canonical writer after checking for the original receipt. Preserve the result on retries and continue to reject changes to the authored schedule.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…ion (#8731)

Canonical Todo timestamps are whole seconds. A review-bound successor
created in the admission second was stored earlier than a fractional
guard_recorded_at, so lifecycle reconstruction dropped the admitted
source and receipt-bound recovery could not settle the original Turn.

Compare that successor with the same admission-second bound closeout
already uses. Earlier seconds, a different review, and missing or
invalid timestamps still keep the inferred edge.

Signed-off-by: Duang777 <duangjl007@gmail.com>
Co-authored-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…ssion latest (#8684)

* fix(botmux): do not read provider results for unaccepted dispatches

On a reused botmux session the status read asked the provider for the
session's trigger-result whenever the session held an active dispatch key,
even when that dispatch's local receipt was still `attempting` (crash before
the provider replied) or `rejected`. The session result then describes the
previous, completed turn, so status reported the never-accepted dispatch as
`completed` with `readback_verified: true`, and `--execute` crashed with
"invalid botmux dispatch transition: rejected->completed" (or
attempting->completed), leaving the receipt unresolved forever.

Resolve ATTEMPTING and REJECTED receipts from the local receipt alone, the
same path used when no session exists: attempting is promoted to unknown and
rejected is reported as rejected.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: duang777 <duangjl007@gmail.com>

* fix(botmux): keep a never-accepted unknown dispatch local on repeated status

The first status turned an interrupted attempt into an unknown receipt, but the
next status took the provider path again and, on a reused session, adopted the
previous accepted turn's trigger-result for the new dispatch key: completed and
readback_verified, persisted.

Treat an UNKNOWN receipt that was never QUEUED (an interrupted attempt, a
transport failure or an unverifiable receipt) like ATTEMPTING and REJECTED and
resolve it from the local receipt alone. An UNKNOWN that was QUEUED and only
lost its status read still recovers through the provider.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: duang777 <duangjl007@gmail.com>

* fix(botmux): read the turn a receipt was queued under, not the session's latest

An accepted dispatch was read back with the session's trigger-result, which is
the latest turn of the session. When another client started and finished a
newer turn after this one failed, status reported that turn's completion for
this dispatch: the preview said completed and --execute persisted it.

Ask for the trigger id stored on the receipt and promote a provider state only
when the response names that same id. A response for another turn, one that
names no turn, or a receipt with no stored trigger id is reported as unknown
with unknown_reason trigger_identity_unverified, never as a completion; a
terminal local state is still not overwritten by it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: duang777 <duangjl007@gmail.com>

* fix(botmux): check the turn named by a not_found response too

The identity check skipped not_found, on the reasoning that a missing result
echoes the id it was asked for. A response that names another turn as not_found
was therefore accepted: status reported not_found with that turn's output
attached and --execute persisted a terminal not_found that no later state may
replace, so this request's real completion could never be recorded.

Verify the triggerId of every response for a pinned turn, not_found included.
The bare session-level missing branch (404 unknown_session naming no turn) is
kept as it was; a 404 that does name a turn is checked like any other.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: duang777 <duangjl007@gmail.com>

* fix(botmux): keep only an explicit unknown_session as session-level missing

The exception for a not_found that names no turn accepted any 404 with state
not_found, so a generic 404 with no triggerId could still seal an accepted
receipt as a terminal not_found that no later state may replace.

Treat a response as session-level missing only when it is an explicit
unknown_session naming no turn. A generic 404 not_found, or one naming a turn,
is verified against the request's trigger id like every other response.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: duang777 <duangjl007@gmail.com>

---------

Signed-off-by: duang777 <duangjl007@gmail.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…8735)

#8431 retired the stored activation_state alias and status=stopped as registry
protocol errors. Two Steward tests still wrote those fields and failed with
ProjectRegistryProtocolError; three more passed only because the protocol error
happened to look like a rejection. Write the canonical activation object so each
case exercises the real stopped-Goal path.

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

mergify Bot commented Nov 14, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with codex/c1-work-contract-review-20261107 and cannot be merged
until they are resolved. Please rebase or merge the base branch, @loopx-agent.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/codex/c1-work-contract-review-20261107
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/codex/c1-work-contract-review-20261107 and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 14, 2026
loopx-agent and others added 6 commits November 14, 2026 17:56
…8721)

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…multibyte character (#8681)

* fix(history): skip a run-index row torn inside a multibyte character

The run index is written with ensure_ascii=False, so an interrupted append
can end in a partial UTF-8 sequence. load_index_snapshot decoded every line
with a strict bytes.decode("utf-8"), so one such row raised UnicodeDecodeError
from every reader of that index: history/status collection, the Todo and
refresh-state readers, and the append-side readback of
write_compact_runtime_projection. The append helpers already repair a missing
row delimiter after a torn tail, so new records kept being written behind the
damaged row while nothing could read the index again.

Count an undecodable row as an invalid row (raw_count and invalid_count), the
same way an unparseable JSON row is already handled, and keep reading the
rest of the index. The digest still covers the original bytes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: duang777 <duangjl007@gmail.com>

* fix(history): report a torn run-index row as unreadable quota usage

Skipping a row that is torn inside a multibyte character made history readable
again, but the row can be the spend or void event the quota projection sums:
the projection then returned an exact zero for a Goal that had spent a slot,
where the unpatched reader failed loudly. Count the undecodable rows on the
snapshot and report them through the existing unreadable-event fields, so
quota_status keeps the Goal blocked as it does for any event it cannot read
back, while the intact history stays visible.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: duang777 <duangjl007@gmail.com>

* fix(history): make skipping a torn run-index row an explicit opt-in

Skipping a row cut inside a multibyte character, as the shared reader now did
for every caller, turned a crash into a silent hole: the row may be a spend, a
Vision or a replan ack, and callers that gate a write or an admission (the
projection idempotency scan, human reward, replan write-back, receipt replan
acks, the history export) would proceed on a list that is missing it. The
manager delivery reader reported a known zero for the same reason.

Keep the default strict, as before, and add tolerate_undecodable for a reader
that reports the damage itself. collect_history opts in and flags the Goal's
quota as unreadable; every other caller keeps failing on such a row, and the
manager delivery reader keeps returning unavailable.

Restore the regression test for the shared reader, which the previous commit
dropped by replacing the test file, in its opt-in form, and add tests that the
manager reads stay unavailable.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: duang777 <duangjl007@gmail.com>

* fix(history): keep collect_history strict unless the display opts in

collect_history opted in to skipping an undecodable row for every caller, but
the history conclusion export builds a corpus from it and replaces the previous
generation with what it read: one torn row silently shrank a verified two
document corpus to one. The audit of load_index callers had missed this because
the export reaches the reader through collect_history.

Make tolerate_undecodable a collect_history parameter that defaults to strict
and opt in only from the loopx history display, which shows what remains
readable and reports the Goal's quota as unreadable. The export, the
trajectory-hygiene and evidence-ref projections and the other callers keep
failing on such a row.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: duang777 <duangjl007@gmail.com>

* fix(history): show unreadable index rows in the default history output

The count of rows that could not be decoded reached only the registered Goal's
quota projection, so the default Markdown history of a torn index was byte for
byte the same as one with a healthy duplicate row, and a runtime-only Goal had
no signal at all.

Project the count onto each Goal's history record (unreadable_index_rows, only
when non-zero) and render it in the default output, per Goal and as a warning
that the listing is incomplete. The strict readers keep their failure boundary.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: duang777 <duangjl007@gmail.com>

---------

Signed-off-by: duang777 <duangjl007@gmail.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
* fix(test): verify Dashboard Vite owns the browser smoke port

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

* fix(test): cover research-record search in the Dashboard source lane

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

---------

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
* docs: unify Goal evolution and scalable acceptance contracts

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

* Define lease impact for Goal contract changes

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: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
huangruiteng and others added 4 commits November 14, 2026 18:42
…ty (#8755)

* feat(goals): retain evolving outcome records beyond legacy capacity

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

* docs(goals): explain record migration and review recovery

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

* Reject mistyped outcome records and exercise PostgreSQL migration

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.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>
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: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 14, 2026
@huangruiteng
huangruiteng merged commit 0a8cdf0 into codex/c1-work-contract-review-20261107 Nov 14, 2026
10 of 32 checks passed
@huangruiteng
huangruiteng deleted the codex/c1-antigravity-default-review-20261114 branch November 14, 2026 11:55
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.

3 participants