Skip to content

perf(control-plane,heartbeat): slim interaction contract and isolate CLI output probes - #9506

Open
loopx-agent wants to merge 2 commits into
mainfrom
codex/s1-heartbeat-brief-interaction-slim-20261127
Open

loopx-agent wants to merge 2 commits into
mainfrom
codex/s1-heartbeat-brief-interaction-slim-20261127

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Summary

  • Heartbeat brief metadata & public probe host isolation:
    • Add shared isolated_probe_host_env() in tests/control_plane/cli_output_fixture.py and apply it in examples/control_plane/cli-output-probe-runner.py and examples/control_plane/cli-output-budget-regression-smoke.py so real host credentials/env vars (HOME, USERPROFILE, CODEX_HOME, etc.) do not leak ambient external_evidence_poll state into isolated public qualification fixtures (preventing false +807–+1,399 char bloat on heartbeat_prompt_brief/json and quota_should_run).
    • Prune duplicated non-command top-level metadata (material_queue_rule, permission_rule, agent_profile, registered_agents, reward_memory_enabled) in loopx/control_plane/heartbeat/builder.py (_prune_prompt_metadata(brief=True)), preserving markdown generator diagnostics, command routes, and agent-consumed policy prose (-416 JSON chars on long-path fixtures).
  • Interaction contract & progressive required-context slimming (TS):
    • Update loopx/control_plane/quota/progressive_context.ts to include optional basis_digest in the agent_review known(...) allowlist so mature outcomes retain deferLargeHistoricalOutcomes eligibility instead of bypassing deferral on newer outcome reviews; defer large manager.context_inbox.unfinished_delegations.items (>= 2048 B) covered by required_reads (extending requiredInboxReads to recovery reads as well) and defer non-Explore historical writeback_results, measurement_feedback, and authoring boilerplate (>= 1024 B) under supporting_material_pointer and unread_context_index.pointers.
    • Extend loopx/control_plane/quota/turn_envelope_scoping.ts (compactRoutineSettlementPlan / compactExploreBoilerplateForNonExploreTurn) so non-Explore recovery and vision_continuation_audit turns compact matched explore.turn_context.graph static authoring boilerplate cleanly when detail mode is not requested.

Verification (4cf9821679, rebased on origin/main@6915df67db)

  • npm run typecheck:control-plane: 0 errors
  • TypeScript tests (progressive_context, turn_envelope_scoping, turn_envelope, context_selection, context_delivery, explore_turn_context, collaboration_turn_context): 182 passed, 0 failed, 0 skipped
  • Python pytest (-n 4 across 10 suites: test_heartbeat_brief_budget, test_heartbeat_prompt_support, test_host_bootstrap_lifecycle, test_cli_output_budget, test_quota_context_reference_owner, test_quota_cli_projection, test_scoped_turn_envelope_cli, test_turn_host_decision_capture, test_unsettled_recovery_admission_bound, test_complete_turn_decision): 587 passed, 1 skipped (Windows depth-12 temp layout skip on macOS)
  • examples/control_plane/cli-output-base-head-differential-smoke.py: ok (base_ref=6915df67db6a8836df344a661f295006873a3ba8, base=98, candidate=98, candidate_only=0, review_required=1 for removed duplicate agent_profile paths)
  • examples/control_plane/cli-output-budget-regression-smoke.py: ok
  • ruff check on changed Python files: 0 issues; repo strict mypy (17/17 configured files): clean
  • Change quality receipt cqr_8354217b8cad379dd921 (decision=pass, status=valid) & loopx canary premerge --tier standard: 6/6 direct + 1/1 compile + 6/6 catalog + 8/8 risk + 1/1 public boundary passed (failures=0, manual_holds=0)

…CLI output probes

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.2-sol · OpenAI · runtime_reported · xhigh

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

[P2] 长路径预算 smoke 仍受继承的 GitHub 配置影响。传入合成 GH_TOKEN 或指向合成 hosts.yml 的 GH_CONFIG_DIR,候选在 isolated_probe_host_env 内仍探测到 external_evidence_poll,添加 pr_review_pre_quota_command。两种输入都使同一个 CLI fixture 从 10,728 增至 11,535 字符,触发预算失败。base 分别为 11,144 和 11,951 字符,也同样受到环境影响。 在预算 fixture 中隔离 capability_probe 实际读取的四个 GitHub token 变量和 GH_CONFIG_DIR、XDG_CONFIG_HOME、APPDATA,或让这个与宿主无关的 fixture 显式禁用自动探测。用非空合成认证来源补齐反例,要求同一 fixture 的命令与预算结果一致。 源码

动机 / Motivation

缩小 heartbeat brief 与初始上下文开销,同时维持可回读的审阅、结算和 Explore 操作。 同一 brief 有五个重复 metadata 字段,历史接受条件、Explore 说明和 Inbox 明细给首读增加输入。预算样本也会受本机认证能力探测影响。 维护 heartbeat 的 agent、调用上下文读取的 host,以及依赖输出预算 smoke 的维护者。

环境变量会让同一提交在已认证构建机上更难重现测试结果,预算失败也会被错误归因给产品正文。 固定同一长路径 fixture 和干净子进程环境,brief JSON 从 base 11,144 字符降到 head 10,728 字符。真实 base/head budget smoke 通过。progressive context、Turn envelope、context selection 的 117 项通过。 干净 Git checkout 的预算 smoke 通过。117 项 TS 通过,定向 Python 15 通过、1 跳过;对相同长路径运行 base/head 与三个环境输入。 独立运行了干净 Git checkout 的完整预算 smoke、定向 TS 与真实 CLI。Python 定向 15 通过、1 跳过(当前主机的原有 depth-12 临时目录用例)。认证输入均为合成值,未连接 GitHub 或测试真实认证。托管 CI 未查询。 验收契约

改动思路 / Approach

该改动沿用 heartbeat-prompt --brief、quota should-run/首读、现有 captured detail 与公开预算 smoke。复用既有首读和原 capture 导航。历史材料在选定节点展开。将环境隔离留在公开 fixture,正常 host 保持自身能力探测。 当前实现只重定向 HOME、USERPROFILE 并清掉三个 host 变量。capability_probe 还会优先读其自身的 token 与配置路径列表。 在预算 fixture 中隔离 capability_probe 实际读取的四个 GitHub token 变量和 GH_CONFIG_DIR、XDG_CONFIG_HOME、APPDATA,或让这个与宿主无关的 fixture 显式禁用自动探测。用非空合成认证来源补齐反例,要求同一 fixture 的命令与预算结果一致。

具体改动 / Changes

精确提交 4cf9821,本次对照目标 6915df6。9 文件 +457/−29。运行时集中在 Python brief metadata 与两处 TS 投影。其余为两份 smoke、隔离 helper 和预算、选择及恢复测试。

关键代码讲解

  • isolated_probe_host_env。测试环境的进出边界。它仍继承 GitHub 能力探测的专用输入。 源码

  • _prune_prompt_metadata。brief 去掉重复字段,保留命令和正文。 源码

  • progressiveContextPlan。将较大的 Inbox 列表和普通 Turn 的 Explore 材料放到可回读节点。 源码

  • compactExploreBoilerplateForNonExploreTurn。拓宽普通审计和未结算恢复的 Explore 静态说明压缩范围。 源码

  • deterministic-public-cli-budget(not_met)。固定版本与输入的公开 CLI 输出预算独立于调用机 GitHub 登录来源,保留必需的首读与回读操作。

对主干的风险 / Risks

传入合成 GH_TOKEN 或指向合成 hosts.yml 的 GH_CONFIG_DIR,候选在 isolated_probe_host_env 内仍探测到 external_evidence_poll,添加 pr_review_pre_quota_command。两种输入都使同一个 CLI fixture 从 10,728 增至 11,535 字符,触发预算失败。base 分别为 11,144 和 11,951 字符,也同样受到环境影响。 带认证环境仍会产生 807 字符额外输入,改变预算验收。运行时 deferral 定向行为通过。 在预算 fixture 中隔离 capability_probe 实际读取的四个 GitHub token 变量和 GH_CONFIG_DIR、XDG_CONFIG_HOME、APPDATA,或让这个与宿主无关的 fixture 显式禁用自动探测。用非空合成认证来源补齐反例,要求同一 fixture 的命令与预算结果一致。

我的整体评价 / Verdict

REQUEST_CHANGES。 payload 瘦身已验证,公开预算样本的宿主认证隔离仍有缺口。 输出预算应测量相同消费契约,稳定区分真实输入成本变化与执行环境变化。

English verdict: REQUEST_CHANGES at 4cf9821. The clean fixture is smaller and passes. A synthetic GH_TOKEN or GH_CONFIG_DIR still adds 807 characters after isolation and fails the same long-path brief budget. Isolate the capability probe inputs in the fixture.

…xtures

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.2-sol · OpenAI · runtime_reported · xhigh

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

动机 / Motivation

缩小 heartbeat brief 与初始上下文开销,同时维持可回读的审阅、结算和 Explore 操作。 同一 brief 有五个重复 metadata 字段,历史接受条件、Explore 说明和 Inbox 明细给首读增加输入。预算样本也会受本机认证能力探测影响。 维护 heartbeat 的 agent、调用上下文读取的 host,以及依赖输出预算 smoke 的维护者。

环境变量会让同一提交在已认证构建机上更难重现测试结果,预算失败也会被错误归因给产品正文。 同一长路径 CLI fixture 的 clean 与七种合成认证来源全为 10,728 字符,并且均未生成 PR pre-quota 命令。进入隔离前,带每一种合成来源的探测都能识别 evidence polling。隔离作用于测试输入,独立配对观测覆盖旧头的失败与候选恢复。 完整公开 CLI 预算 smoke 在合成 token 输入下通过,含精确 base/head 配对。正常和恢复上下文等 TS 182 项通过,10 组 Python 测试 594 通过、1 跳过,控制面 typecheck 与定向 lint 通过。 隔离本地测试、合成认证来源与真实 CLI 输出。没有使用真实认证来制造反例,也没有查询托管 CI。当前主机跳过 Windows 深临时路径的既有用例。 验收契约

改动思路 / Approach

该改动沿用 heartbeat-prompt --brief、quota should-run/首读、现有 captured detail 与公开预算 smoke。CLI 仍由同一 bootstrap 与 Turn body owner 负责。上下文先由 typed 校验,压缩只改变 delivery projection。测试通过一个 context manager 固定 host probe 输入。 保留 brief task_body、再生成命令及适用的证据路径。把有接续读取入口的历史材料放入同一 capture 的 pointer,普通 Explore 语义由原 capability owner 继续管理。测试 helper 只改进当前进程的隔离,恢复原环境。 在预算 fixture 中隔离 capability_probe 实际读取的四个 GitHub token 变量和 GH_CONFIG_DIR、XDG_CONFIG_HOME、APPDATA,或让这个与宿主无关的 fixture 显式禁用自动探测。用非空合成认证来源补齐反例,要求同一 fixture 的命令与预算结果一致。

具体改动 / Changes

精确提交 62d37be,本次对照目标 6915df6。9 文件 +550/−29。整体实现为两个 TS 投影裁剪、Python brief 元数据与两个 public smoke 路径。相对前次精确评审,新增代码只在 Python 测试 helper 和其回归矩阵。

关键代码讲解

  • isolated_probe_host_env。隔离四个 token 和三个配置路径,fixture 结束时恢复原环境。 源码

  • _prune_prompt_metadata。brief 去掉重复顶层字段,保留 task_body 与入口命令。 源码

  • progressiveContextPlan。延后符合条件的 Inbox 和 Explore 材料,保留同一 capture 指针;required recovery read 仍可达。 源码

  • compactExploreBoilerplateForNonExploreTurn。只在与 Explore 无关且无待 replan 的常规审计或未结算恢复中裁剪匹配的静态模板。 源码

  • deterministic-public-cli-budget(implemented)。固定版本与输入的公开 CLI 输出预算独立于调用机 GitHub 登录来源,保留必需的首读与回读操作。

对主干的风险 / Risks

精确前一候选的同一 fixture 在四个 token 变量与三个 hosts.yml 路径输入下都增至 11,535 字符,预算拒绝,clean 为 10,728。新头隔离与还原这七项输入。定向回归也覆盖无需 Explore 的上下文逐段回读、正常的 Explore 与有要求的材料不被简单丢弃。 短 JSON 的变化包括已披露的重复顶层元数据裁剪。运行时授权与测试 fixture 的探测隔离分别沿各自入口核验。 在预算 fixture 中隔离 capability_probe 实际读取的四个 GitHub token 变量和 GH_CONFIG_DIR、XDG_CONFIG_HOME、APPDATA,或让这个与宿主无关的 fixture 显式禁用自动探测。用非空合成认证来源补齐反例,要求同一 fixture 的命令与预算结果一致。

我的整体评价 / Verdict

APPROVE。 上轮的宿主环境耦合已修复。七种合成来源和 clean 均回到同一真实 CLI 体积,首读和后续材料回读回归通过。 输出预算应测量相同消费契约,稳定区分真实输入成本变化与执行环境变化。

English verdict: APPROVE at 62d37be. All seven synthetic GitHub auth sources now match the clean long-path brief at 10,728 characters. The public budget and progressive context checks passed.

This branch has not been deployed

No deployments
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.

1 participant