Repository navigation
Conversation
`process --reinvestigate` and direct mode (`--diff`, `--files`, `--files-from`) claimed every selected file, including a file that another run had locked and was still investigating. Each run writes the whole FileRecord back from its own snapshot, so the later write dropped the other run's findings and analysis history. The claim step now skips a `processing` file whose lock isn't reclaimable, which is the rule the default path already applies. Analyzed files, abandoned locks, and the resumed run's own files are still claimed.
|
@tlq5l is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
🤖 auto-maintain reviewAutomated, advisory triage for
Review panel: 🔴 high highest severity deepsec maintainer code review: 🔴 high
General code review: 🔴 high
Scanner and matcher quality: 🔴 high
Sandbox and credential boundaries: 🟡 medium
Durability and distributed state: 🔴 high
Posted by auto-maintain. This automated code review is advisory; a human maintainer makes the call. |
In `--reinvestigate` and direct mode, the claim step skipped every `processing` file whose lock wasn't reclaimable. A sandbox re-run after a worker crash couldn't re-claim that worker's files, because the PID of a run on another host can't be probed. An `analyzed` record that still carried a live lock was claimed. The claim step now skips a file only when its lock isn't reclaimable and the owning run started on this host, whatever the record's status. Locks held by a run on another host are taken, as on `main`. It also queues the record it just claimed, not the startup snapshot, so findings another run wrote after the snapshot was loaded aren't overwritten.
In `--reinvestigate` and direct mode, the claim step left a file alone only when the run holding its lock started on this host. A lock held by a run on another host was taken even though it wasn't reclaimable, so two runs sharing a data directory could still investigate the same file and overwrite each other's findings and history. The claim step now leaves a `processing` or `analyzed` file alone while another run's lock on it isn't reclaimable, whatever host that run is on. A lock is reclaimable when its run is done, errored, or missing, when the run's PID is dead on this host, or when the lock is 1 hour old, as in the default path. Analyzed files without a live lock and the resumed run's own files are still claimed. Direct mode (`--diff`, `--files`, `--files-from`) now prints one warning that counts the requested files it skipped because another run holds them and names up to five. The exit code is unchanged. A sandbox re-run with `--reinvestigate` soon after a worker crashed now skips that worker's files until their locks become reclaimable, because the PID of a run on another host can't be probed.
The three lock tests each wrote the same run metadata file inline. A writeRun helper now writes it from the fields the tests vary: hostname, phase, and PID.
The test holds the claim mutex while process() loads its snapshot, then lets another run finish the file and clear its lock. The claim must queue the record it re-read, not the snapshot, or the run writes the snapshot back and drops the other run's findings and history.
|
Thanks for the review. You were right: force mode only respected a live lock when the owning run was on this host. The new commits drop that host check, so force mode now leaves a file alone whenever another run's lock isn't reclaimable, on any host. Tests cover a fresh lock from another host (left alone), an old lock and a finished run's lock (both taken), and a claim that keeps another run's newer findings. I've updated the description to match. |
|
Fixed in 8c134df:
I left the |
… mode on skipped files A fresh lock held by another run now blocks a claim whatever the record status (pending and error included). An unparseable or future lockedAt is treated as reclaimable. process() returns skippedCount, and direct mode exits 1 when it is non-zero so a forged or live lock can't pass the CI gate. Agent: claude
The default-mode selector dropped processing records with a live foreign lock before the claim step, so they were never warned about or counted in skippedCount. Pass them to the claim step, which already skips and counts locks it can't reclaim. Agent: claude
|
Thanks. Fixed in f310548 and cbb0f7d:
Ran live: the bundled CLI in direct mode with planted locks. Fresh foreign locks exit 1; expired, garbage-dated and dead-PID locks are reclaimed and exit 0. |
|
Closing this. Review found that direct mode still rewrites the file record in |
Fixes #182. With
--reinvestigateor a file list (--diff,--files,--files-from),processclaimed files another live run was still investigating, and the last run to finish overwrote the other's findings andanalysisHistory. In those modes the claim step now skips a file while another run's lock on it isn't reclaimable: its run is done, errored, or missing, its PID is dead on this host, or the lock is older than 1 hour.--limitcounts claimed files, so locked ones don't use up slots. The exit code is unchanged.STALE_LOCK_MS), since its PID can't be probed from here.process-revalidate.test.tscover live, dead, own, and analyzed locks in both modes, cross-host locks, the warning, and the snapshot case.pnpm lintand the processor build pass.processbehavior is unchanged, and a resumed run still claims its own files. This is the lock fix from fix: harden deepsec processor locks #85, resubmitted on its own.Ran live:
process --reinvestigate --limit 2with two files locked by a live run analyzed 0 files before 8c134df and 2 after, warning about the 2 skipped files.