Skip to content

fix(leases): treat a recursive glob segment as matching zero directories - #8680

Open
Duang777 wants to merge 1 commit into
loopx-project:mainfrom
Duang777:codex/lease-recursive-glob-overlap-20261113
Open

Duang777 wants to merge 1 commit into
loopx-project:mainfrom
Duang777:codex/lease-recursive-glob-overlap-20261113

Conversation

@Duang777

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

  • Outcome basis / optional anchor: self-found core defect. No public issue; the request in this PR is the basis.
  • Goal/source and gap: scopePairOverlaps in task_lease_acquire_decision.ts treated a **/ segment as needing at least one directory, so a recursive glob lease and a file the glob covers were judged disjoint. That function decides task-lease acquire, atomic todo claim, the worktree check and quota scheduling.
  • Observable before → after, with the validation row that proves it: src/**/*.py vs src/a.py, **/*.py vs setup.py and docs/**/*.md vs docs/a.md returned no overlap, so a second agent acquired an "exclusive" lease on a file the first agent already held (acquired: true). After: they conflict (write_scope_conflict). src/**/*.py vs docs/a.py, src/a.md and srcx.py stay disjoint. Rows: regression_parity, unit.
  • Issue/task and intended base: none. Base is main at 7bb1b01.

Author Declaration

  • Written by: agent, Claude Sonnet 5.5, for @Duang777

Implemented against

  • Specification and revision: no written specification; the request in this PR is the basis.
  • Criteria:
Criterion (spec clause) Disposition Symbol / path Test or command
A hard lease must conflict with any file it covers implemented scopePairOverlaps, folded matcher in task_lease_acquire_decision.ts tests/control_plane_ts/task_lease_directory_scopes.test.ts, tests/control_plane/test_task_lease.py::test_write_scopes_overlap, tests/control_plane/test_canonical_lease_scopes.py
Disjoint scopes stay disjoint implemented same same files, negative cases
  • Self-check before submission: reproduced the defect on the unfixed code, then confirmed the new test fails before and passes after. Did not run the full suite or CI-equivalent gates locally. Read the Python lease facade, the lifecycle and decision TS, and found no other provable defect. The case-sensitive scope-coverage path keeps plain fnmatch.

Scope And Continuation

  • Completed scope and remaining work: complete within this scope. Glob-vs-glob overlap is still decided by comparing literal prefixes, which is conservative and not a defect today.
  • Slice boundary / successor: N/A, one independent defect.

Validation

  • Tested revision: 007c069051828713d3b82f684508735e907e5732 for the diff; local runs used a working tree whose touched files were blob-identical to main 7bb1b01 before the change.
  • Run state: finished
  • Input classes: synthetic
Check kind Result Public-safe evidence / limitation
regression_parity passed New cases (6 TS, 2 Python rows, 4 CLI cases over file and SQLite providers, both argument orders) fail on the unfixed matcher and pass with the fix.
unit passed task_lease_directory_scopes.test.ts 36/36; lease-scope Python tests pass except test_alias_acquire_keeps_original_request_identity_after_renewal (both providers), which failed identically without this change on the stale local tree and was not re-checked on main.
integration not_run Full TS lease and quota suites were not re-run on main; on the stale local tree three unrelated TS tests failed with and without this change.
  • Coverage and gaps: The matcher change is local to the folded lease path. CI on this head is the authoritative run; the three TS failures above need confirming as local-tree artifacts.

Frontend / Visual Evidence

  • UI impact: none

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.

Shared-authority RFC fixture impact

N/A

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 passes, or no paired RFC changed. No 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).

🤖 Generated with Claude Code

Lease write-scope overlap evaluated `**` as a plain fnmatch star, so the
`**/` segment demanded at least one directory separator. `src/**/*.py`
therefore did not overlap `src/a.py`, and `**/*.py` did not overlap
`setup.py`, even though a recursive scope denotes files directly under its
literal prefix as well. Two exclusive hard leases (or two atomic Todo
claims) over `src/**/*.py` and `src/a.py` were both granted, so two agents
could write the same file under "exclusive" leases.

Read a whole-segment `**/` as zero or more directories in the folded lease
overlap matcher. The case-sensitive coverage view keeps its existing plain
fnmatch interpretation, and glob/glob and literal-directory comparison are
unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: duang777 <duangjl007@gmail.com>

This branch has not been deployed

No deployments
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.

1 participant