Skip to content

fix(test): read native policy in first-connect smoke - #8222

Merged
huangruiteng merged 1 commit into
mainfrom
codex/small-kernel-first-connect-reader-20261107
Nov 7, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/small-kernel-first-connect-reader-20261107

Conversation

@cocolord

@cocolord cocolord commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

first-connect-contract-smoke.py decoded native context navigation as if it were the complete policy and failed at ungated["should_run"]. Reuse the existing test-only current-capture reader so the full generic/domain connection and caller-owned first-Todo journey runs with the original CLI arguments and semantic assertions.

The smoke now isolates its temporary runtime namespace and telemetry, restores the caller environment, and retires only authenticated test-owned runtimes before removing their directory. A scoped self-repair pattern distinguishes this intentional native-transport test from machine-output adapters. The existing TypeScript policy and production transport remain the owners; this change is source-checkout validation adaptation.

Validation on the final source:

  • Baseline reproduces KeyError: should_run; the candidate passes all 8 real CLI calls, including 2 native full-navigation responses. CLI arguments remain unchanged and the original main-body AST matches.
  • Standalone native and inline/off smokes pass using synthetic Git/Goals and isolated SQLite. Runtime locators remaining after the controlled runs: 0.
  • Existing current-capture and runtime-cleanup suites: 85 passed, covering full/delta recovery, inline/failed results, digest/reference/symlink rejection and cleanup ownership.
  • A real nonzero CLI command through the same helper still raises CalledProcessError with exit 2; environment and temporary-directory settings are restored.
  • Ruff, changed-file compilation, diff hygiene and the canonical public/private scan pass.

Standard scoped premerge executed 5 direct checks and 19 selected canaries/risk/boundary checks. The initial run passed the 5 direct checks and 18/19 selected checks; the semantic check failed because this clean worktree lacked the TypeScript dev dependency. After npm ci --ignore-scripts, that exact semantic check passed. The original failed aggregate is retained; these combined results do not assert a new green aggregate, remote CI, review readiness, or merge authority. Goal change-quality qualification is disabled by its current policy.

Bounded refactoring applied: reuse the established reader and cleanup owner rather than duplicate recovery or runtime authority. This completes this first-connect validation repair proposal; review/CI and the remaining small-kernel acceptance, adoption and performance qualification stay open.

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

@loopx-agent loopx-agent 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: actor_kind=model_agent; model=gpt-6.1-sol; provider=OpenAI; declaration_source=runtime_reported; reasoning_effort=max.

动机 / Motivation

维护首次项目连接验证的贡献者,需要确认新 Goal 可直接选择自己的首个工作。 native 输出开启时,旧 smoke 把 capture 导航当作策略并在 should_run 处退出;本 head 恢复完整连接与首个 Todo 的断言。 真实 CLI 的 generic/domain 连接、无自动 onboarding gate 及自有首个 Todo 选择均通过;生产准入规则没有被修改。 本 PR 修复源码验证入口,不声明安装态 Host、真实模型采用或完整 Goal 的效果和成本资格。

我在不可变基线 9d276f6cb903ac1bbd465bf60ad4f04b295c5c43 运行原 smoke,实际复现 KeyError: should_run;随后在当前 head db1f0c5e0749bf1bc071857a07f6bda8055c916a 验证整个旅程。这里的 capture 是同一次 CLI 调用保存的完整策略,导航只给出读取位置,不能据其 ok 推断执行资格。这次修复有实际验证价值:让原有首次连接验收继续工作,并没有把消除报错当成产品收益。

规格依据是 docs/development/good-smokes.md,spec_revision 9d276f6cb903ac1bbd465bf60ad4f04b295c5c43,结合既有 first-connect canary 与修改前的语义断言。逐项核对:shipped-cli-boundary 对应真实连接/首个 Todo;reuse-harness 对应既有 reader 和清理 owner;telemetry-and-cleanup 对应临时命名空间、关闭遥测和确定性回收。这三个要求均有当前实际执行支持。

改动思路 / Approach

保留生产 CLI、TypeScript 策略和原始参数,只把 smoke 的解码接到已有 read_cli_policy_payload。没有采用关闭 native 输出来绕过问题,也没有复制一套 recovery 或修改 Core 准入规则。reader 验证本次完整恢复来源;这是测试观测,不是模型已经读完、采用或获得权限的证明。

路径 基线 当前 head
native 输出 在 should_run 断言前报错 8 次真实 CLI,含 2 次 native full 导航,原断言完成
显式 off/inline 8 次 CLI 完成 8 次 CLI 完成
非零 CLI/清理失败 原错误语义必须保留 exit 2 仍抛异常;清理失败时也恢复调用方环境

运行生命周期复用 stop_disposable_effect_runtimes:把所有子进程的临时资源限制在本次 fixture,先按既有身份验证规则停止自有 runtime,再移除目录。安装、locator 可见或 reader import 均不是激活能力;产品的 context delivery 开关和调度权威保持原样。

具体改动 / Changes

完整 diff 只有 examples/project/first-connect-contract-smoke.py 与 skills/loopx-self-repair/references/repair-patterns.md。run_cli 仍通过当前解释器执行原 CLI,check=True 保留非零退出;返回值改由既有 reader 解读。_isolated_runtime 暂存并恢复 TMPDIR/TEMP/TMP/遥测设置与 tempfile 状态,异常路径用嵌套 finally 保持恢复。main 只增加隔离 context manager;我移除该 wrapper 后比较 AST,原业务断言与 CLI 参数语句一致。

新增修复条目明确区分“有意测试 native 导航的源码消费者”和“需要 inline machine output 的宿主适配器”,避免用同一条修复建议改变两个不同边界。原 generic/domain 连接均检查没有注入 onboarding 工作、没有额外 user gate;调用方自己的首个 Todo 能正常选中,状态文件还单独读回。

独立执行:当前 reader/runtime-cleanup 两模块 85 passed;真实 native 与 off 旅程均 8 次 CLI 通过;非法命令仍产生 CalledProcessError、exit 2;故意令清理 helper 报错后,环境与已初始化的 tempfile 状态仍恢复。最初辅助 probe 在 base/head 都因标准库首次初始化 tempdir 缓存而失败,原日志保留;修正快照时机后重新完整运行,并未删除产品断言或把首次失败改写为通过。

对主干的风险 / Risks

主要风险是误把导航成功当作准入、读取旧 delta、放宽来源验证或停止不属于测试的进程。实现将这些决定留给已有 reader 和清理 owner,85 项现有边界测试覆盖损坏引用、full/delta/inline/失败以及 cleanup 所有权;真实 CLI 证据补上了仅 helper 测试无法证明的调用链。模块直接从当前 checkout 导入,与这个源码资格入口一致;不把此烟测声明成 wheel 的独立分发能力。

默认 17 个 Mypy 入口、TypeScript typecheck、改动 Ruff、编译/diff/公开边界检查均通过。标准 premerge 的 5 项直接检查和 19 项选择检查机械通过,整体当时因缺少当前质量 receipt held。另行执行必检 Ruff,在 base/head 得到逐字段一致的既有 F841(tests/control_plane/test_goal_create_completion.py:184),致因文件和配置未改。本轮继续保留该 required failure 与严格质量 hold,不以基线归因把它标绿。未查询或等待远端 CI。

我的整体评价 / Verdict

APPROVE 当前精确 head 的代码变更。独立验收支持它恢复一个原本损坏且有实际调用方的源码验证入口;复用现有 owner、保持全部语义断言和显式失败,比改生产策略或关闭 native 资格更合适。没有发现本变更引入的阻塞问题;required Ruff 和 change-quality 的合并 hold 单列保留,批准不授予 merge。

本次只改源码 smoke 与修复参考表,不改产品页面;已核对 examples/project/first-connect-contract-smoke.py 的实际调用边界。安装态 Host 和真实模型不属于本片资格。无需画面验收,也没有据测试数或保存回执宣称模型采用、长期效果、费用改善或完整 Goal 完成。

English verdict: APPROVE — db1f0c5e0749bf1bc071857a07f6bda8055c916a. The real native first-connect journey is restored with original CLI arguments and semantic assertions; inline/off, reader integrity, cleanup ownership and failure propagation are verified. The unchanged required Ruff failure and strict quality/merge hold remain.

@huangruiteng
huangruiteng merged commit f74b1d4 into main Nov 7, 2026
18 of 23 checks passed
@huangruiteng
huangruiteng deleted the codex/small-kernel-first-connect-reader-20261107 branch November 7, 2026 07:29
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