Skip to content

refactor(infra): keep SQLite signal reads out of worker runtime - #200179

Merged
vincentkoc merged 1 commit into
mainfrom
fix/sqlite-inspection-signal-imports-20261116
Nov 16, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/sqlite-inspection-signal-imports-20261116

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Callers that only read the current SQLite inspection cancellation signal import the worker facade and its pool machinery. The signal's existing scope owner can answer that query directly.

User Impact

Cancellation keeps the same scope, caller-first abort reason, and retired-scope behavior. Internal consumers avoid the unnecessary worker import path. No configuration, schema, or public API changes are required; no measured RSS saving is claimed.

Why This Change Was Made

The unchanged getter moves to the existing SQLite read-only worker context module. All 48 internal consumers use that owner, with mixed consumers retaining their worker imports for actual worker operations. The old facade export is removed. Production changes are net -5 lines; tests add 55 lines.

Evidence

Baseline: 4bce7604f0a5e6a706d06cf4243708379a79f0e6. Candidate: 76bb70dae25c1b391873be34bde7eb5f5ab123b2.

Three fresh source-mode processes on Node 24.22.1 established the original boundary: the context control loads 7 module URLs, the doctor migration context 536, and the client credential store 953. The latter two load the read-only worker and pool modules. These are loaded file URLs including dependencies, not compiled-module or memory measurements.

On the same runtime, the candidate keeps the context control at 7 URLs and reduces the migration context from 536 to 210 and the credential store from 953 to 870. All three preserve isolated configuration. Neither consumer loads the read-only worker facade or pool through the signal query.

Seven focused suites produced 95 passing cases and six named macOS-only skips on Linux. Coverage includes scope cancellation and caller-first abort reasons, real credential-worker retirement/recreation, shared-client custody, real inspection cancellation, facade IPC/disposal, and four static import boundaries. The first proof process exited 1 because its collector expected 20 facade cases instead of the actual 22; all test commands exited 0. The saved JSON/JUnit reports were independently checked, with rejection checks for missing, duplicate, pending, failed, and unexpected skipped cases. That run has no final source seal.

The separately closed remaining-gates run passed targeted formatting, lint, four type graphs, and a full build with declarations enabled. Its before/after/build/completion seals match all 63 source files and 232 dependency inputs from the focused run. It reran no tests and preserves the first collector failure explicitly. The build completed with six soft Control UI budget warnings; these are recorded warnings, not a claim that those budgets passed.

Native proof runs: focused cases and source witnesses and remaining gates and full build. Their delegated Actions sessions ended cancelled during native cleanup; the scoped results above come from the retained command/report receipts, not that Actions conclusion.

Independent source review completed all three declared ownership groups with no actionable findings. Runtime and build evidence are tracked separately from that review.

The completed PR CI run tested merge c29b9162ec0f3df9d6270e8caf6af4a3aa55b4e3 (base 472cd0a2f542599eea763f013eba2d34033ca25f, candidate above). Its 115 jobs ended with 88 successes, 25 skips, one underlying failure and the failed aggregate gate. Security and the PostgreSQL jobs passed. The two failing readiness cases wait on fs.access, while the existing executable-viability owner uses its executable probe followed by fs.stat. Those test/support/owner files are byte-identical at the base, candidate and tested merge; the viability change predates both parents. This is source/history-attributed inherited failure, not a passing baseline rerun. Existing PR #200133 owns the readiness-test repair, so it is not duplicated here. The native inherited-CI landing evidence preserves the failed run and exact tested merge.

Exact-head ClawSweeper review reports no findings or remaining moves. The source head remains unchanged.

@vincentkoc vincentkoc self-assigned this Nov 16, 2026
@clawsweeper

clawsweeper Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@vincentkoc
vincentkoc marked this pull request as ready for review November 16, 2026 17:02
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 76bb70dae25c1b391873be34bde7eb5f5ab123b2
  • Maintainer: @vincentkoc
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/auth-profiles/shared-store-bootstrap.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/infra/client-credential-store.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/infra/state-migrations.shared-auth-store.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 16, 2026
@clawsweeper

clawsweeper Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Moves SQLite cancellation-signal reads to the existing scope context and updates internal consumers to avoid importing worker machinery.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused, correct refactor supported by source and passing build/boundary checks; detailed runtime receipts were unavailable and broad CI remains unfinished.
Proof confidence 🦐 gold shrimp (3/6) This behavior-preserving refactor requires no shipped-entry-point demonstration; source inspection and exact-head build and boundary checks support the changed import contract.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
Reason: Maintainer-authored direction removes unnecessary runtime imports while preserving the established scope and worker owners.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR makes a focused ownership cleanup that current main still needs, with no actionable correctness or security findings.

Priority: P3
Reviewed head: 76bb70dae25c1b391873be34bde7eb5f5ab123b2

Before merge

None.

Findings

None.

Agent review details

How this fits together

Doctor, credential storage, and database inspection consumers combine caller cancellation with the existing SQLite scope signal; actual worker operations continue through the worker facade.

flowchart TD
  A[Internal consumers] --> B[Worker scope context]
  C[Caller cancellation] --> B
  D[Scope cancellation] --> B
  B --> E[Combined inspection signal]
  A --> F[Worker facade for operations]
Loading

Technical review

Best possible solution:

Keep the unchanged signal getter with its existing scope owner and retain worker imports only for actual worker operations.

Do we have a high-confidence way to reproduce the issue?

Source shows signal-only consumers importing a facade that initializes the worker pool; this read-only review executed no target code.

Is this the best way to solve the issue?

The move uses the existing scope owner, preserves cancellation semantics, removes the superseded export, and migrates internal callers without adding another abstraction.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4a0e45492b89.

Provenance checked

  • Inspection cancellation getter keeps the original intent (ec9de37: Retain unfinished agent inspections under Gateway lifetime cancellation rather than their foreground wait.)
  • Read-only worker scope context keeps the original intent (43d85e5: Carry reusable reader scope through detached callbacks while retaining scope-owned cancellation and cleanup.)
  • Generic database migration context keeps the original intent (a238f1c: Keep migration inspection machinery out of generic database-opening worker graphs while preserving migration and abort behavior.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 43d85e5 adds src/infra/sqlite-readonly-worker-context.ts:14 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 43d85e5f9ac3; files: src/infra/sqlite-readonly-worker-context.ts)

PR surface

Source -5, Tests +55. Total +50 across 53 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 50 62 67 -5
Tests 3 62 7 +55
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 53 124 74 +50

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test LOC Production +62/-67 (net -5); tests +62/-7 (net +55) Production changes relocate existing logic and imports; test growth protects cancellation semantics and lightweight import boundaries without new production machinery.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is a behavior-preserving internal dependency cleanup with no demonstrated user-facing regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 16, 2026, 12:19 PM ET / 17:19 UTC.

@vincentkoc
vincentkoc merged commit 410c0dd into main Nov 16, 2026
222 of 225 checks passed
@vincentkoc
vincentkoc deleted the fix/sqlite-inspection-signal-imports-20261116 branch November 16, 2026 17:42
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 17, 2026
maplel pushed a commit to maplel/openclaw that referenced this pull request Nov 24, 2026
…law#194599)

An agent database on an older schema is now reported as a required state migration, so the managed service is parked with the existing "run openclaw doctor --fix" guidance instead of restart-looping the Gateway. The session-SQLite import still defers such a target and processes the others (fixes openclaw#194580).

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: steipete <[email protected]>

(cherry picked from commit 8bea0c1)

Release adaptation: Classify only older canonical agent schemas as existing state-migrations maintenance; Doctor continues deferring matching targets. Keep newer schema refusal/media migration identity. No schema/version/data migration changes; retain focused Gateway parking, committed reader and Doctor regressions. Later cancellation-owner and unrelated Doctor repairs are not prerequisites.

Follow-up dispositions: 410c0dd refactor(infra): read SQLite cancellation from its scope owner (openclaw#200179); 8cd7d87 chore(ci): drop retired test-lines allocation records (1/3) (openclaw#197655); 0e966cc fix: avoid agent database stalls after worker retirement (openclaw#194484); ef47e2e fix(doctor): defer update session-entry inspection when snapshot space runs out (openclaw#196370); 715c610 fix(doctor): repair retained ISO session end timestamps (openclaw#194685)

Validation: Source baseline old-schema error was generic SqliteSchemaMismatchError and did not trigger service maintenance parking. Matching existing maintenance codec and Doctor catch reviewed; exact regression group queued. diff check passed.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit f61a73edfda73dc6452f3e0e534cb9e891c05ae6)
(cherry picked from commit 4e8445923f2522eb6b42ab705e15624a1a674a39)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security-sensitive-changed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant