Repository navigation
refactor(quota): decide adaptive child admission in TypeScript #7901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
102 changes: 102 additions & 0 deletions
102
...er/typescript-control-plane-migration-v0/2026-11-02-adaptive-child-admission.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| # Adaptive child admission — 2026-11-02 | ||
|
|
||
| This checkpoint moves the complete adaptive native-child admission decision from | ||
| `quota/task_orchestration_admission.py` to `quota/adaptive_children.ts`, next to | ||
| the peer orchestration owner. The existing `multi_subagent` capability and its | ||
| builtin provider remain unchanged; this is an internal quota owner cutover, | ||
| not a new capability, provider, permission or frontend setting. | ||
|
|
||
| One `quota.task_orchestration.admit` request owns candidate eligibility, | ||
| User-dependency exclusion, coordinator election, ordered rejection reasons, | ||
| primary selection, capacity deferral, first conflicting lane, child ordering, | ||
| brief construction and context/execution policy. Capability requirements and | ||
| quota scheduling overlap execute through their existing TypeScript owners in | ||
| process. The standalone scheduling-overlap RPC is removed. Ordinary lease | ||
| matching keeps its folded semantics; Goal allow-scope matching remains | ||
| case-sensitive. Todo actionability reuses the summary-lane owner, including | ||
| acceptance denial. Election uses the shared Python-compatible JSON codec, | ||
| Unicode code-point ordering and an unsigned 64-bit digest prefix via BigInt. | ||
|
|
||
| ## Migration receipt | ||
|
|
||
| The immutable characterization fixture was captured and passed on unchanged | ||
| `fb16c6cb1` before moving rules. Its 18 cases preserve complete admission JSON, | ||
| quota contract/work-lane JSON and Markdown. Instrumentation measures admission | ||
| crossings separately from the surrounding quota command: | ||
|
|
||
| | Operation | Before | After | | ||
| | --- | ---: | ---: | | ||
| | Requirement-free admitted lanes | 0 | 1 | | ||
| | Missing-capability case | 3 | 1 | | ||
| | Conflict/first-conflict cases | 2 | 1 | | ||
| | Empty source or non-coordinator | 0 | 1 | | ||
| | Adaptive mode off | 0 | 0 | | ||
|
|
||
| Previously there were P per-pair overlap requests plus M uncached capability | ||
| requests; both owners now run in process behind the admission request. The | ||
| zero-to-one early-exit cost is intentional: Python keeps no candidate/election | ||
| rule merely to avoid that crossing. This does not claim one request for the | ||
| whole quota command, lower latency or long-horizon benefit. | ||
|
|
||
| The replaced Python dataclasses, rejection/selection/election composition, | ||
| brief/context policy, overlap adapter and admission constants are deleted. | ||
| Python retains a transport adapter with historical Todo/repository/resume and | ||
| Agent-id codecs, explicit source-vs-display selection and public objective text | ||
| rendering. These preserve persisted spellings and public text at the existing | ||
| Host boundary; none selects, rejects or orders a lane. Capability wrappers, | ||
| peer hashing and projection-repair scope matching retain independent production | ||
| callers; they are not admission fallbacks or unused compatibility exports. | ||
|
|
||
| The TypeScript `schedulingWriteScopeAllowed` intentionally duplicates Python `projection_repair.write_scope_allowed`, whose retained production caller `build_boundary_projection_repair_hint` uses it for missing-scope detection and inactive-boundary candidate matching; remove this duplication when that caller migrates to the shared typed scope owner with equivalent behavior validated. | ||
|
|
||
| The adapter exits when the sole production caller in `task_orchestration.py` | ||
| and its surrounding should-run transaction consume typed source facts natively. | ||
| Then that caller composes `admitAdaptiveChildren` in process and removes the | ||
| Python adapter and `quota.task_orchestration.admit` transport registration. | ||
| The frozen fixture remains until that caller cutover carries equivalent | ||
| complete-output and crossing evidence. | ||
|
|
||
| Product changes total +342/−461 physical lines, net −119. The Python admission | ||
| module changes from 490 to 137 lines (+97/−450); its 101-line adapter function | ||
| including signature performs only transport/compatibility work. The new typed | ||
| owner is 222 lines. Test, fixture and documentation lines are counted separately. | ||
|
|
||
| ## Qualification boundary | ||
|
|
||
| The existing dashboard capability workbench and orchestration settings, | ||
| Lark/CLI consumers and quota readback retain their contracts; no visual surface | ||
| changes. The source-checkout production `quota should-run` entrypoint was | ||
| compared against a `git archive HEAD` baseline with a synthetic temporary home, | ||
| a fixed clock and adaptive admission enabled. Complete outputs match byte for | ||
| byte on File and SQLite, in JSON (35,126 / 35,160 bytes) and Markdown | ||
| (8,565 / 8,587 bytes). This qualifies source behavior, not installed adoption. | ||
|
|
||
| The focused Python suite passed 543 tests; the existing focused TypeScript | ||
| suite passed 100 with one unrelated PostgreSQL workspace test skipped, and | ||
| 17 new typed admission tests passed. Typecheck, semantic vocabulary drift | ||
| (45/45 independent twins), maintainability ratchet, interface budgets and | ||
| integrated File/SQLite canaries passed. The diff-scoped semantic advisory found | ||
| no supported new vocabulary carriers; its limited syntax coverage is not proof | ||
| of semantic completeness. No budget, smoke anchor or gate is relaxed. | ||
|
|
||
| The bounded refactoring pass shares Todo actionability and extends the existing | ||
| glob engine with a case-sensitive mode rather than adding another matcher. | ||
| No storage backend, lease persistence, lease authority or PostgreSQL IO changes. | ||
| A capability recovery read with `network` available also matches complete | ||
| outputs: File JSON/Markdown 31,907/8,478 bytes, SQLite 31,937/8,500 bytes. | ||
| The first recovery comparison observed an existing capability-hook mutation: | ||
| `local_private_state_mutated` was true for the first base read and false for | ||
| the subsequent head read. A base-only repeat reproduced true → false and then | ||
| matched head byte for byte. Final comparisons settle that synthetic hook state | ||
| before both reads; no expected fixture or product rule was changed. | ||
|
|
||
| The synthetic CLI outputs also preserve a baseline limitation: | ||
| `interaction_contract.agent_channel.work_context.complete` is false, with | ||
| `selected_todo` / `context_source_unavailable`. All eight JSON observations | ||
| (base/head, both providers and capability states) contain that same failure. | ||
| Admission and quota-output parity are qualified; fully available selected-work | ||
| context delivery is not. This separate readback gap is outside this admission | ||
| owner cutover and must not be hidden by a parity success. | ||
|
|
||
| Full CI, installed packaging, cross-host operation and performance remain | ||
|
loopx-agent marked this conversation as resolved.
Resolved
|
||
| unqualified by this slice. | ||
81 changes: 81 additions & 0 deletions
81
...escript-control-plane-migration-v0/2026-11-02-adaptive-child-admission.zh-CN.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| # 自适应子 Agent 准入 — 2026-11-02 | ||
|
|
||
| 本检查点将完整的自适应原生子 Agent 准入决策从 | ||
| `quota/task_orchestration_admission.py` 移至 peer orchestration owner 旁的 | ||
| `quota/adaptive_children.ts`。既有 `multi_subagent` capability 及其 builtin | ||
| provider 不变;这是 quota 内部 owner 切换,不新增 capability、provider、权限或前端设置。 | ||
|
|
||
| 单次 `quota.task_orchestration.admit` 请求拥有候选资格、User 依赖排除、协调者选举、 | ||
| 有序拒绝原因、主任务选择、容量延后、首个冲突 lane、子任务排序、brief 构造及 | ||
| 上下文/执行策略。Capability 要求和 quota 调度重叠复用既有 TypeScript owner, | ||
| 在进程内执行。独立的调度重叠 RPC 已删除。普通 lease 匹配保持大小写折叠语义, | ||
| Goal allow-scope 匹配保持大小写敏感。Todo 可执行性复用 summary-lane owner, | ||
| 包含 acceptance 拒绝。选举复用兼容 Python 的 JSON codec、Unicode 码点排序, | ||
| 并通过 BigInt 处理无符号 64 位摘要前缀。 | ||
|
|
||
| ## 迁移收据 | ||
|
|
||
| 不可变 characterization fixture 在移动规则前,已于未修改的 `fb16c6cb1` 上捕获并通过。 | ||
| 18 个场景保留完整 admission JSON、quota contract/work-lane JSON 和 Markdown。 | ||
| 插桩单独测量 admission crossing,不混同外围 quota 命令: | ||
|
|
||
| | 操作 | 之前 | 之后 | | ||
| | --- | ---: | ---: | | ||
| | 无 capability 要求的已准入 lane | 0 | 1 | | ||
| | 缺少 capability 的场景 | 3 | 1 | | ||
| | 冲突/首个冲突场景 | 2 | 1 | | ||
| | 空源或非协调者 | 0 | 1 | | ||
| | 自适应模式关闭 | 0 | 0 | | ||
|
|
||
| 此前有 P 次逐对重叠请求及 M 次未缓存 capability 请求;现在两个 owner 都在准入请求内 | ||
| 同进程执行。提前退出由零次变一次是有意代价:Python 不为省一次 crossing 而保留 | ||
| 候选/选举规则。这不表示整个 quota 命令只有一次请求,也不声称延迟或长程收益。 | ||
|
|
||
| 被替代的 Python dataclass、拒绝/选择/选举组合、brief/上下文策略、重叠 adapter | ||
| 及准入常量已删除。Python 保留 transport adapter,负责历史 Todo/repository/resume | ||
| 和 Agent-id codec、显式 source 与 display 选择及公开 objective 文本渲染。 | ||
| 这些在既有 Host 边界保留持久化拼写和公开文本,不选择、拒绝或排序 lane。 | ||
| Capability wrapper、peer hash 及 projection-repair scope 匹配仍有独立生产调用方; | ||
| 它们不是准入 fallback,也不是无人调用的兼容导出。 | ||
|
|
||
| TypeScript `schedulingWriteScopeAllowed` 有意保留与 Python `projection_repair.write_scope_allowed` 的重复实现,后者仍由生产调用方 `build_boundary_projection_repair_hint` 用于缺失 scope 检测及非活动 boundary 候选匹配;当该调用方迁移至共享 typed scope owner 并验证等价行为后,删除该重复实现。 | ||
|
|
||
| 当 `task_orchestration.py` 中唯一生产调用方及其外围 should-run 事务原生消费 typed | ||
| 源事实后,adapter 退出。届时调用方在进程内组合 `admitAdaptiveChildren`,删除 Python | ||
| adapter 及 `quota.task_orchestration.admit` transport 注册。在该调用方切换具有等价的 | ||
| 完整输出及 crossing 证据之前,保留冻结 fixture。 | ||
|
|
||
| 产品改动合计新增 342/删除 461 个物理行,净减 119 行。Python 准入模块由 | ||
| 490 行降至 137 行(新增 97/删除 450);包含签名的 101 行 adapter 函数只负责 | ||
| transport/兼容工作。新的 typed owner 为 222 行。测试、fixture 与文档行数单独计算。 | ||
|
|
||
| ## 资格边界 | ||
|
|
||
| 既有 dashboard capability workbench、orchestration 设置、Lark/CLI 消费方及 quota | ||
| 回读保持原合同;没有视觉表面变化。Source-checkout 生产 `quota should-run` 入口与 | ||
| `git archive HEAD` baseline 比较,使用合成临时 home、固定时钟并启用自适应准入。 | ||
| File 和 SQLite 的完整 JSON(35,126/35,160 字节)及 Markdown | ||
| (8,565/8,587 字节)均逐字节一致。这资格化源码行为,不证明已安装采用。 | ||
|
|
||
| 聚焦 Python 套件通过 543 项;既有聚焦 TypeScript 套件通过 100 项,另有一个无关 | ||
| PostgreSQL workspace 测试跳过;17 项新 typed 准入测试通过。Typecheck、语义词汇 | ||
| 漂移(独立 twin 45/45)、maintainability ratchet、interface budget 及 File/SQLite | ||
| 集成 canary 均通过。Diff-scoped semantic advisory 未发现支持的新词汇 carrier; | ||
| 其有限语法覆盖不证明语义完整。没有放宽预算、smoke anchor 或 gate。 | ||
|
|
||
| 有界重构共享 Todo 可执行性,并为既有 glob 引擎扩展大小写敏感模式,避免再造 matcher。 | ||
| 没有修改存储 backend、lease 持久化、lease authority 或 PostgreSQL IO。 | ||
| 在 `network` 可用的 capability 恢复读取中,完整输出也一致:File JSON/Markdown | ||
| 为 31,907/8,478 字节,SQLite 为 31,937/8,500 字节。首次恢复比较观察到既有 | ||
| capability-hook mutation:第一次 base 读取的 `local_private_state_mutated` 为 true, | ||
| 随后 head 读取为 false。只运行 base 重复读取也复现 true → false,随后逐字节匹配 head。 | ||
| 最终比较在两次读取前先稳定该合成 hook 状态;没有改动 expected fixture 或产品规则。 | ||
|
|
||
| 合成 CLI 输出还保留一项 baseline 限制: | ||
| `interaction_contract.agent_channel.work_context.complete` 为 false,带有 | ||
| `selected_todo`/`context_source_unavailable`。八份 JSON 观测(base/head、两种 | ||
| provider 及两种 capability 状态)都有相同失败。已资格化准入及 quota 输出等价性, | ||
| 未资格化完全可用的 selected-work context 交付。该独立回读缺口在本次准入 owner | ||
| 切换范围之外,不能用 parity 成功掩盖。 | ||
|
|
||
| 本切片不资格化完整 CI、已安装打包、跨 Host 运行或性能。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.