← Back to Pull requests

fix(leases): treat case aliases as overlapping write scopes #7252

Closed
unknown closed this pull request without merging on Oct 28, 2026 04:06 UTC
View on GitHub
unknown unknown commented on Oct 24, 2026 10:33 UTC
Author

Goal And Delivered Outcome

This prevents a silent exclusive-write bypass for default hard-lease multi-agent goals on case-insensitive Windows and macOS: two agents can otherwise hold active leases for src/Main.ts and src/main.ts, or Unicode-equivalent names such as src/Σ.ts and src/ς.ts, which name one physical file.

  • Outcome basis / optional anchor: #7243, reproduced through the real CLI with both File and SQLite canonical authority.

  • Goal/source and gap: The accepted lease contract requires host/path case aliases to remain overlapping, but the shared acquire decision compared literals, path prefixes and globs case-sensitively, and its character-class comparison above a fixed member count folded only the candidate's own case variants. The adjacent lexical-alias fix in #7204 left this case-alias member of the same bypass.

  • Observable before -> after, with the validation row that proves it: Before the change, a second exclusive acquire for a case-only alias returned status: "applied", acquired: true, and mutated the provider; after the change it exits 1 with write_scope_conflict and leaves provider state unchanged. This includes classes of any interval width, for example src/[ß-\u20df].ts against src/SS.ts and src/[\u212a-\u412a].ts against src/K.ts, and glob token boundaries such as src/?.ts / src/SS.ts, src/S?.ts / src/ß.ts, src/[S]S.ts / src/ß.ts and src/[!Σ].ts / src/SS.ts.

  • Issue/task and intended base: Closes #7243; base loopx-project/loopx:main at f63647e2e867a30dd8761baaa1df69cba9c9860b. This head is rebased onto that revision.
  • Author Declaration

  • Written by: model_agent, OpenAI Codex

  • AI disclosure: this change was drafted with AI assistance at my request, under my direction and review.
  • Implemented against

  • Specification and revision: docs/reference/canonical-lease-renew.md, Repository-relative scope identity, revision f63647e2e867a30dd8761baaa1df69cba9c9860b. The linked issue and default provider contract in local-authority-provider-selection.md define the affected default path.
  • | Criterion (spec clause) | Disposition | Symbol / path | Test or command |
    | --- | --- | --- | --- |
    | Host/path case aliases remain overlapping | implemented | foldCharacter, caseFold, classMemberMatches, fnmatchcase, singleCharacterMatchLengths, scopePairOverlaps in loopx/control_plane/work_items/task_lease_acquire_decision.ts | tests/control_plane_ts/task_lease_workspace.test.ts; tests/control_plane/test_canonical_lease_scopes.py |
    | Case folding is limited to conflict comparison; retained and request spelling stays unchanged | implemented | comparisonWriteScopes, normalizeWriteScopes | scope comparison folds case aliases without rewriting retained or request spelling; operation-identity replay assertion |
    | Character-class membership keeps the original interval, negation order and Unicode alias set at any interval width | implemented | characterClass, foldPreimagesByFold, maximumFoldConsumption, classMatchLengths | wide-interval positive, reversed and negated cases; negated expansion, Σ/ς, ß/SS, ẞ, KELVIN SIGN and astral cases |
    | Glob tokens preserve one-character alias equivalence across token boundaries | implemented | fnmatchcase, singleCharacterMatchLengths | ?/SS, S?/ß, [S]S/ß and [!Σ]/SS overlap in TypeScript and real File/SQLite CLI tests |
    | The shared decision serves both File and SQLite hard-lease authority | implemented | evaluateTaskLeaseAcquireDecision | Parameterized File and SQLite real-CLI test |

  • Self-check before submission: rebased onto f63647e2e867a30dd8761baaa1df69cba9c9860b, read the contract clause and shared callers, and ran the focused and adjacent suites at 7dee604a7f6955929806278f7a1a636082e81bf9; persistence schemas, provider code, request identity and UI remain unchanged. Earlier review rounds found ASCII, simple-class, singleton-range, wide-interval and negated-continuation gaps; those remain as regressions. The latest review found question-mark and cross-token glob aliases, including ? versus SS, S? and [S]S versus ß; matching now runs over the folded code-point stream, and negated classes use the same one-character expansion set. Existing repository-wide suite gaps on native Windows are disclosed rather than claimed green.
  • Scope And Continuation

  • Completed scope and remaining work: Complete within this scope. The fix covers Unicode case-folded literals, path prefixes, the glob token stream, character-class intervals and negated classes at the shared decision owner. Intervals of any width and token boundaries use the same fold equivalence; no configuration, storage or provider migration is needed and no width threshold remains.

  • Slice boundary / successor: N/A. This closes the remaining case-alias member of the exclusive-scope bypass addressed by #7204; no successor is required for this defect.
  • Validation

  • Tested revision: 7dee604a7f6955929806278f7a1a636082e81bf9 (rebased onto f63647e2e)

  • Run state: finished

  • Input classes: synthetic
  • | Check kind | Result | Public-safe evidence / limitation |
    | --- | --- | --- |
    | static | passed | npm run -s typecheck:control-plane; Ruff over the changed control-plane scope and the changed Python test; semantic-vocabulary advisory smoke passed. |
    | unit | passed | Twelve adjacent lease suites passed with 0 failures, including workspace, acquire, acquire CLI, repository, lifecycle, inspection, eligibility, renew, blocked/deferred lifecycle, leased continuation and production-scale fixture; environment-gated PostgreSQL and symlink cases skipped. retained_lease_receipts still fails on native Windows while parsing its unchanged fixed fixture (Bad escaped character in JSON), so it is disclosed and not counted as green. |
    | regression_parity | passed | pytest tests/control_plane/test_canonical_lease_scopes.py -q: 102 passed. Parameterized File/SQLite cases cover question-mark, literal/class token boundaries, negated-class expansion and wide intervals in both scope orders; each rejected acquire or atomic Todo claim leaves canonical provider state unchanged. |
    | real_entrypoint | passed | Real CLI with File and SQLite canonical authority rejects ASCII, Σ/ς, ß/SS, wide intervals, ?/SS, S?/ß, [S]S/ß and [!Σ]/SS for exclusive acquire and atomic Todo claim; replay keeps request identity. An independent 264-case glob/alias oracle reported 0 mismatches. |
    | integration | passed | loopx canary premerge --from-git-diff --git-diff-base upstream/main: 5 direct checks and 17 selected catalog/risk smokes, 0 failures. |
    | manual | passed | The inverse fold map is process-cached. On this host the first mixed comparison took 0.43ms and 3,000 warm wide/narrow/token-boundary comparisons took 18.9ms, so interval width and token expansion do not add a path-length multiplier. |

  • Coverage and gaps: Focused TypeScript, Python and real-CLI File/SQLite paths pass at the current revision, including rejected-write state equality. PostgreSQL was not run because this change is in the shared provider-independent decision and does not alter schema, storage or provider behavior. The repository-wide TypeScript suite was not run; twelve adjacent lease suites passed, while the unchanged retained_lease_receipts native-Windows fixture failure is disclosed above. No installed product or native macOS same-file rerun is claimed: the comparison covers the Unicode case-fold equivalence class and conservatively overlaps aliases that differ between hosts (for example dotless ı and I).
  • 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; no user-visible surface changed.

  • Craft review: N/A; no user-visible 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

  • Direction / acceptance reference, when applicable: Core control-plane hardening; canonical task-lease write-scope authority.
  • Shared-authority RFC fixture impact

  • Production-scale fixture schema: N/A; this PR does not claim shared-authority RFC promotion progress.

  • Semantic dimensions changed, or reviewed no-impact rationale: N/A; only conflict comparison changes, not persisted identity.

  • Provider conformance arms run: File and SQLite through the canonical CLI; PostgreSQL is covered by the same shared decision but was not run locally.

  • Read-only legacy/file/PostgreSQL three-arm rehearsal (required for promotion, runtime-routing, or compatibility-projection changes): N/A; no promotion, routing or compatibility projection changes.
  • 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).
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: JasonBuildAI Review duration: 5372m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #7252"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%