Skip to content

Validate quota audit references before a staged replan - #8113

Merged
huangruiteng merged 1 commit into
mainfrom
codex/vision-audit-readback
Nov 6, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/vision-audit-readback

Conversation

@loopx-agent

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

Copy link
Copy Markdown
Collaborator

A historical quota decision can carry one full vision audit and refer to it from the frontier or an agent/CLI channel. On main, a staged replan could accept a channel reference saying the goal was done even when the original judge said to continue. The capture had the correct digest and an otherwise usable replan context.

The staged reader now checks these references against the literal audit in the same capture. Matching references preserve the original decision, stop conditions and negative evidence. Conflicting references, unresolved owners and chains are rejected. The display writer uses the same rule, keeps short audits inline, and compares the original numeric values before sharing. It performs this work in the existing display RPC. Unrelated context source rows retain their original positions and contents in the capture, but their bodies stay outside this request.

A regression test first completes a valid staged review, then changes the referenced stop decision, recomputes the source hash and verifies rejection. Main accepted the changed decision. Real File and SQLite CLI checks cover capture, display, recovery and absence of quota spending during the read.

The PR is rebased onto the current main architecture that already owns initial context delivery and goal-acceptance sharing. This slice extends that existing reference_context operation with vision-audit validation instead of restoring a duplicate Python projection path. The earlier review's nullable-value mypy regression is fixed by narrowing the interaction contract, agent channel and work context before filtering source bodies; goal-acceptance rows remain in the scoped request.

Validation on exact head b4d954aa5b3e3fafd644e0d574e2f2fd53fa95d5:

  • uv run --extra test python -m mypy: 17 source files passed.
  • npm run typecheck:control-plane: passed.
  • Vision/audit and four related quota/replan Python suites: 336 passed, including real File and SQLite CLI checks.
  • Six related TypeScript suites: 160 passed.
  • loopx canary premerge --from-git-diff: 13 selected checks passed, with one inherited maintainability advisory in an untouched function.
  • Ruff, Python compile, diff hygiene, public/private scan and the bilingual RFC gate passed.

Remote CI's direct lint failure is inherited from the unchanged tests/test_chat_codex_history.py on main (three F811 findings). The dependent stage2c-correctness-e2e, checks, pytest and merge-gate failures are cascading from that job; the remaining build job was still pending at merge review time.

This slice does not change admission, budget, settlement authority, quota spending or task outcome. It does not establish live-model adoption.

@mergify

mergify Bot commented Nov 5, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main 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/main
# 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>/main 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 5, 2026

@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)

动机 / Motivation

通过 quota 命令读取重规划材料并判断是否继续工作的 Agent。此前保存的引用可携带与根审计相反的 done/decision 而被读者接受;当前 head 在进入重规划前拒绝冲突,正确引用仍能读取。实际 CLI 的 File 和 SQLite 后端拒绝五类哈希正确的坏引用,修正后可恢复有效读取,状态与消费记录不变。本 PR 不改变准入、预算或结算权限,也不证明模型已理解或采用投影材料。

改动思路 / Approach

审计是解释当前目标是否需要继续的完整材料。以已有 inline 根为唯一完整 owner,仅将完全一致的副本变成可回溯引用;不同 channel 仍独立保留。读取阶段验证引用而不是相信 hash 已证明语义,避免矛盾 done 信息绕过 guard。Python 保留 IO,TS 负责投影规则,既有 staged reader 继续负责读阶段。

保持既有 TS 决策 owner 与 Python IO 边界;直接验证正确性,不增加配置、持久状态或新的执行权限。本 PR 只收敛审计引用投影与读取校验;Python 类型收窄仍须修复。本改动不声称 default-off;没有新配置、激活或额外人工确认。实际比较沿用原入口与授权,失败由原调用者修正后重试。说明采用源码链接和正文;没有使用未经验证的渲染图代替执行证据。

具体改动 / Changes

Python 删除重复的审计共享规则,使用既有 TS context owner 完成一次粗粒度投影 RPC,并保留原 source 编号及未识别 source 在本地。TS 根据完整结构和原数值身份决定是否共享:相同的大审计改为根引用,不同 channel、短审计或历史 inline 保持原样。replanView 先确认完整根 owner 与每个引用事实一致,再进入已有 staged reader。测试覆盖真实 guard/capture、数值边界、不同审计、缺 interaction 与无关 source;既有 diagnostic edit lineage 继续承担原索引应用。完整 judge、历史、研究顺序、写回、done/continue 条件仍在根上,引用不是完成证明。

关键代码讲解

规范依据:docs/development/testing-and-quality.md,不可变版本 12803354ab13a003de8620ab496250617224ff37(先读规范,再读实现)。以下是本次评审对原文条款的定位锚点,不是新增协议编号:

  • audit-canonical-owner:implemented,Retain one complete inline audit with judge, history and continuation obligations;由上述 owner 和真实调用反例覆盖。
  • audit-copy-identity:implemented,Only identical copies can be replaced; different channels remain inline;由上述 owner 和真实调用反例覆盖。
  • audit-staged-continuation:implemented,Staged reader must not accept conflicting or unresolved audit references;由上述 owner 和真实调用反例覆盖。
  • audit-complete-detail:implemented,Short or historical inline data and unrelated context sources retain their original meaning;由上述 owner 和真实调用反例覆盖。

另核对 quota-cli-hot-path-compaction、required-work-context 与 goal-vision-replan-contract 的完整审计及继续条件;这些功能条款已验证,静态类型交付缺陷单独阻塞。

对主干的风险 / Risks

[P2] 新增可空字典变量缺少类型收窄,导致原配置 mypy 回归。 在 cli_projection.py 的 552、553 行,contract 与 agent 的类型仍为 Any | None,却直接用于字典解包;682 行又将同样可空的 vision_audit 传给要求 dict 的函数。运行 uv run --extra test python -m mypy,当前 head 报三错;不可变 base 使用同一原配置通过 17 roots。请在既有 adapter 内显式收窄这三个值,保留原检查与配置并重跑,不要用 ignore 或排除文件掩盖问题。

引用功能的独立反例通过:对合法历史重规划输入分别注入 done 冲突、decision 冲突、错误引用、缺根与链式根,并重新计算正确 source hash,原基线均接受,当前 head 均拒绝;随后正确读取可恢复,File/SQLite 的 Goal 状态与索引字节不变,spend 为零。TS 三模块 69 项通过。五个 Python 相关套件是 145 PASS / 10 FAIL,不能称全绿;这十项原有 staged 测试在 base/head 用相同节点重现相同 navigation-envelope 诊断,完整 35004 字节归一化结果 SHA 为 531daa186a99538b846643b01cb77df906859e1f9dea19d4deca568de8c2b12f,保留为已有失败。标准 premerge 的 6 direct + 13 selected 通过,maintainability advisory 保留,但不能覆盖上面的 required mypy 回归,CQR 为 fail。

当前审查基于原 PR base 12803354ab13a003de8620ab496250617224ff37 和 head fbef1f6042cd13f665c23579e7618003c254b0a9,另检查了相关最新 main 的变化。没有抓取、轮询或等待 GitHub CI。独立环境是 source checkout、Python 3.14.8 与 Node 24.21.0;真实后端仍使用合成 fixture,不声明安装包、Windows、Lark 或实际模型采用通过。评审探针准备期间的 fixture 假设错误被修正后重跑;不计为 PR 缺陷,也不据此抹去套件失败。

我的整体评价 / Verdict

长期工作能力 preserved:完整审计与恢复读取保留,矛盾停止信息被拒绝;用户体验 not_yet_proven:局部 CLI 功能改善已验证,但原类型必检失败,完整交付尚未成立。最小修复是 adapter 类型收窄后通过原配置 mypy,并保持现有正负例。已检查 CLI 投影和读者;本次改动 JSON 引用及校验,不改变渲染页面。已安装 App、浏览器与模型理解未执行;本次没有受影响的视觉变更。

删除 Python 重复决策、复用 TS owner 的边界合理,规模与可复现的引用错误相称;当前仍须修复三处类型错误。请求修改基于这个新增回归,不要求本 PR 承担已有 navigation 测试故障。语义词汇复用原 action/audit/reference;没有新 actor 生命周期或权限,semantic diff advisory 通过。上下文存在与回读不证明模型理解、Host 采用、长期净收益或完整成本;这些维度仍未测试。

English verdict: REQUEST_CHANGES — exact head fbef1f6042cd13f665c23579e7618003c254b0a9; fix the three introduced mypy errors, then rerun the unchanged configured check and reference regressions.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@huangruiteng
huangruiteng force-pushed the codex/vision-audit-readback branch from fbef1f6 to b4d954a Compare November 6, 2026 06:29
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 6, 2026

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent | GPT-5 Codex | OpenAI | self_reported

APPROVE. Exact head b4d954aa5b3e3fafd644e0d574e2f2fd53fa95d5 fixes the prior nullable-value mypy regression, keeps the current main reference_context architecture, and rejects conflicting vision-audit references before a staged replan can read them.

动机 / Motivation

读取已捕获 quota decision 的 Agent,需要同时看到当前目标是否完成、还缺哪些证据,以及应继续还是停止。历史 packet 可能只保留一份完整 vision audit,并让 frontier、agent channel 或 CLI channel 通过 projection_ref 引用它。旧显示路径用 Python 值相等生成引用,staged reader 又只校验 capture hash;因此一个 hash 正确、但嵌套 done 或 decision 已被改写的引用,仍可能被当作与完整根审计一致。

同一个 capture 中,修复前只要来源 hash 重算正确,冲突的嵌套停止判断仍可能进入 staged review,代价是 Agent 可能按错误的 done 信息提前收口。修复后,只有能从完整根审计逐字段精确重建的引用才能通过;冲突、缺根和链式引用都在返回 staged context 前失败。完整的历史、judge 指令、负证据和继续条件仍只保留一份。此 PR 不改变 admission、预算、结算权限或实际模型采用,也不重新证明 benchmark 经济收益。

交付判断原文:Agents reading a captured autonomous replan need the same stop and continuation decision in the display packet and staged review. With the same capture and successfully recomputed source hash, a changed nested stop decision no longer survives into staged review; an intact reference resolves to the complete root audit and preserves continuation conditions. Matching audit copies become exact references, conflicting or chained references fail before staged context is returned, and valid File/SQLite reads leave goal state and spend unchanged. This slice does not change admission, budget, quota spending, settlement authority, scoring or live-model adoption.

改动思路 / Approach

入口仍是 quota should-run 的显示压缩,之后由 quota replan-view 读取同一个 captured decision。权威输入是原始 decision、完整顶层 vision_continuation_audit 和 source hash。TypeScript 继续作为审计引用与读取校验的唯一 owner;Python 只负责 provider IO、字段收窄和应用 TypeScript 返回的 display edits。

正向路径是:显示请求在一个既有 reference_context RPC 内生成 exact references,并把无关 source body 留在本地;staged reader 随后从根审计重建期望引用,再决定是否暴露 context。负向路径是:引用与根不一致、根缺失、根本身是引用,或引用形成链时,在 packet/context 暴露前抛错。这样既删除重复的 Python 共享规则,也把“hash 正确”和“语义一致”两个不同事实分开。

与前序审查相比,本次没有恢复旧的 Python project_codex_context 或另造 RPC。rebase 后直接复用 main 的 one-call context 和 goal-acceptance 投影;对 interaction_contract、agent_channel、work_context 做显式类型收窄后,仅发送 task、Explore、goal-acceptance 所需的 source,其他行保留原索引但 body 不进入请求。当前 PR 边界是审计引用与 staged-read 校验,不承担准入或结算策略变更。

架构判断原文:The change removes duplicate Python policy, reuses typed identity and keeps read authority bounded to the original capture. Vision-audit reference sharing and staged-read validation, without changes to admission or settlement.

具体改动 / Changes

完整 diff 为 4 个文件、+440/−82。生产实现 3 个文件;其余是 314 行语义测试。cli_projection.py 净减少约 25 行,删除了 Python 自定义的 audit reference/summary producer;turn_envelope.ts 增加 67 行,用于构造、映射和校验 exact reference。

关键代码讲解

  • visionAuditReference:从完整根审计构造稳定的紧凑引用,只保留可校验的 schema_version、required、decision 与 judge 的 done/decision,并记录两级 projection_ref。
  • requireVisionAuditReferences:遍历 frontier、agent channel 和 CLI channel;每个引用必须从完整 root 精确重建,否则以 typed error 拒绝缺根、冲突或链式引用。
  • replanView:在 capture hash 校验之后、返回任何 staged context 之前执行引用校验,保证冲突信息不会进入后续动作。
  • _reference_context:同一个 RPC 同时处理 goal acceptance 与 vision audit;显式收窄空值并过滤无关 source body,修复前次 review 的 mypy 回归。
  • compact_quota_should_run_cli_payload:把共享规则交给 TypeScript owner,成功后仅给完整根审计补现有 compaction metadata。

规范依据是 controller/executor C1 contract,固定 revision 39770a9604836cc323087f47cd1eb0b8465cda21。C1-VISION-AUDIT-OWNER 要求相同嵌套审计优先使用一份完整 owner 与精确引用,本 head 由 visionAuditReference 和 referenceVisionContinuation 实现;C1-VISION-AUDIT-IDENTITY 要求比较 JSON 类型和全部义务、不同或缺失 owner 不得借用,本 head 由 contextSourceIdentity 与数值边界测试实现;C1-CAPTURE-BOUND-READ 要求读取绑定原 capture、缺失或陈旧引用不能授权工作,本 head 由 replanView 的前置校验和真实 File/SQLite 用例实现。

对主干的风险 / Risks

最强反例是只比较 schema_version、required、decision 等摘要字段,却漏掉 judge 指令、负证据或未来字段;这样不同审计仍可能共享。当前 exact-reference 比较会拒绝任何额外或不同字段,只有完整结构能重建时才会替换;短审计保持 inline,不同 channel audit 保持原样。另一个风险是过滤 source 时漏掉当前投影实际读取的行。实现按现有 active operation 保留 task title、Explore guidance 与 goal acceptance row,并让其他行以 None 保留索引;未知行 body 不会送入 display RPC,但仍保留在原始 capture 中。

每次 staged read 都做结构校验会带来一次有界遍历,但规模只覆盖 frontier 和两个已知 channel,且发生在既有的 capture-bound read 中;没有新增定时任务、持久状态或额外网络往返。include_vision_detail=True 仍走完整 inline 路径,短审计不生成引用,旧 capture 缺 interaction/channel 时不会被制造出新节点。

验证在本机 source checkout 的 exact head 完成。原 review 指出的 mypy 回归已消除:uv run --extra test python -m mypy 通过 17 个 roots;npm run typecheck:control-plane 通过。新增审计引用套件 22 passed,五个相关 Python 套件合计 336 passed,其中真实 File/SQLite CLI 覆盖正确读取、冲突拒绝、状态字节不变和零 spend。六个相关 TypeScript 套件 160 passed。loopx canary premerge 执行 13 项,0 失败;Ruff、py_compile、diff hygiene、public/private scan 和 RFC 双语检查通过。premerge 仍报告一个未触及文件的继承 maintainability advisory,因而作为独立 CI/维护风险保留,不归因于本 diff。审查时新 head 的远端 CI 仍 pending,因此它被记为诊断状态,而不是 green evidence。

语义与 CI 对齐

这里复用既有 vision_continuation_audit、projection_ref、reference_context 和 replan_view,没有新增 enum、actor 生命周期、权限或持久协议。行为变化是有意收紧:hash 正确不等于嵌套引用语义正确;发生冲突时必须 fail closed,并保留原始 capture 供纠正。该规则与 C1 的“一份完整 owner + 精确引用”以及 quota hot-path 的 canonical audit 约定一致。

我的整体评价 / Verdict

goal_achieved 指本次审计引用修复已经闭合:显示路径只共享完全相同的嵌套审计,staged reader 在返回 context 前验证其与完整根一致。long_horizon 为 preserved:完整 judge、历史、负证据、继续条件和原 capture 身份都保留,冲突不再能绕过到后续阶段。user_experience 为 improved:默认 packet 仍只携带一份大审计,失败会明确指向不一致引用而不是给出静默错误状态。没有渲染 UI 变化,visual review 为 not_applicable。

代码体积判定为 necessary:大部分新增是覆盖冲突、数值类型、legacy 缺失和不消费额度等语义边界的测试;生产代码反而删除了 Python 重复实现。复用判断为 reused,语义为 aligned,改动幅度相对可复现的 done/continue 冲突为 proportionate。残余风险只包括未执行 live-model adoption、生产计费/长期 benchmark 经济性和尚未完成的远端 CI;这些不阻断当前 changed invariant 的 APPROVE。

English verdict: APPROVE — exact head b4d954aa5b3e3fafd644e0d574e2f2fd53fa95d5 resolves the prior mypy regression, reuses the current reference_context owner, and validates nested vision-audit references before staged replan reads with focused, related, real-backend and premerge evidence.

@huangruiteng
huangruiteng merged commit 6d42772 into main Nov 6, 2026
22 of 46 checks passed
@huangruiteng
huangruiteng deleted the codex/vision-audit-readback branch November 6, 2026 06:34
huangruiteng added a commit that referenced this pull request Nov 6, 2026
* Recognize direct exec results in the trajectory tool inventory

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
(cherry picked from commit 8e9946d)
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* fix(chat): reject non-string queued input actions

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

* feat(research): compare real captured LoopX request usage

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

* Honor cross-turn delta independently of progressive context

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

* test: isolate machine CLI smokes from model context transport

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

* Honor scoped Todo resume conditions across external and managed schedulers

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

* Audit active solver coverage across every selected benchmark arm

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

* fix(runtime): preserve raw quota JSON for native goal admission

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

* feat(collaboration): share reader guidance and version return formatting

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

* fix(chat): open long returned answers at their beginning

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

* test(lark): verify full versioned returns through body workers

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

* feat(research): compare real captured LoopX request usage

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

* fix(runtime): preserve raw quota JSON for native goal admission

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

* fix(research): show native command cache and output deltas

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

* fix(chat): preserve queue edits when dismissing actions

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

* docs(readme): remove redundant budget disclosure sentence

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

* fix(collaboration): count budgets using persisted return format

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

* fix(research): compare uncached command request shares

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

* fix(context): preserve async reader handles in code-mode guidance

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

* refactor(control-plane): isolate prompt upgrade CLI rendering

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

* test(control-plane): qualify complete continuation decisions

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

* fix(chat): answer exhausted requests through one restricted review

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

* fix(runtime): wait for launchd job removal during service handoff

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

* test(project): make the no-git registry fixture actually degrade the probe

Signed-off-by: Weimr2627 <134630546+Weimr2627@users.noreply.github.com>

* fix(research): distinguish declared retention from verified adoption

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

* fix(doctor): hold every Git read to one budget

`doctor` inspects a checkout the operator may not control, and none of its
six Git reads had a budget: `rev-parse` twice, the metadata runner behind
`git_metadata_for_root`, `merge-base --is-ancestor`, `remote`,
`remote get-url` and `rev-parse --verify`. A repository blocked on a stale
index lock, a network mount or a very large history therefore held the
diagnostic open with no output at all.

Reproduced with a fake `git` on PATH that only sleeps:
`_is_git_worktree_root` was still running after 5s.

All six reads now go through `_run_git`, bounded by
`GIT_PROBE_TIMEOUT_SECONDS`. The helper answers `None` when the budget runs
out, which is the answer every caller already treats as "unknown": root
detection fails closed, metadata fields stay `None`, revision relation stays
`UNKNOWN`, and the trusted release ref is refused. No new failure mode, and
the diagnostic still returns instead of raising.

The same class in `loopx/contract.py` was bounded in #8152.

Signed-off-by: ChengLong GU <88359731+gcl-coder@users.noreply.github.com>

* fix(doctor): retire the probe's own group and keep a stale manifest out

Two gaps the review found in the ten-second budget.

`subprocess.run(timeout=...)` retires the Git leader only. Git starts its
helpers -- fsmonitor hooks, pagers, credential helpers -- inside the group it
runs in, so a blocked `status` left the hook and its child behind and repeated
diagnostics accumulated them. The query now launches in a session of its own,
and an exhausted budget retires that group through the existing
`terminate_process_tree` before dropping the pipes instead of draining them: an
inherited pipe outlives the leader, so a drain would wait on work this call no
longer owns. Reproduced with a `core.fsmonitor` hook that never answers and
keeps a child writing heartbeats -- leader-only kill left it growing, the group
retirement stops it.

`_is_git_worktree_root` answered False both for "there is no Git here" and for
"there is Git here and it did not answer". `release_manifest._source_metadata`
stood an older `release.json` in for the second case, so a checkout at commit B
that carried a manifest claiming A wrote A back as its own source. The two
cases are separate states now, and only a checkout with no `.git` of its own
falls back to the recorded manifest; an unanswered read stays unknown.

Signed-off-by: ChengLong GU <88359731+gcl-coder@users.noreply.github.com>

* fix(doctor): retire the probe's session when the diagnostic is cancelled

The budget covered an exhausted wait, not an interrupted one. Git runs in a
session of its own so the budget can retire its helpers, which also means a
terminal Ctrl-C -- a SIGINT to the process group of the running `doctor` --
never reaches Git. `communicate` raised `KeyboardInterrupt` out of the only
place that owns that session, the diagnostic exited, and the fsmonitor hook
and its child kept running. Repeated cancellations accumulate the same
background work the timeout fix removed.

The wait now retires the owned session on any interrupted exit and re-raises
the original interruption, so an exhausted budget keeps answering "unknown"
while Ctrl-C stays Ctrl-C. Reproduced with the manifest writer CLI, real Git
and a real `core.fsmonitor` hook that keeps a child writing heartbeats:
interrupting the writer's group left the heartbeat growing on the previous
head and stops it now.

Signed-off-by: ChengLong GU <88359731+gcl-coder@users.noreply.github.com>

* fix(chat): retain context-limit failures in pending work

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

* test(collaboration): recover complete per-turn delegation context

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

* fix(lark): hold the collector's Git reads to one budget

Admitting a collector config path asks Git three questions -- whether the
project is a worktree, whether the file is tracked, and whether it is
ignored -- and none of them carried a budget. A Git blocked on a stale index
lock, a network mount or an oversized index therefore held the command open
with no answer at all; reproduced here with a fake `git` on PATH that only
sleeps, where `_project_config_path` was still running after 5s.

The budget alone was not enough: a `TimeoutExpired` would have escaped the
admission check as a traceback, so the refusal paths had to say what "Git did
not answer" means. Acceptance needs proof that the config is ignored and
untracked, so an unanswered probe refuses the path. The three reads share
`GIT_PROBE_TIMEOUT_SECONDS` through `_run_git_probe`, and a Git that exits
non-zero still takes the existing boundary and non-Git fallbacks unchanged.

The queries are local reads that never fan out into helpers, so the
leader-only kill that `subprocess.run` performs covers them.

Signed-off-by: ChengLong GU <88359731+gcl-coder@users.noreply.github.com>

* fix(lark): stop the collector's Git questions together with its budget

Two gaps in the config admission.

The budget ended only the Git leader. Git starts helpers of its own -- an
fsmonitor hook is the common one on `ls-files` -- inside the group it runs in,
so a blocked admission returned its refusal while the hook and its child kept
running, and repeated runs accumulated them. The probe now runs in a session of
its own, and an exhausted budget retires that group through
`terminate_process_tree` before dropping the pipes instead of draining them.

The three questions each carried a fresh budget. Once the tracked query had
timed out the admission could no longer be satisfied, yet `check-ignore` was
still started and spent another full budget on the same hang. The questions now
share one deadline, an unanswered tracked query refuses at once, and a question
asked after the deadline has passed is not started at all.

Signed-off-by: ChengLong GU <88359731+gcl-coder@users.noreply.github.com>

* fix(lark): retire the probe's session when collector-plan is cancelled

The budget covered an exhausted wait, not an interrupted one. The probe runs
in a session of its own so an exhausted budget can retire the helpers Git
started, which also means a terminal Ctrl-C -- a SIGINT to the process group of
the running `collector-plan` -- never reaches Git. `communicate` raised
`KeyboardInterrupt` out of the only place that owns that session, the command
exited, and the blocked Git and its helper kept running. Repeated cancellations
accumulate the same background work the budget fix removed.

The wait now retires the owned session on any interrupted exit and re-raises
the original interruption: an exhausted budget keeps refusing the config,
while Ctrl-C stays Ctrl-C. Reproduced with the `collector-plan` planning entry
in a real child process, real Git and a `git` that blocks the ownership read
with a helper writing heartbeats: interrupting the process group left the
heartbeat growing on the previous head and stops it now.

Signed-off-by: ChengLong GU <88359731+gcl-coder@users.noreply.github.com>

* docs: define router-coordinated controller worker units

Signed-off-by: huangruiteng <huangrt01@163.com>

* fix(chat): compact bounded history before new native turns

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

* docs: prioritize controller attention with safe preemption

Signed-off-by: huangruiteng <huangrt01@163.com>

* fix(runtime): pin qualified service executables behind CLI aliases

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

* docs: make controller worker execution the primary loop

Signed-off-by: huangruiteng <huangrt01@163.com>

* Pin the native first read and deliver the same-Turn selection route (#8100)

* Reuse capture-bound navigation for the first progressive read

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

* Distinguish the pinned reader from an explicit navigation replan

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

* Pin the benchmark preflight view and deliver its same-Turn selection route

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
(cherry picked from commit 47db78b33792e584036b2f099bed4aa0904f7e2b)
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

* Reuse prepared Codex read guidance in benchmark checkpoint prompts

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

* Prove progressive benchmark choices from receiver-visible pages

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

* Deliver the captured review command on the first replan read

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

* Validate progressive replan against its published reader contract

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

* Isolate the user skill directory for native context comparisons

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

* Verify explicit guard opt-out on the real CLI

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

* test(quota): exercise the original review after a successor loses its claim

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

* refactor(context): reuse the quota action vocabulary for staged review

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

* fix(types): widen context delivery source values

Signed-off-by: huangruiteng <huangrt01@163.com>

* refactor(context): make prepared native delivery the sole projection path

Signed-off-by: huangruiteng <huangrt01@163.com>

---------

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: huangruiteng <huangrt01@163.com>
Co-authored-by: huangruiteng <huangrt01@163.com>

* Read saved quota fields in the first native tool call (#8111)

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

* Avoid reparsing unchanged private delivery journals during discovery

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

* Verify captured vision audits and share them in one display request (#8113)

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

* Keep delivery discovery hints in their bounded provider module

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

* Reuse unchanged observed acceptance and preference bodies in native first reads (#8124)

* Reuse observed preference and acceptance fields in native first reads

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

* Plan field reuse inside the existing delivery transaction and qualify invalidation

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

* Type the mixed native delivery request for the kernel contract check

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

* Keep private field observation descriptors typed on both native routes

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

* fix: observe reusable fields inside complete parent reads

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

* test: distinguish progressive defaults from delta opt-out

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: huangruiteng <huangrt01@163.com>
Co-authored-by: huangruiteng <huangrt01@163.com>

* fix(canary): retain current main maintainability baseline

Signed-off-by: huangruiteng <huangrt01@163.com>

---------

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: Weimr2627 <134630546+Weimr2627@users.noreply.github.com>
Signed-off-by: ChengLong GU <88359731+gcl-coder@users.noreply.github.com>
Signed-off-by: huangruiteng <huangrt01@163.com>
Co-authored-by: Weimr2627 <134630546+Weimr2627@users.noreply.github.com>
Co-authored-by: ChengLong GU <88359731+gcl-coder@users.noreply.github.com>
Co-authored-by: huangruiteng <huangrt01@163.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