Skip to content

fix(replan): exclude monitors from agent long-chain thresholds - #5004

Merged
huangruiteng merged 4 commits into
loopx-project:mainfrom
Jim-jimu:fix/monitor-replan-threshold
Sep 24, 2026
Merged

huangruiteng merged 4 commits into
loopx-project:mainfrom
Jim-jimu:fix/monitor-replan-threshold

Conversation

@Jim-jimu

Copy link
Copy Markdown
Contributor

Goal And Delivered Outcome

  • Goal/source and gap: An Agent with 9 claimed advancement Todos and 19 continuous monitors receives a long_todo_chain obligation because the old alternative threshold counts all 28 open Todos as backlog.
  • Observable before → after: New Agent-lane long-chain obligations require at least 15 claimed open advancement Todos. The 9+19 and 14+6 mixed workloads stay runnable without this obligation; 15 advancement Todos still trigger it. The regression and real-entrypoint checks below prove both boundaries.
  • Issue/task and intended base: Closes Long-chain replan treats continuous monitors as research backlog #5001. Base: main at d64c4d3772400c958d51b773f1e1e165cbaca801.

Scope And Continuation

  • Complete within this scope: update the existing TypeScript frontier owner, focused regressions, and the protocol, state-machine and bilingual migration documentation. This intentionally retires the 20-claimed-open trigger for new Agent-lane observations.
  • Shared unclaimed candidates remain selectable without imposing an owned-lane duty. Unscoped Goal thresholds, monitor due/no-change rules, source completeness, and exact ACK/rearm behavior retain their contracts. Historical open-count checkpoints keep predecessor recovery.
  • The related simplification removes the obsolete scoped open-count observation variant and selection calculation. No second rule owner or new abstraction is introduced.
  • Slice boundary / successor: N/A; this completes the reported threshold correction. Maintainer review and merge are required.

Validation

  • Tested revision: 934e704065c3c66f0d773334ee12766b971710c5
  • Run state: finished
  • Input classes: synthetic, public_fixture
  • Environment: Python 3.13.12 and Node.js 22.22.3.
Check kind Result Public-safe evidence / limitation
regression_parity passed With production code at 90f21a5299188d54f984a5313e774c9ac48d6595, the same updated tests fail in two TS cases and the 9+19 / 14+6 managed-CLI cases because a long-chain obligation is emitted. All pass on the tested revision.
unit passed node --no-warnings --experimental-strip-types --test tests/control_plane_ts/frontier_revision.test.ts tests/control_plane_ts/replan_semantics.test.ts: 24 passed. Covers mixed workloads, ownership isolation, monitor-growth ACK stability, complete-source fences, and historical checkpoint recovery.
integration passed After merging upstream #4980, test_python_runtime.test.ts, monitor_successor.test.ts and quota_monitor_poll_commit.test.ts: 29 passed. Confirms the updated Python selector and adjacent monitor tests work with the contribution.
real_entrypoint passed 93 focused Python tests across frontier rules/scope, canonical FileAuthorityStore, successor causality, monitor routing and CLI projections. Includes tests/control_plane/test_long_chain_projected_closeout.py: real CLI admission and replay of all three mixed workloads, plus the existing durable writeback/spend/rearm journey. All state is disposable.
static passed npm run typecheck:control-plane, Ruff on the changed Python test, and git diff --check.
integration passed python examples/control_plane/cli-output-budget-regression-smoke.py.
integration passed Standard loopx canary premerge --from-git-diff --git-diff-base origin/main: gate passed; 19 selected checks and 4 direct checks executed, with zero blocking failures and one advisory failure disclosed below. Public-boundary scan passed. Here origin/main is the upstream repository.
static failed The advisory maintainability check reports the existing module budget finding in loopx/extensions/lark/goal_topic_runtime.py. Reproduced on unmodified baseline 90f21a529; no budget was changed.
static failed Configured mypy reports no-any-return at loopx/control_plane/coordination/local_authority_shadow_projection.py:100. The identical error reproduces on unmodified baseline 90f21a529 with mypy 1.20.2.
  • Coverage and gaps: Final focused suites, CLI budget and premerge were rerun after incorporating the latest upstream base. The two baseline findings affect unchanged files. Full repository, Windows, PostgreSQL and live-model qualification were not run; this change does not alter provider transactions or storage.

Frontend / Visual Evidence

  • UI impact: none. CLI and managed-Turn projections consume the shared threshold decision; no setting, editor or frontend component changes.
  • Before: N/A.
  • After: N/A.
  • States and viewports shown: N/A.
  • Source data: none for visual evidence.
  • Attention review: N/A; no visual surface changed.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring (no functional changes)
  • Documentation update
  • Test update

LoopX Area

  • Control plane (goals, todos, quota, scheduler, registry, runtime)
  • Benchmark boundary (adapters, runners, verifiers, scoring, evidence)
  • Capability or extension (providers, adapters, skills)
  • Public docs or presentation surface (README, protocols, dashboard)
  • Build, packaging, installer, or CI
  • Host or runtime integration

Technical Direction

  • Core control-plane hardening: correction within the existing typed frontier owner. Migration checkpoints describe the new threshold; no broader RFC completion is claimed.

Shared-authority RFC fixture impact

  • Production-scale fixture schema: unchanged.
  • Semantic dimensions changed: Agent-lane long-chain admission excludes monitors. Focused mixed-workload cases cover the new boundary; existing complex File-store frontier/ACK cases remain green. No stored record, provider protocol, capacity or retention assumption changes.
  • Provider conformance arms run: existing real FileAuthorityStore frontier/ACK regressions; no full multi-provider conformance run.
  • Read-only legacy/file/PostgreSQL three-arm rehearsal: N/A; no promotion, runtime routing or compatibility projection change.

Boundary Checklist

  • Neither the diff nor this PR body/comments/attachments disclose private state, credentials, raw traces or verifier output, internal links, or local machine paths (including .loopx/, .codex/goals/, and live ACTIVE_GOAL_STATE.md).
  • I did not duplicate maintainer-owned benchmark work unless a maintainer split out a public issue for it.
  • I kept the change scoped to the linked issue/task.
  • I completed the visual evidence section for UI changes, or marked UI impact none.
  • Every commit includes a DCO Signed-off-by trailer (git commit -s).

Signed-off-by: Jim-jimu <49069997+bmh201708@users.noreply.github.com>
…reshold

Signed-off-by: Jim-jimu <49069997+bmh201708@users.noreply.github.com>
…reshold

Signed-off-by: Jim-jimu <49069997+bmh201708@users.noreply.github.com>
huangruiteng
huangruiteng previously approved these changes Sep 24, 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.

动机

#5001 描述的混合负载(9 项已认领推进任务、19 项持续监控)会被旧的“20 项已认领 open Todo”分支误判为长链,强制打断本可继续的 Agent lane。相同真实 CLI 回归在基线 d64c4d3 失败,在本 head 通过;15 项推进任务仍触发,因而这次改动完成了该 issue 的 Agent-lane 目标。

改动思路

沿用现有 TypeScript frontier 决策 owner:Python 只投影持久 Todo 的 task_class、claim 与 frontier 计数,evaluateLongTodoChain 决定阈值,goal-frontier/配额消费 obligation。不新增状态或第二套规则。Agent lane 只看自己已认领的推进任务;无 Agent 的 Goal 总览仍保留原 selectable-open 口径。历史 20-open checkpoint 只在读取/后继恢复路径保留。

具体改动

关键代码讲解

  • frontier_revision.ts:234 evaluateLongTodoChain:把 20-open 分支限定在 agent === null,Agent lane 的新触发只剩 15 项 claimed advancement;同时收窄新 observation 的 count_kind。
  • frontier_revision.ts:149 successorCheckpoints:保留历史 open-count 前置义务恢复,仍要求唯一新后继、完整匹配源和由 Python 消费方核对的 origin obligation ID。
  • TypeScript 测试覆盖 9+19、14+6、15+19、监控增长后的 ACK 稳定性及历史 checkpoint;真实 CLI 测试覆盖首读和 replay。协议、状态机、迁移 RFC 中英两版同步披露旧/新默认值。

对主干的风险

未发现阻塞项。最重要的误回归是监控增长再次让 15 项以下的 Agent lane 进入强制 replan;定向 TS 24/24、真实 CLI/Python 51/51、typecheck 和标准 premerge 均通过。premerge 的 19 项检查无阻塞失败,另有一项未改动 Lark 文件的既有 maintainability advisory,应继续记录但不归因于本 PR。未跑全仓、Windows、PostgreSQL 或 live-model;本变更不修改 provider 写入/存储。

语义与 CI 对齐

这次是已披露的默认行为变更,复用现有 long_todo_chain vocabulary、TypeScript 决策 owner 和持久 ACK 格式;无新权限或可选功能的 default-off 语义。Goal 策略 wait_for_ci=false,本评审未将远端 CI 作为证据或等待条件。

我的整体评价

APPROVE(exact head 934e704)。修复比在 Python 再做一次监控减法更局部,生产改动可逆,历史读侧兼容有针对性测试。剩余风险是无 Agent 总览有意保留 20-selectable-open 阈值,以及未做持久化 pre-upgrade 活跃义务的现场 replay;它们不阻塞 #5001 的 Agent-lane 修复。相邻边界的前瞻性简化已体现在收窄新 observation union,未看到需要并入的更大重构。

English verdict: APPROVE - exact head 934e704; no blocking finding; 24 TS and 51 Python tests, typecheck, and risk-based premerge passed (one inherited advisory).

Signed-off-by: Jim-jimu <49069997+bmh201708@users.noreply.github.com>
@huangruiteng
huangruiteng merged commit 93566c2 into loopx-project:main Sep 24, 2026
9 checks passed
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.

Long-chain replan treats continuous monitors as research backlog

2 participants