Skip to content

Stabilize integrate-sqlite by handling transient SQLITE_BUSY in Dredd hooks#3930

Open
Copilot wants to merge 4 commits into
developfrom
copilot/fix-integrate-sqlite-job
Open

Stabilize integrate-sqlite by handling transient SQLITE_BUSY in Dredd hooks#3930
Copilot wants to merge 4 commits into
developfrom
copilot/fix-integrate-sqlite-job

Conversation

Copilot AI commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

integrate-sqlite was failing intermittently due to SQLITE_BUSY lock contention while Dredd hooks were creating prerequisite capability data. The hook process treated these transient lock errors as fatal, causing the job to exit.

  • Root cause in hook capability setup

    • .dredd/hooks/capabilities.go performed capability writes without retry behavior for SQLite lock contention.
    • A transient DB lock during fixture creation caused a panic and terminated hooks.
  • Concurrency + retry hardening

    • Serialized addCapabilities() execution with a package-level mutex to reduce concurrent write contention in hooks.
    • Added bounded retries (maxAttempts = 5) around capability resolution.
    • Added backoff using a named base delay constant:
      • const sqliteBusyRetryBaseDelay = 100 * time.Millisecond
      • delay progression: 1<<attempt * baseDelay
  • Retry classification

    • Added isSQLiteBusyError(err) and retried only for lock-contention signatures:
      • SQLITE_BUSY
      • database is locked
      • database table is locked
    • Non-transient errors still fail fast.
const sqliteBusyRetryBaseDelay = 100 * time.Millisecond

for attempt := 0; attempt < maxAttempts; attempt++ {
    // resolveCapability(...)
    if err == nil {
        return
    }
    if !isSQLiteBusyError(err) {
        panic(err)
    }
    time.Sleep(time.Duration(1<<attempt) * sqliteBusyRetryBaseDelay)
}

Copilot AI changed the title [WIP] Fix failing GitHub Actions job integrate-sqlite Stabilize integrate-sqlite by handling transient SQLITE_BUSY in Dredd hooks Jun 8, 2026
Copilot finished work on behalf of fiftin June 8, 2026 23:27
Copilot AI requested a review from fiftin June 8, 2026 23:27
@fiftin fiftin marked this pull request as ready for review June 9, 2026 09:12

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security review — no findings

Reviewed PR #3930 (.dredd/hooks/capabilities.go retry/mutex changes and go.mod/go.sum dependency cleanup).

Scope: Changes are confined to Dredd API-test hooks (CI-only; explicitly not for production) and indirect dependency tidying. No production API, auth, or request-handling code is modified.

Checked:

  • Injection / unsafe deserialization — no new user-controlled input paths; caps and DB operations are driven by hardcoded test hooks.
  • Authn/authz bypass — not applicable; test harness uses fixed admin tokens and local test DB setup.
  • Error-string retry matching (isSQLiteBusyError) — only affects SQLite lock retries in CI; errors originate from the test DB layer, not remote attackers.
  • Mutex + exponential backoff — serializes test DB setup under lock contention; no production DoS surface.
  • Panic-to-error recovery — scoped to resolveCapability in test hooks; non-busy errors still panic immediately.
  • Dependency changes (bbolt removal, golang.org/x/sync indirect version in pro/) — housekeeping only; no new runtime dependency with known CVE exposure introduced by this PR.

Prior threads: None from earlier automation runs.

Outcome: No medium, high, or critical vulnerabilities identified in added or modified code.

Open in Web View Automation 

Sent by Cursor Automation: Find vulnerabilities

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.

2 participants