Skip to content

A second --resume of a crawl held by a live owner keeps crawling it #1026

Closed

Description

@nc9

Summary

Follow-up to #946. The crawl lease makes a second process that --resumes a crawl whose live owner already holds the lease only yield its heartbeat (the lease writer is a compare-and-set), but it keeps crawling. Two processes can then write one crawl at the same time.

This is not a deletion path (the lease keeps the crawl from being retired); it is duplicate work and interleaved writes to one crawl.

Acceptance Criteria

  • squirrel audit --resume (and crawl) on a crawl held by a live owner, fresh heartbeat on this host or another, does not continue crawling it as a second writer: it either starts a new crawl or stops with a message naming the owner pid and host
  • A crawl whose owner is gone (dead pid on this host, or stale heartbeat) is still resumed and takes the lease over, as today
  • A test covers two concurrent resumes of one crawl
  • Docs for --resume describe the behaviour; CHANGELOG has an entry

Activity

  1. added
    enhancement
    size: S
    on Oct 22, 2026
  2. WilliamK112 commented on Oct 24, 2026

    @WilliamK112
    Contributor

    I would like to take this. I will trace the resume/lease handoff in both audit --resume and crawl, make a live owner prevent a second writer while preserving stale/dead-owner takeover, add a concurrent-resume regression, and update the resume docs plus changelog.

  3. WilliamK112 commented on Oct 27, 2026

    @WilliamK112
    Contributor

    Implemented by commit 1966e24 and included in release batch #1149 / v0.0.134. The shipped change gates both audit --resume and crawl --resume, preserves stale and exited same-host takeover, adds the two-process claim regression, and updates the resume docs and changelog. This issue can be closed.

  4. nc9 commented on Oct 27, 2026

    @nc9
    ContributorAuthor

    Accepted (2026-10-27): fixed by 1966e24 ("fix(crawler): gate concurrent crawl resumes"), first shipped in v0.0.134.

    • A live owner is not resumed as a second writer. crawlLease.claim() gates audit --resume and crawl --resume (apps/cli/src/controllers/audit.ts, controllers/crawl.ts). A claim that fails starts a new crawl and warns with the owner's pid and host (formatResumeClaimWarning, apps/cli/src/audit/crawl-lease.ts).
    • A gone owner is still taken over. A stale heartbeat or a dead same-host pid is claimed. packages/crawler/tests/crawl-lease.test.ts has "claim takes over a stale or same-host dead owner".
    • Concurrent test. "two concurrent same-host resumes cannot both claim one live crawl" runs a child process (tests/fixtures/crawl-lease-claim-child.ts).
    • Docs and changelog. docs/cli/audit.mdx ("Resume an interrupted crawl") and docs/cli/crawl.mdx, and a CHANGELOG entry naming A second --resume of a crawl held by a live owner keeps crawling it #1026.

    Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementsize: S

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions