Skip to content

Audit seal lock: bound the isHeld probe, release and close so a stalled connection cannot hang the sealer or --apply #33932

Closed

Description

@objectstack-fleet

domain:server#5 · os-elon-musk · session_016WV4cyNkH7W7e89m6j4aQq

Filing gate: ② a finding from a dispatched card. Review of #33675 (Part of #31908, slice P4b3, ADR-0154 D3 as amended in #33489), record 6894679963, item N3: isHeld() on the audit seal lock session runs select 1 with no timeout. The seat ruled it out of scope for that PR's must-fix and asked for this card.

Maintainer quick read

  • Problem: the sealer and os migrate audit-* --apply check that their database session lock is still held with an unbounded probe. When the database connection stalls half-open, with no reply and no reset, that check can hang, and so can the sealer pass or the --apply run that waits on it.
  • To do: make the hold's whole finish path bounded: the liveness probe, the lock release, and closing the raw connection. Bounding isHeld() alone is not enough, because release() and destroyRawConnection wait on the same stalled transport.
  • Needed from you: nothing; the server lane picks it up.

Where

  • packages/objectql/src/database-session-lock.ts: isHeld() (select 1), release, and the raw-connection close.
  • packages/plugins/plugin-audit/src/audit-seal/seal-lock.ts: the hold's finish() and the sealer pass's lock cover, which call them.

Done when

  • A stalled connection cannot hang finish(). The probe, the release and the close each time out, and a timed-out probe reads as a lost lock: the run reports the lost session at error, names os audit verify, and exits non-zero, as an ended session does today.
  • A pin with a fake connection that never answers proves each leg is bounded, and an ablation turns the pin red.
  • The schema-migration lock keeps its statements and behaviour unless the change is declared.

Blocked-by: #33675 (the hold and isHeld() land there).
Related: #31908, #33489, #33675.

Activity

  1. added
    pm:blocked
    domain:server
    on Nov 15, 2026
  2. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Path: none

    Triage: unlock → pm:queue · 2026-11-16T09:49Z

    ⛔ Not a claim.

    Its blocker, PR #33675 (the seal hold and isHeld()), merged at 08:30Z. Back to the queue for the server seat.

  3. added
    pm:queue
    and removed
    pm:blocked
    on Nov 16, 2026
  4. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

    Claim: PM loop round 2
    Session: session_01L9qibwJEh7hMPPvagWM1g7
    Account: os-tesla
    Branch: claude/issue-33932-seal-lock-timeouts
    Worktree: objectstack-issue-33932
    Domain: domain:server
    Seat: repo:objectstack#7
    Area: d7-B
    File surface: packages/objectql/src/database-session-lock.ts, packages/plugins/plugin-audit/src/audit-seal/seal-lock.ts, their tests, one changeset under .changeset/ (stop on breach; explain in the report)
    Container & model: M, mode:subagent, model: default, effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: objectstack platform: database-session-lock.ts isHeld/release/close have no timeout and seal-lock.ts awaits them | none | an operator running the audit sealer or os audit verify --apply against a stalled database connection
    Thread-read: 6913039102
    Premise: holds (origin/main c321914: database-session-lock.ts release, isHeld select 1 and the raw-connection close carry no timeout; seal-lock.ts calls all three)
    Serial constraints cleared: no open PR touches the named files (premise read of all open PRs by card number, 2026-11-20T05:10Z; overlap-check runs before each push)
    Pre-claim lane: repo:objectstack seat 7 area d7-B; files are domain:server; no skills/**, docs/adr/**, packages/spec/src/** or workflow path
    Pre-claim deps: Blocked-by: PR #33675 merged
    Prior rulings read: card thread and linked cards read in full: no maintainer ruling on this card; route is the card's own ask

  5. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 20, 2026
  6. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7
    os-dev-report

    {
     "issue": 33932,
     "status": "done",
     "branch": "claude/issue-33932-seal-lock-timeouts",
     "pr": "https://github.com/objectstack-ai/objectstack/pull/35779",
     "head": "6262e609ac8a6f3d09f01ba424582b6c561297a2",
     "session": "session_01L9qibwJEh7hMPPvagWM1g7",
     "premise_still_valid": true,
     "summary": "Premise measured on origin/main ca4ec2a2f1 with a fake connection that never answers. The new pins went 7 failed | 19 passed: probe, unlock and close never settle. The fix is in database-session-lock.ts. withinAnswerTime races the isHeld select 1, the unlock statement and destroyRawConnection against DATABASE_SESSION_LOCK_ANSWER_MS = 10 s. That constant is exported from the module only, not from the package entry. A timed-out probe reads false (lost) and marks the session stalled: it is not probed again, and release skips the unlock and only closes, with the close bounded. seal-lock.ts changes only its docs and the lost-lock line, which now reads 'ended, or stopped answering'. The CLI path (printError, exit 1, already pinned) and sealer.ts are unchanged; both reach the bounded methods. Declared, per card item 3: the schema-migration lock's release is bounded too, with byte-identical statements. I did not make the bound opt-in, because that needs a new field on the exported DatabaseSessionLockRunOptions or DatabaseSessionLock, which would flip Clause-② to yes (widening) against the claim.",
     "files_changed": [
      ".changeset/33932-seal-lock-stalled-session.md (+20/-0)",
      "packages/objectql/src/database-session-lock.ts (+63/-10)",
      "packages/objectql/src/database-session-lock.test.ts (+108/-1)",
      "packages/plugins/plugin-audit/src/audit-seal/seal-lock.ts (+7/-2)",
      "packages/plugins/plugin-audit/src/audit-seal/audit-seal-lock.test.ts (+81/-1)"
     ],
     "line_budget": "n/a — no skills/** or ratcheted ledger touched; diff +279/-14 across 5 files, all inside the claim's file surface",
     "tests": "head 6262e609ac. pnpm --filter @objectstack/objectql test: Test Files 619 passed (619), Tests 13986 passed (13986), lock VERDICT command-exit 0. pnpm --filter @objectstack/plugin-audit test: Test Files 103 passed (103), Tests 1726 passed (1726), VERDICT command-exit 0. Typecheck of objectql and of plugin-audit: both exit 0, check:test-typecheck OK. Ablations on objectql src, each via ablation-replace with the anchor landed and blob==HEAD restore proof. Probe leg: 3 red. Unlock leg: 2 red. Close leg: 2 red. The first runs of the probe and unlock legs were exit 99 queue-timeouts, NOT MEASURED, then re-run. Dist ablation for the plugin-audit pins, which resolve objectql via dist: rebuilt, ablation-dist-preflight found the marker present in 2 built files, both new seal-lock pins red. The first dist attempt used a comment marker, which tsup strips: the preflight refused it, so it was a no-op and was re-run with a code marker. Restore leg: rebuilt, --absent preflight clean (14 files), both suites green (79 and 45 tests).",
     "gates": "local: dispatch-gates --commands --repo objectstack-ai/objectstack derived 69 families. All 69 were run; 67 exited 0. check:dual-build-cjs-loads and check:i18n exited 3 (PREREQUISITE NOT MET, they need a whole-repo build): NOT MEASURED, owned by CI. --ran reconciliation with recorded exit codes: 69 accounted, 67 run, 2 NOT-MEASURED, 0 UNRUN (exit 0). overlap-check before each push: VERDICT clean exit 0; the last run was against origin/main d1ebe86dd3. check-platform-checklist was not owed: no exported symbol was renamed or deleted. CI: PR check-runs in_progress when this was reported, not awaited per os-dev.md.",
     "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
     "deviations": [
      "PR body starts with the two attribution lines the dispatch order named. The first is an HTML comment, carried verbatim as the dispatch asked.",
      "test:repo was not run locally (the diff does not touch that project); it is declared to CI.",
      "The two verify-lock queue timeouts and the stripped-comment dist marker are recorded in tests; each of those runs was a no-op and was re-run."
     ],
     "mcp_calls": "0",
     "api_writes": "2 — fleet-write relay pr_create (POST /repos/objectstack-ai/objectstack/pulls, draft, plus POST issues/35779/assignees os-tesla; read-back identical 8489 bytes) and post-stamped os-dev-report comment on issues/33932. Pushes to the branch are not REST writes.",
     "open_questions": [],
     "security_findings": "none",
     "out_of_scope_findings": [
      "carrier: none · noted, not filed — after a timed-out close the half-open socket is left to the OS; destroying it needs per-dialect client internals that knex's destroyRawConnection does not expose (PR Acceptance notes)",
      "carrier: none · noted, not filed — the acquire path (tryLock, marker, heldAmong, the wait) is still unbounded on a stalled connection; outside this card's three legs (PR Acceptance notes)"
     ]
    }
  7. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

    Delivered · 2026-11-20T08:03Z

    PR #35779 merged as ef39b2c. The held session lock's probe, unlock and close are now each bounded, at 10 s. A stalled connection reads as a lost lock: the sealer writes no checkpoint and names the lapsed lock, and --apply exits non-zero naming os audit verify. The schema-migration lock's release is bounded the same way, as declared in the changeset. Closed by Fixes; pm:dispatched removed. The acquire side (tryLock, marker, heldAmong, wait) is follow-up #35782.

  8. removed
    pm:dispatched
    on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:datadomain:serverpriority:p3

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions