Skip to content

fix(quota): compare scheduling write scopes with the canonical fold - #7674

Merged
huangruiteng merged 2 commits into
loopx-project:mainfrom
lll-hhh:fix/quota-scheduling-write-scope-case-fold
Oct 29, 2026
Merged

huangruiteng merged 2 commits into
loopx-project:mainfrom
lll-hhh:fix/quota-scheduling-write-scope-case-fold

Conversation

@lll-hhh

@lll-hhh lll-hhh commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Goal And Delivered Outcome

  • Outcome basis / optional anchor: [Bug]: the quota scheduling layer compares write scopes case-sensitively while the canonical lease owner folds case #7652, reproduced on main at 8caaf678e.

  • Goal/source and gap: the quota scheduling layer decided "do these two child lanes write the same file" with a matcher it owns itself (fnmatchcase, plus a segment-prefix subtree rule), while the canonical lease owner for the same concept folds case with Unicode semantics. On a case-insensitive host the two owners returned opposite answers for one pair, so the lane that collides with the primary lane was admitted as an eligible child lane instead of blocked with write_scope_conflict.

  • Observable before → after, with the validation row that proves it: before, the pairs src/Main.ts / src/main.ts, src/Σ.ts / src/ς.ts, src/ß.ts / src/SS.ts and src/ / SRC/ returned "no overlap" from scheduling, and the case-aliased child lane ran in the same round; after, that child lane is blocked with write_scope_conflict naming the primary Todo. The scheduling layer's own wider subtree rule is unchanged: src / src/a.ts, src/main / src/main/x, src/a / src/a/b and src/a.ts / src/a.ts/b still report overlap even though the canonical lease rule does not. Proven by the regression_parity row (a failing-before test) and the two unit rows below.

  • Issue/task and intended base: Closes [Bug]: the quota scheduling layer compares write scopes case-sensitively while the canonical lease owner folds case #7652. Intended base main at 8caaf678e.

Author Declaration

  • Written by: model_agent (an agent in the Qoder product family).

Implemented against

Criterion (spec clause) Disposition Symbol / path Test or command
Host/path case aliases remain overlapping implemented schedulingScopePairOverlaps, loopx/control_plane/work_items/task_lease_acquire_decision.ts node --test tests/control_plane_ts/effect_runtime_handlers.test.ts
Length-changing and non-symmetric Unicode folds, and glob character classes, must not be restated in the scheduling layer implemented the scheduling entry point calls the existing caseFold / fnmatchcase / scopePairOverlaps; _scope_patterns_overlap and _scope_static_prefix are deleted from loopx/control_plane/quota/task_orchestration_admission.py python -m pytest tests/control_plane/test_task_orchestration_admission.py
Scheduling keeps its subtree containment without a trailing slash implemented schedulingScopeRoot, loopx/control_plane/work_items/task_lease_acquire_decision.ts the four …/a.ts-style rows of the same TS test, plus test_admission_keeps_scheduling_subtree_containment_without_a_trailing_slash
Stored scope spelling and request identity stay unchanged; folding belongs in a comparison-only view implemented comparisonWriteScopes is reused and no caller writes scopes back test_admission_serializes_case_alias_write_scopes, test_admission_leaves_sibling_files_independent
  • Self-check before submission: verified — the 15-row table from [Bug]: the quota scheduling layer compares write scopes case-sensitively while the canonical lease owner folds case #7652 evaluated through the new runtime method on this head; the admission, lease and planning-consumer Python suites; the two runtime handler TS suites; npm run typecheck:control-plane; ruff check on the changed Python files; and the same new tests run against the base revision as a failing-before control. Assumed, not verified — that the managed runtime is reachable on this path: apply_task_orchestration_contract already calls it for peer lanes in the same module, so this adds no new host requirement to the flow, but a scheduling call that previously worked with no runtime now requires one. Not attempted — native Windows/macOS filesystem behaviour of the admitted lanes; this change is a comparison rule, not an IO path.

Scope And Continuation

  • Completed scope and remaining work: the scheduling layer no longer holds a second opinion about scope overlap, which is the divergence [Bug]: the quota scheduling layer compares write scopes case-sensitively while the canonical lease owner folds case #7652 reported. Whether scheduling's subtree containment should also exist in the canonical lease rule is a separate product decision — adopting it there would turn four currently-admitted combinations into conflicts — and this PR deliberately does not make it.
  • Slice boundary / successor: complete within this scope. A successor would unify the subtree rule in one direction or the other; it is behaviour-changing on both layers and needs its own accepted basis.

Validation

  • Tested revision: a9361897d5f437b393da8c3b14f19aae0dea791e (base ed0972c31). The earlier 35b393044 was the same patch on 8caaf678e; it was rebased when main advanced, and git patch-id --stable is unchanged (d13b9e1df76fa31106f3db84eaa8b582e503f19a), so no content moved. Re-verified on the new base: control-plane typecheck clean, the 15 rows above re-evaluated with 0 mismatches, 26 admission tests and 14 runtime handler tests pass.
  • Run state: finished
  • Input classes: synthetic | public_fixture
Check kind Result Public-safe evidence / limitation
unit passed python -m pytest tests/control_plane/test_task_orchestration_admission.py — 26 passed, including three new rows: a case-aliased pair now serializes, a no-trailing-slash subtree pair still serializes, sibling files stay independent.
unit passed node --test tests/control_plane_ts/effect_runtime_handlers.test.ts tests/control_plane_ts/effect_runtime_handler_loading.test.ts — 16 passed, including all 15 rows of the divergence table measured in #7652.
integration passed python -m pytest tests/control_plane/test_task_orchestration_admission.py tests/control_plane/test_task_lease.py tests/control_plane/test_quota_planning_horizon.py — 70 passed; these cover the canonical owner, the admission decision and its should-run consumers.
regression_parity passed Same test file run against 8caaf678e: the case-alias row fails because both lanes are admitted, the subtree and sibling rows pass; on this head all three pass. The failure sets differ by exactly that one behaviour, so the wider subtree rule is not a silent change.
static passed npm run typecheck:control-plane and ruff check on the changed Python files, both clean.
manual passed The runtime method was called with each pair from #7652's table on this head; 0 of 15 rows disagree with the contract the issue states.
  • Coverage and gaps: the changed paths are the TS entry point, its handler registration and the one Python call site, and each has a row above. The pre-existing tests/architecture/test_control_plane_import_boundaries.py::test_lark_projection_sinks_are_owned_by_the_extension_layer failure reproduces identically on 8caaf678e, so it is not attributable to this change. The full tests/control_plane/ suite and the browser lanes were not run locally; CI covers them. Not covered: real host filesystem case-folding behaviour on Windows/macOS.

Frontend / Visual Evidence

  • UI impact: none
  • Before: N/A
  • After: N/A
  • First viewport and preview: N/A
  • States and viewports shown: N/A
  • Source data: none
  • Attention review: N/A
  • Craft review: N/A

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

  • Direction / acceptance reference, when applicable: Core control-plane hardening (routing only; no acceptance id claimed).

Shared-authority RFC fixture impact

  • N/A: this change adds one comparison decision to an existing runtime owner. It claims no promotion, runtime-routing or compatibility-projection progress, and touches no fixture schema or provider conformance arm.

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.
  • Existing English/Chinese RFC pairs (including ledger entries) both have a diff, and the local premerge check python3 scripts/check_rfc_bilingual.py --base origin/main --head HEAD passes, or no paired RFC changed.
  • 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).

…ical owner

Quota scheduling compared child-lane write scopes with its own matcher. Add
an entry point next to the canonical lease owner that composes the canonical
folded glob decision with the subtree containment scheduling keeps, so the
two layers share one set of primitives.

Signed-off-by: lll-hhh <169072815+lll-hhh@users.noreply.github.com>
…ld lanes

The scheduling matcher compared scopes case-sensitively, so on a
case-insensitive host it admitted two lanes naming the same physical file
while the canonical lease owner rejected the same pair. Consume the new
scheduling entry point and keep the subtree rule the scheduler already had.

Signed-off-by: lll-hhh <169072815+lll-hhh@users.noreply.github.com>
@lll-hhh
lll-hhh force-pushed the fix/quota-scheduling-write-scope-case-fold branch from 35b3930 to a936189 Compare October 29, 2026 14:57

@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: model_agent | gpt-6.1-sol | OpenAI | runtime_reported | reasoning_effort=max

动机 / Motivation

同一 Goal 的协调者把多个声明了写入范围的临时子任务排入同一轮时,会使用这项比较。 原先 src/Main.ts 与 src/main.ts 会同时被排入一轮,之后可能遇到延迟的 lease 冲突;现在调度先标出冲突,并保留独立文件的工作。 可观察交付是调度与 canonical lease 共用 Unicode 比较规则,并保留调度原有更宽的子树语义。 范围限于同一调度调用的 scope 比较;临时子任务执行、独立 peer 权限、存储事务和安装资格由原边界负责。

改动思路 / Approach

复用现有 TS caseFold、glob 和 comparisonWriteScopes,删除 Python matcher;具名 scheduling 变体保存已存在的子树规则,比再次移植 Unicode 算法或直接换成较窄 lease 语义更合适。 范围限于同一调度调用的 scope 比较;临时子任务执行、独立 peer 权限、存储事务和安装资格由原边界负责。File/SQLite 的真实 quota should-run 把 Latin、Sigma、sharp-s 别名子任务从可并行改为 write_scope_conflict,同时继续给出独立子任务。

具体改动 / Changes

精确 head a9361897d5f437b393da8c3b14f19aae0dea791e,完整比较基线 ed0972c3190ad9f0e864284bdb1d95bdefefb4a6。验收依据 issue #7652 与 docs/reference/canonical-lease-renew.md,版本 ed0972c3190ad9f0e864284bdb1d95bdefefb4a6;先读原合同/问题,未用本次新写的文档替代独立规范。Host/path case aliases remain overlapping、empty scope set、request spellings 三项均为 implemented;依据是实际调度对照、既有 lease 测试和未改写声明的 comparison-only 实现。 五个路径的全部改动及相关合同条款均已阅读;改动行数只用于定位成本,结论来自真实 caller 与反例。既有 compatibility export 或子树变体有实际调用者,保留原因已经核验。

关键代码讲解

对主干的风险 / Risks

没有发现阻断项。14组 File/SQLite 的真实 should-run 对照覆盖 Latin、Σ/ς、ß/SS、子树、独立文件、glob class 和关闭状态。三个应保持原义的分支完整 orchestration contract 相等;案例中的声明、claim、实际子任务执行和预算消费由既有 owner 管理,测试未启动子任务。70项 Python、16项 TS、Ruff 和 tsc 通过。 native standard premerge PASS:六项直接检查、18项选择检查及当前 CQR 均通过。 不查询或等待 GitHub CI;本地失败、缺少资格和 merge readiness 分开保留。

我的整体评价 / Verdict

这项调度比较修复达到当前任务的验收:大小写别名提前冲突,既有子树、独立文件和关闭行为得到保留。复用现有 matcher 的边界清晰,未增加独立权限或持久状态 owner。没有 rendered presentation 变化。本次验证覆盖 source CLI/runtime;原生 Windows 文件系统、安装宿主和实际模型子任务执行未资格化,也未测量长期吞吐或完整成本。未发现需要阻断此 head 的问题。

English verdict: APPROVE — the scoped scheduling fix is validated with preserved disabled and existing-subtree behavior.

@huangruiteng
huangruiteng merged commit a36e01c into loopx-project:main Oct 29, 2026
2 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.

[Bug]: the quota scheduling layer compares write scopes case-sensitively while the canonical lease owner folds case

3 participants