From 5f25742873867eb4e4f142327a2685ea8ca3cd27 Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Sat, 21 Nov 2026 03:46:34 +0800 Subject: [PATCH] fix(release): stabilize CLI help, architecture guards, onboarding gate, and public smokes Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- .github/workflows/full-public-smokes.yml | 10 ++++----- .github/workflows/package-smoke.yml | 2 +- README.ja.md | 2 +- README.md | 2 +- README.zh-CN.md | 4 ++-- docs/architecture/rfcs/STATUS.md | 2 +- docs/architecture/rfcs/STATUS.zh-CN.md | 2 +- .../2026-11-19-core-discovery-checkpoint.md | 9 ++++++++ ...6-11-19-core-discovery-checkpoint.zh-CN.md | 9 ++++++++ .../rfcs/monorepo-distribution-split-v0.md | 8 +------ .../monorepo-distribution-split-v0.zh-CN.md | 8 +------ docs/concepts/interaction-pattern-catalog.md | 8 ++++++- .../goal-vision-replan-contract-smoke.py | 4 ++-- .../public_entry/readme-demo-surface-smoke.py | 10 +-------- loopx/bootstrap_command_pack.py | 2 ++ .../native_chat/github_pr_evidence.py | 16 ++++++++------ .../native_chat/steward_monitor.py | 10 +++++---- loopx/chat_action_normalization.py | 7 +++--- loopx/cli_runtime.py | 10 +++++++-- .../testing/doubao_model_behavior_actor.py | 9 +++++--- .../extensions/lark/goal_channel_operation.py | 4 +--- loopx/presentation/goal_storage_api.py | 5 ++--- .../goal_instance_binding_inventory_v1.json | 2 +- scripts/semantic_incident_retrodiction.py | 22 +++++++++++++++---- ...actual_default_model_behavior_portfolio.py | 2 ++ ..._doubao_onboarding_model_behavior_actor.py | 7 ++++++ .../test_start_goal_compact_projection.py | 7 ++++++ 27 files changed, 115 insertions(+), 68 deletions(-) create mode 100644 docs/architecture/rfcs/ledger/monorepo-distribution-split-v0/2026-11-19-core-discovery-checkpoint.md create mode 100644 docs/architecture/rfcs/ledger/monorepo-distribution-split-v0/2026-11-19-core-discovery-checkpoint.zh-CN.md diff --git a/.github/workflows/full-public-smokes.yml b/.github/workflows/full-public-smokes.yml index b8914525b4..ec0ef531eb 100644 --- a/.github/workflows/full-public-smokes.yml +++ b/.github/workflows/full-public-smokes.yml @@ -60,15 +60,15 @@ jobs: - shard: 0 offset: 0 - shard: 1 - offset: 110 + offset: 80 - shard: 2 - offset: 220 + offset: 160 - shard: 3 - offset: 330 + offset: 240 - shard: 4 - offset: 440 + offset: 320 env: - SHARD_LIMIT: "110" + SHARD_LIMIT: "80" SMOKE_TIMEOUT_SECONDS: ${{ github.event_name == 'workflow_dispatch' && inputs.timeout_seconds || '360' }} SMOKE_JOBS: "4" steps: diff --git a/.github/workflows/package-smoke.yml b/.github/workflows/package-smoke.yml index d130915e13..98bbda34a4 100644 --- a/.github/workflows/package-smoke.yml +++ b/.github/workflows/package-smoke.yml @@ -47,7 +47,7 @@ jobs: python-version: "3.11" - uses: actions/setup-node@v6 with: - node-version: "26.0.0" + node-version: "24" - uses: astral-sh/setup-uv@v7 - name: Prepare source validation environment run: uv sync --extra test diff --git a/README.ja.md b/README.ja.md index c207e24b2c..8382eccc47 100644 --- a/README.ja.md +++ b/README.ja.md @@ -135,7 +135,7 @@ LoopX は、次のようなものを実行するときに役立ちます: - 進捗がエンジニアではないオペレーターにも理解できる状態でなければならない、 クリエイター、研究、運用のワークフロー -危険な権限、 +LoopX は自律的な本番コントローラーではありません。危険な権限、 公開、本番環境への書き込み、最終的なオーナーシップは人間に残ります。 diff --git a/README.md b/README.md index 3318276e50..7bfbe888b1 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,7 @@ LoopX is useful when you run: - creator, research, or operations workflows whose progress must remain legible to a non-engineering operator. -Dangerous permissions, +LoopX is not an autonomous production controller. Dangerous permissions, publishing, production writes, and final ownership stay with the human. diff --git a/README.zh-CN.md b/README.zh-CN.md index bb62a0397b..2681d8c233 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -122,7 +122,7 @@ LoopX 适合: - 需要 ownership、lease 和 handoff 的平级 agent team; - 需要把进展、阻塞和反馈入口清晰呈现给非技术用户的创作、研究或运营工作。 -危险权限、生产写入、公开发布和最终 ownership +LoopX 不是生产自动化控制器。危险权限、生产写入、公开发布和最终 ownership 仍由人类负责。 @@ -351,7 +351,7 @@ loopx doctor Benchmark 之外,LoopX 也有可检查的长程项目证据。 OpenViking 的公开贡献序列跨越 **200+ 小时自然时长**,保留多轮 Todo、决策和证据更新。这里衡量的是项目经过的 -wall-clock 时间。点击原图查看 +wall-clock 时间,不是连续模型执行时长或无人值守的生产自治。点击原图查看 公开安全的任务图、证据分支和跨轮决策;案例说明了来源与可复现边界。 ### 开源 Issue Fix diff --git a/docs/architecture/rfcs/STATUS.md b/docs/architecture/rfcs/STATUS.md index f3409dcff3..6c9d70b41c 100644 --- a/docs/architecture/rfcs/STATUS.md +++ b/docs/architecture/rfcs/STATUS.md @@ -59,7 +59,7 @@ appendix may keep dated history, but no dated log heading may precede it. | [LoopX Overall Roadmap v0: Product, Collaboration, Technology and Delivery](loopx-overall-roadmap-v0.md) | Accepted | none | [4 entries](ledger/loopx-overall-roadmap-v0/) | | [Manager runtime profile v0](manager-runtime-profile-v0.md) | Accepted | none | — | | [RFC: Mechanism Convergence and the Experience Reuse Loop (v0)](mechanism-convergence-and-learning-loop-v0.md) | Accepted | none | — | -| [RFC: Monorepo Distribution and Small-Kernel Runtime Composition (v0)](monorepo-distribution-split-v0.md) | Accepted | none | — | +| [RFC: Monorepo Distribution and Small-Kernel Runtime Composition (v0)](monorepo-distribution-split-v0.md) | Accepted | none | [1 entry](ledger/monorepo-distribution-split-v0/) | | [RFC: Obelisk Session Evidence Provider v0](obelisk-session-evidence-provider-v0.md) | Accepted | none | — | | [RFC: Agent Judgment and Optional Independent Assessment — Jev as a Candidate (v0)](optional-semantic-assistance-jev-v0.md) | Accepted | none | — | | [RFC: Post-Outcome Memory Utility Attribution v0](post-outcome-memory-utility-attribution-v0.md) | Accepted | none | — | diff --git a/docs/architecture/rfcs/STATUS.zh-CN.md b/docs/architecture/rfcs/STATUS.zh-CN.md index cd61d9c972..2c662480d1 100644 --- a/docs/architecture/rfcs/STATUS.zh-CN.md +++ b/docs/architecture/rfcs/STATUS.zh-CN.md @@ -56,7 +56,7 @@ | [LoopX 整体路线总纲 v0:产品、协作、技术与交付](loopx-overall-roadmap-v0.zh-CN.md) | 已接受 | 无 | [4 条](ledger/loopx-overall-roadmap-v0/) | | [Manager runtime profile v0 / 管家运行模式 v0](manager-runtime-profile-v0.zh-CN.md) | 已接受 | 无 | — | | [RFC:机制收敛与经验复用闭环(v0)](mechanism-convergence-and-learning-loop-v0.zh-CN.md) | 已接受 | 无 | — | -| [RFC:Monorepo 发行拆分与小内核运行时装配(v0)](monorepo-distribution-split-v0.zh-CN.md) | 已接受 | 无 | — | +| [RFC:Monorepo 发行拆分与小内核运行时装配(v0)](monorepo-distribution-split-v0.zh-CN.md) | 已接受 | 无 | [1 条](ledger/monorepo-distribution-split-v0/) | | [RFC:Obelisk Session Evidence Provider v0](obelisk-session-evidence-provider-v0.zh-CN.md) | 已接受 | 无 | — | | [RFC:Agent 判断与可选独立评估——以 Jev 为候选方案(v0)](optional-semantic-assistance-jev-v0.zh-CN.md) | 已接受 | 无 | — | | [RFC:结果后记忆效用归因 v0](post-outcome-memory-utility-attribution-v0.zh-CN.md) | 已接受 | 无 | — | diff --git a/docs/architecture/rfcs/ledger/monorepo-distribution-split-v0/2026-11-19-core-discovery-checkpoint.md b/docs/architecture/rfcs/ledger/monorepo-distribution-split-v0/2026-11-19-core-discovery-checkpoint.md new file mode 100644 index 0000000000..8c94ca203d --- /dev/null +++ b/docs/architecture/rfcs/ledger/monorepo-distribution-split-v0/2026-11-19-core-discovery-checkpoint.md @@ -0,0 +1,9 @@ +# Core discovery checkpoint — 2026-11-19 + +Moved without content change from [monorepo-distribution-split-v0.md](../../monorepo-distribution-split-v0.md) (former section "Core discovery checkpoint — 2026-11-19") on 2026-11-21; RFC baseline `dcf208c855`. Checkpoint records live in this execution ledger (extending Appendix A), not in the RFC body. + +| Boundary | Delivered delta / evidence | Still open | +| --- | --- | --- | +| V1/V3, capability discovery | Benchmark package exports resolve their selected existing owner on demand, retaining all 199 public symbols and their order; explicit star imports still request all. Help/list/detail succeed with benchmark execution implementations unavailable, no Node, process launch, network or state writes. | Does not remove benchmark files from the wheel or qualify absent-capability installation. | +| Metadata and active consumers | The same catalog and all 25 details are byte-identical to the frozen `main@e235cde9c` workload; 53 CLI help/list/detail/unknown-id observations match. Discovery loads 2 benchmark children instead of 28, and 298 LoopX modules instead of 326. Existing benchmark semantics and canonical export identities remain unchanged. | Import counts are not latency, total cost, model benefit or full D2/D5 closure. | +| Acceptance and continuation | 52 installed-core discovery/execution/context/recovery cases pass on the rebuilt artifact; 383 selected consumer cases and 43 architecture/documentation cases pass separately. No new state owner, provider id, activation toggle or top-level module. | Keep R1/M3 and V1–V5/V10 open; continue capability package isolation and selected Standard delivery. Public-channel C1 qualification remains with its release owner. | diff --git a/docs/architecture/rfcs/ledger/monorepo-distribution-split-v0/2026-11-19-core-discovery-checkpoint.zh-CN.md b/docs/architecture/rfcs/ledger/monorepo-distribution-split-v0/2026-11-19-core-discovery-checkpoint.zh-CN.md new file mode 100644 index 0000000000..235aba17ae --- /dev/null +++ b/docs/architecture/rfcs/ledger/monorepo-distribution-split-v0/2026-11-19-core-discovery-checkpoint.zh-CN.md @@ -0,0 +1,9 @@ +# Core 发现入口检查点 — 2026-11-19 + +于 2026-11-21 从 [monorepo-distribution-split-v0.zh-CN.md](../../monorepo-distribution-split-v0.zh-CN.md)(原小节“Core 发现入口检查点 — 2026-11-19”)原文移入,内容未改;RFC 基线 `dcf208c855`。检查点记录放在本执行台账(延续附录 A),不放在 RFC 正文。 + +| 边界 | 交付增量/证据 | 仍未完成 | +| --- | --- | --- | +| V1/V3,能力发现 | Benchmark 包公开符号按需解析到所选既有 owner,保留全部 199 个符号及顺序;显式星号导入仍请求全部。执行实现不可用且无 Node 时,帮助/列表/详情仍可用,无进程启动、网络或状态写入。 | 未从 wheel 删除 benchmark 文件,也不验收 capability 分包缺席安装。 | +| 元数据与活跃调用方 | 同冻结 `main@e235cde9c` workload 的目录和全部 25 项详情逐字节一致;53 项 CLI 帮助/列表/详情/未知 id 观察一致。发现入口的 benchmark 子模块从 28 降到 2,LoopX 模块从 326 降到 298。保留 benchmark 语义及公开符号的 canonical 对象身份。 | Import 数量不代表时延、完整成本、模型收益或完整 D2/D5 闭包。 | +| 验收与继续方向 | 重建发行物通过 52 项安装 core 发现/执行/上下文/恢复用例;383 项所选消费方与 43 项架构/文档用例分别通过。没有新增状态 owner、provider id、启用开关或顶层模块。 | R1/M3 与 V1–V5/V10 继续开放;下一步仍是 capability 分包隔离与所选 Standard 交付。公开渠道 C1 资格仍归既有 release owner。 | diff --git a/docs/architecture/rfcs/monorepo-distribution-split-v0.md b/docs/architecture/rfcs/monorepo-distribution-split-v0.md index 67ca1a7af9..8edc633f3d 100644 --- a/docs/architecture/rfcs/monorepo-distribution-split-v0.md +++ b/docs/architecture/rfcs/monorepo-distribution-split-v0.md @@ -660,13 +660,7 @@ moves; it does not qualify the kernel. R3/R4 are optional and do not block a qualified CLI or managed task. No unused provider, field or framework is added ahead of its real caller. Report the applied/deferred adjacent refactor in each PR. -### Core discovery checkpoint — 2026-11-19 - -| Boundary | Delivered delta / evidence | Still open | -| --- | --- | --- | -| V1/V3, capability discovery | Benchmark package exports resolve their selected existing owner on demand, retaining all 199 public symbols and their order; explicit star imports still request all. Help/list/detail succeed with benchmark execution implementations unavailable, no Node, process launch, network or state writes. | Does not remove benchmark files from the wheel or qualify absent-capability installation. | -| Metadata and active consumers | The same catalog and all 25 details are byte-identical to the frozen `main@e235cde9c` workload; 53 CLI help/list/detail/unknown-id observations match. Discovery loads 2 benchmark children instead of 28, and 298 LoopX modules instead of 326. Existing benchmark semantics and canonical export identities remain unchanged. | Import counts are not latency, total cost, model benefit or full D2/D5 closure. | -| Acceptance and continuation | 52 installed-core discovery/execution/context/recovery cases pass on the rebuilt artifact; 383 selected consumer cases and 43 architecture/documentation cases pass separately. No new state owner, provider id, activation toggle or top-level module. | Keep R1/M3 and V1–V5/V10 open; continue capability package isolation and selected Standard delivery. Public-channel C1 qualification remains with its release owner. | +- Checkpoint moved to the execution ledger: [Core discovery checkpoint (2026-11-19)](ledger/monorepo-distribution-split-v0/2026-11-19-core-discovery-checkpoint.md). diff --git a/docs/architecture/rfcs/monorepo-distribution-split-v0.zh-CN.md b/docs/architecture/rfcs/monorepo-distribution-split-v0.zh-CN.md index 673316d11c..debd267ef7 100644 --- a/docs/architecture/rfcs/monorepo-distribution-split-v0.zh-CN.md +++ b/docs/architecture/rfcs/monorepo-distribution-split-v0.zh-CN.md @@ -477,13 +477,7 @@ M0–M5 保留原发行里程碑;R0–R4 是同一计划中的运行时和旅 R0 可以先于目录移动交付,但不代表内核合格。R3/R4 可选,不阻塞已合格的 CLI 或 managed 任务。 真实调用者出现前不增加闲置 provider、字段或框架。每个 PR 记录应用/推迟的相邻重构。 -### Core 发现入口检查点 — 2026-11-19 - -| 边界 | 交付增量/证据 | 仍未完成 | -| --- | --- | --- | -| V1/V3,能力发现 | Benchmark 包公开符号按需解析到所选既有 owner,保留全部 199 个符号及顺序;显式星号导入仍请求全部。执行实现不可用且无 Node 时,帮助/列表/详情仍可用,无进程启动、网络或状态写入。 | 未从 wheel 删除 benchmark 文件,也不验收 capability 分包缺席安装。 | -| 元数据与活跃调用方 | 同冻结 `main@e235cde9c` workload 的目录和全部 25 项详情逐字节一致;53 项 CLI 帮助/列表/详情/未知 id 观察一致。发现入口的 benchmark 子模块从 28 降到 2,LoopX 模块从 326 降到 298。保留 benchmark 语义及公开符号的 canonical 对象身份。 | Import 数量不代表时延、完整成本、模型收益或完整 D2/D5 闭包。 | -| 验收与继续方向 | 重建发行物通过 52 项安装 core 发现/执行/上下文/恢复用例;383 项所选消费方与 43 项架构/文档用例分别通过。没有新增状态 owner、provider id、启用开关或顶层模块。 | R1/M3 与 V1–V5/V10 继续开放;下一步仍是 capability 分包隔离与所选 Standard 交付。公开渠道 C1 资格仍归既有 release owner。 | +- 检查点已移至执行台账:[Core 发现入口检查点(2026-11-19)](ledger/monorepo-distribution-split-v0/2026-11-19-core-discovery-checkpoint.zh-CN.md)。 diff --git a/docs/concepts/interaction-pattern-catalog.md b/docs/concepts/interaction-pattern-catalog.md index ca9d49259d..524b18688c 100644 --- a/docs/concepts/interaction-pattern-catalog.md +++ b/docs/concepts/interaction-pattern-catalog.md @@ -1213,7 +1213,7 @@ main blocker or keeps following a stale local-only benchmark staging todo. - a typed machine-configuration namespace is about to change; the built-in namespaces are `change_quality_qualification`, `codex_chat`, `context_delivery`, `explore_harness`, `goal_storage`, `manager_runtime`, `periodic_report`, `pull_request_review`, - `steward_executor`, and `todo_replan_cadence`. The public catalog returned by + `steward_executor`, `steward_memory`, and `todo_replan_cadence`. The public catalog returned by `loopx machine-config describe` is authoritative, so this inventory has to stay complete rather than approximate; - `goal_storage` carries the storage target a newly created Goal is fixed to @@ -1246,6 +1246,12 @@ main blocker or keeps following a stale local-only benchmark staging todo. authority, and it precedes the Chat service environment rather than replacing it, so a machine-local decision is editable in the Dashboard and readable from `loopx machine-config inspect`; +- `steward_memory` carries the default-off isolated OpenViking memory setting + (`enabled`, `user_space`, `auto_recall`, and `recall_timeout_seconds` from `1` + to `15`) for verified owner private Steward conversations. It stores no + credentials (`OPENVIKING_*` stays in the Chat host environment and is scrubbed + from worker environments) and never leaks into group chats, project + conversations, or worker Agents; - `loopx machine-config preview` returns a `plan_revision` for the exact envelope, namespace patch, removal, or rollback that would be applied; - a Goal-level override and a live machine default may both be in scope. diff --git a/examples/project/goal-vision-replan-contract-smoke.py b/examples/project/goal-vision-replan-contract-smoke.py index af5e34f6ec..e07f3c53e1 100644 --- a/examples/project/goal-vision-replan-contract-smoke.py +++ b/examples/project/goal-vision-replan-contract-smoke.py @@ -193,8 +193,8 @@ def main() -> int: repair_patterns, [ "vision_replan_writeback_gap", - "use the matching outcome", - "retain unaffected requirements", + "refine the matching outcome", + "Retain unaffected requirements", "fresh guard required by changed acceptance", "without replacing the admitted Turn or replaying effects", ], diff --git a/examples/public_entry/readme-demo-surface-smoke.py b/examples/public_entry/readme-demo-surface-smoke.py index 5211e37993..aff1ec1707 100644 --- a/examples/public_entry/readme-demo-surface-smoke.py +++ b/examples/public_entry/readme-demo-surface-smoke.py @@ -31,7 +31,7 @@ def main() -> int: for required in [ '
', "long-horizon goals", - "long-running agent teams", + "multi-agent teams", "## Meet the Personal Agent Workspace", "docs/assets/personal-workspace/research-workbench-hero.webp", "docs/architecture/rfcs/capable-manager-semantic-handoff-v0.md", @@ -48,10 +48,8 @@ def main() -> int: "## Advanced Paths", "200+ hours of elapsed loop lifetime", "200+ hour public contribution arc", - "Redacted owner-run showcase", "not continuous model execution or unattended production autonomy", "docs/assets/long-running-loop-openviking-trajectory.png", - "docs/assets/long-running-loop-ml-experiment-trajectory.png", "### Recurring Work Presets", "### Review Agent Work", "### App and Projection Paths", @@ -76,7 +74,6 @@ def main() -> int: "docs/assets/control-plane-board.zh.svg", "200+ 小时自然时长", "超过 200 小时的公开贡献轨迹", - "经过脱敏的 owner-run showcase", "docs/assets/loopx-lark-developer-group.png", "docs/assets/loopx-wechat-contact.png", "微信:huangrt00", @@ -103,13 +100,8 @@ def main() -> int: assert root.find(f".//{svg_ns}script") is None, asset assert ' str | None: if _REPO_SLUG_RE.fullmatch(raw): return raw.removesuffix(".git") match = _REMOTE_GITHUB_RE.match(raw) - return match.group(1) if match else None + if match and _REPO_SLUG_RE.fullmatch(match.group(1)): + return match.group(1) + return None def parse_github_pr_target( @@ -62,10 +64,10 @@ def parse_github_pr_target( raise ValueError("protected merge target must be a string") raw = target.strip() url_match = _GITHUB_URL_TARGET_RE.fullmatch(raw) - if url_match: + if url_match and _REPO_SLUG_RE.fullmatch(url_match.group(1)): return url_match.group(1), int(url_match.group(2)) repo_match = _REPO_NUM_TARGET_RE.fullmatch(raw) - if repo_match: + if repo_match and _REPO_SLUG_RE.fullmatch(repo_match.group(1)): return repo_match.group(1), int(repo_match.group(2)) bare_match = _BARE_NUM_TARGET_RE.fullmatch(raw) if bare_match and default_repository and _REPO_SLUG_RE.fullmatch(default_repository): diff --git a/loopx/capabilities/native_chat/steward_monitor.py b/loopx/capabilities/native_chat/steward_monitor.py index 4bfb11b612..4788daeb3b 100644 --- a/loopx/capabilities/native_chat/steward_monitor.py +++ b/loopx/capabilities/native_chat/steward_monitor.py @@ -12,7 +12,6 @@ import json import logging from pathlib import Path -import re import subprocess import time from typing import Any @@ -24,6 +23,7 @@ from ...control_plane.runtime.time import now_utc from ...control_plane.goals.activation import goal_is_stopped from ...file_lock import exclusive_file_lock +from ..issue_fix.repository_snapshot import _REPO_PATTERN from .github_pr_evidence import observe_github_repository_prs from .steward_commands import native_command from .steward_managed_mode import StewardManagedMode @@ -31,7 +31,6 @@ TARGET = "steward-portfolio-watch" FOLLOWUP_TARGET_PREFIX = "steward-monitor-followup:" _LOG = logging.getLogger(__name__) -_GITHUB_REPO_URL = re.compile(r"^git:github\.com/([A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+)$") class StewardObservationAdapter: @@ -71,8 +70,11 @@ def advancement_turn_id(todo: dict[str, Any]) -> str: def _github_repo_slug(task_repository: Any) -> str | None: if not isinstance(task_repository, str): return None - match = _GITHUB_REPO_URL.fullmatch(task_repository.strip()) - return match.group(1) if match else None + raw = task_repository.strip() + if not raw.startswith("git:github.com/"): + return None + slug = raw.removeprefix("git:github.com/") + return slug if _REPO_PATTERN.fullmatch(slug) else None def _observe_github_repository_prs(repo_slug: str) -> dict[str, Any]: diff --git a/loopx/chat_action_normalization.py b/loopx/chat_action_normalization.py index c1cea4a7c1..8746b34478 100644 --- a/loopx/chat_action_normalization.py +++ b/loopx/chat_action_normalization.py @@ -7,6 +7,7 @@ from typing import Any, Mapping from .agent_registry import registered_agent_ids_for_goal +from .capabilities.issue_fix.repository_snapshot import _REPO_PATTERN from .control_plane.content_digest import BARE_SHA256_PATTERN from .control_plane.runtime.time import now_utc, parse_timestamp, utc_isoformat from .control_plane.todos.contract import require_supported_todo_resume_when @@ -786,7 +787,7 @@ def _normalize( } if values.get("task_repository"): raw_repo = _text(values["task_repository"], field="task_repository", limit=200) - if re.fullmatch(r"[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+", raw_repo): + if _REPO_PATTERN.fullmatch(raw_repo): raw_repo = f"git:github.com/{raw_repo}" result["task_repository"] = raw_repo stop_cond_raw = values.get("stop_condition") @@ -843,7 +844,7 @@ def _normalize( result["target_key"] = _opaque(values["target_key"], field="target_key") if values.get("task_repository"): raw_repo = _text(values["task_repository"], field="task_repository", limit=200) - if re.fullmatch(r"[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+", raw_repo): + if _REPO_PATTERN.fullmatch(raw_repo): raw_repo = f"git:github.com/{raw_repo}" result["task_repository"] = raw_repo if values.get("cadence"): @@ -881,7 +882,7 @@ def _normalize( }, ) repository = str(values.get("repository") or "").strip() - if not re.fullmatch(r"[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+", repository): + if not _REPO_PATTERN.fullmatch(repository): raise ValueError("pr.merge repository must be /") raw_num = values.get("pr_number") if isinstance(raw_num, bool) or not isinstance(raw_num, int) or raw_num < 1: diff --git a/loopx/cli_runtime.py b/loopx/cli_runtime.py index dd605032e1..e70f2fb937 100644 --- a/loopx/cli_runtime.py +++ b/loopx/cli_runtime.py @@ -965,9 +965,15 @@ def _dispatch_selected(args: argparse.Namespace, raw_argv: list[str]) -> int: def _standalone_core() -> bool: - from importlib.util import find_spec + if sys.modules.get("loopx.cli") is not None: + return False + from importlib.machinery import PathFinder - if find_spec("loopx.cli") is not None: + package = sys.modules.get(__package__ or "loopx") + search_path = list(getattr(package, "__path__", ())) or [ + str(Path(__file__).resolve().parent) + ] + if PathFinder.find_spec("loopx.cli", search_path) is not None: return False from importlib.metadata import PackageNotFoundError, distribution from .python_install_owner import installed_loopx_distribution diff --git a/loopx/control_plane/testing/doubao_model_behavior_actor.py b/loopx/control_plane/testing/doubao_model_behavior_actor.py index 0466cf5ebe..2d0fe51c91 100644 --- a/loopx/control_plane/testing/doubao_model_behavior_actor.py +++ b/loopx/control_plane/testing/doubao_model_behavior_actor.py @@ -506,9 +506,12 @@ def _onboarding_decision_instruction(phase: str) -> str: infer this boolean from activation_allowed or the selected route. - host_loop_activation_after_todo_write: copy activation_required_after_todo_write from that activation object, else false. -- requested_host_surface: copy the packet's top-level host_surface, including - null. Copy host_surface and activation_method from the activation object, - including null. +- requested_host_surface: copy ONLY the packet's top-level host_surface + (including null). +- host_surface and activation_method: copy ONLY from that activation object + (top-level host_loop_activation or command_pack.host_loop_activation), + never from the packet's top-level host_surface; return null when omitted or + null. - visible_goal_command_available: true exactly when activation.host_mutation.host_command is `/goal `. - writes_now and spends_quota_now: copy the corresponding booleans from diff --git a/loopx/extensions/lark/goal_channel_operation.py b/loopx/extensions/lark/goal_channel_operation.py index e26c19f739..cb6f7fd650 100644 --- a/loopx/extensions/lark/goal_channel_operation.py +++ b/loopx/extensions/lark/goal_channel_operation.py @@ -78,9 +78,7 @@ def _digest(value: object) -> str: "#": "#", "_": "_", } -_CARD_TEXT_ESCAPE_PATTERN = re.compile( - "[" + re.escape("".join(_CARD_TEXT_ENTITIES)) + "]" -) +_CARD_TEXT_ESCAPE_PATTERN = re.compile(r"[&<>\"'*~\[\]()#_]") def _card_text(value: object) -> str: diff --git a/loopx/presentation/goal_storage_api.py b/loopx/presentation/goal_storage_api.py index 77017193fa..eb7bbffdf4 100644 --- a/loopx/presentation/goal_storage_api.py +++ b/loopx/presentation/goal_storage_api.py @@ -147,11 +147,10 @@ def _storage_cold_snapshot( ) -> tuple[Path, dict[str, object], dict[str, object]]: from ..control_plane.coordination.authority_source_capture import build_runtime_shadow_source_snapshot from ..control_plane.goals.state_resolution import resolve_goal_state - from ..control_plane.projects.registry_codec import load_project_registry - from ..registry import find_registry_goal + from ..registry import find_registry_goal, load_registry if source_registry != Path(self.server.registry_path).resolve(): - registry = load_project_registry(source_registry) + registry = load_registry(source_registry) selected_goal = find_registry_goal(registry, goal_id) if selected_goal is None: raise ValueError("registered Goal source changed") diff --git a/loopx/semantics/goal_instance_binding_inventory_v1.json b/loopx/semantics/goal_instance_binding_inventory_v1.json index 23720079be..bcc5108083 100644 --- a/loopx/semantics/goal_instance_binding_inventory_v1.json +++ b/loopx/semantics/goal_instance_binding_inventory_v1.json @@ -26,7 +26,7 @@ "consumer_sites": [ "loopx/attached_session.py::claim_attached_agent_turn", "loopx/attached_session.py::complete_attached_agent_turn", - "loopx/chat_runtime.py::ChatRuntimeController.resume_session" + "loopx/chat/session_open.py::ChatSessionLifecycleMixin.resume_session" ], "effect_boundary": "loopx/control_plane/goals/chat_session_lifecycle.ts::decideChatSessionLifecycle", "authority_role": "runtime_session_binding", diff --git a/scripts/semantic_incident_retrodiction.py b/scripts/semantic_incident_retrodiction.py index 17e910300f..e187128465 100644 --- a/scripts/semantic_incident_retrodiction.py +++ b/scripts/semantic_incident_retrodiction.py @@ -254,14 +254,28 @@ def probe_definitions_ratcheted(guard: Guard) -> tuple[bool, str]: def probe_commit_time_selection(guard: Guard) -> tuple[bool, str]: """E07: the guard must be selected before merge, not discovered by the fleet.""" + from loopx.canary.premerge import build_premerge_validation_gate + from loopx.canary.runner import MAINTAINABILITY_RATCHET_SCRIPT + planner = (REPO_ROOT / "loopx" / "canary" / "planner.py").read_text(encoding="utf-8") - premerge = (REPO_ROOT / "loopx" / "canary" / "premerge.py").read_text(encoding="utf-8") command = "examples/semantic-vocabulary-drift-smoke.py" planned = command in planner - inherited = "INHERITED_BASELINE_COMMANDS" in premerge and "planner" in premerge + gate = build_premerge_validation_gate( + changed_files=["loopx/_probe_semantic_guard.py"], + execute=False, + repo_root=REPO_ROOT, + ) + selected_commands = [ + str(check.get("command") or "") + for check in (gate.get("catalog_run") or {}).get("selected_checks") or [] + if isinstance(check, dict) + ] + selected_by_premerge = any(command in item for item in selected_commands) + not_advisory_baseline = command != MAINTAINABILITY_RATCHET_SCRIPT guarded_roots = [hint for hint in ("loopx/", "scripts/", "examples/") if f'"{hint}"' in planner] - return planned and inherited, ( - f"named_in_planner={planned} premerge_consumes_planner={inherited} planner_trigger_hints={guarded_roots}" + return planned and selected_by_premerge and not_advisory_baseline, ( + f"named_in_planner={planned} selected_by_premerge={selected_by_premerge} " + f"not_advisory_baseline={not_advisory_baseline} planner_trigger_hints={guarded_roots}" ) diff --git a/tests/control_plane/test_actual_default_model_behavior_portfolio.py b/tests/control_plane/test_actual_default_model_behavior_portfolio.py index 7ca3c6f1ba..f82a4a839d 100644 --- a/tests/control_plane/test_actual_default_model_behavior_portfolio.py +++ b/tests/control_plane/test_actual_default_model_behavior_portfolio.py @@ -722,6 +722,8 @@ def test_live_packet_builder_preserves_gate_and_vision_contracts(tmp_path: Path) "activation_state": "goal_selection_required", "activation_allowed": False, "activation_required_after_todo_write": False, + "host_surface": None, + "activation_method": None, } assert ( onboarding_entry_semantic_contract(packets["onboarding_goal_selection_gate"])[ diff --git a/tests/control_plane/test_doubao_onboarding_model_behavior_actor.py b/tests/control_plane/test_doubao_onboarding_model_behavior_actor.py index b838d5c5bd..340da5268a 100644 --- a/tests/control_plane/test_doubao_onboarding_model_behavior_actor.py +++ b/tests/control_plane/test_doubao_onboarding_model_behavior_actor.py @@ -134,6 +134,13 @@ def test_onboarding_reason_code_instruction_matches_the_strict_result_boundary(p assert "including when the observation is healthy" in instruction +def test_onboarding_entry_instruction_separates_requested_and_activation_host_surface(): + instruction = _onboarding_decision_instruction("entry") + assert "copy ONLY the packet's top-level host_surface" in instruction + assert "never from the packet's top-level host_surface" in instruction + assert "return null when omitted or" in instruction + + @pytest.mark.parametrize( "reasons", [[], ["not a token"], [f"reason_{index}" for index in range(13)]], ) diff --git a/tests/control_plane/test_start_goal_compact_projection.py b/tests/control_plane/test_start_goal_compact_projection.py index 972aed762d..4059b4563f 100644 --- a/tests/control_plane/test_start_goal_compact_projection.py +++ b/tests/control_plane/test_start_goal_compact_projection.py @@ -2067,6 +2067,13 @@ def test_projection_preserves_multi_goal_selection_actions(tmp_path: Path) -> No "inspect_connection", "select_goal", ] + assert compact["command_pack"]["host_loop_activation"] == { + "activation_state": "goal_selection_required", + "activation_allowed": False, + "activation_required_after_todo_write": False, + "host_surface": None, + "activation_method": None, + } assert _host_shadow_document(compact) == _host_shadow_document(detailed) for choice in compact["goal_selection_gate"]["choices"]: assert "--capability-route issue-fix" in choice["rerun_command"]