Skip to content

fix(lock): fail closed when owner metadata is unreadable or invalid#226

Open
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-inspection-b131
Open

fix(lock): fail closed when owner metadata is unreadable or invalid#226
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-inspection-b131

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented May 9, 2026

Summary

This change fixes stale-lock recovery so we never treat unreadable or unparsable owner.json as an absent owner. Previously any read or JSON error was swallowed and the lock directory could be removed while mutual exclusion was still required, which risks concurrent lifecycle mutations or inconsistent state.

Linked Artifacts

  • OpenSpec: openspec/specs/agent-update/spec.md (lock stale recovery and preserving live locks)

Validation

  • bun run memory:check
  • bun run lint
  • bun run format:check
  • bun run typecheck
  • bun run test (if behavior changed)
  • Not run, explained below

Release Intent

  • Release: patch - resource lock stale recovery must not delete locks when owner metadata cannot be interpreted

Docs Updated

  • Not needed
  • docs/...
  • openspec/...
  • Follow-up issue or OpenSpec change created instead

Scope Check

  • I did not add a new ad hoc root-level Markdown file.
  • I updated the relevant issue, ADR, spec, runbook, or captured the missing doc work as follow-up.
  • I did not silently expand project scope without recording it explicitly.

Closure Check

  • Working tree was clean after commit.
  • Branch was pushed and this PR is the active delivery artifact.
  • OpenSpec change is not needed, still active by design until merge, already archived, or queued for agent-driven archive closure.
  • Release is not applicable, delegated to release automation, or verified.

Notes

Regression coverage includes Unix chmod removing read access on owner.json, and invalid JSON contents; both must surface ResourceLockError without deleting the lock directory.

Open in Web View Automation 

@cursor cursor Bot force-pushed the cursor/critical-bug-inspection-b131 branch from 3623434 to e8aaaf6 Compare May 13, 2026 02:25
Only ENOENT/ENOTDIR during owner.json read means missing metadata.
Other errors (e.g. EACCES) or JSON failures propagate; stale removal
then refuses to rm and surfaces ResourceLockError instead of deleting
a potentially live lock directory.

Includes regression tests for chmodded owner.json and broken JSON.
@cursor cursor Bot force-pushed the cursor/critical-bug-inspection-b131 branch from e8aaaf6 to 426174b Compare May 13, 2026 03:28
@Drswith Drswith marked this pull request as ready for review May 13, 2026 06:45
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.

0 participants