Skip to content

perf(update): keep update migration attribution off generic database paths - #199943

Merged
steipete merged 4 commits into
mainfrom
codex/g84-lazy-pg-attribution
Nov 16, 2026
Merged

steipete merged 4 commits into
mainfrom
codex/g84-lazy-pg-attribution

Conversation

@steipete

@steipete steipete commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Related: #197510

What Problem This Solves

Fixes: the installed package grows toward the 50,000-entry limit that released updaters enforce, because every worker that opens a database copies update/Doctor migration attribution (and the update inspection code behind it) into its private build.

User Impact

User impact: no behavior change for users. It recovers installed-package headroom (about 56 entries now) and stops future database-opening workers from pulling update inspection code, which slows the drift toward the limit where updates from 2026.9.x stop working.

Why This Change Was Made

database-engine/open.ts, the state DB fast path, current reader, open/maintenance/repair paths and the client-credential store imported update-doctor-migration-attribution.ts directly. That module drags in update-candidate-state.* inspection and update-database-generations. Since #197510 made the fs-safe copy worker host workspace filesystem operations, that worker's graph grew from 292 to 1,124 modules.

src/infra/update-doctor-migration-context.ts now owns the capture AsyncLocalStorage, the light read helpers (hasUpdateDoctorMigrationCapture, getUpdateDoctorMigrationSource, getDoctorMigrationBackup) and the entry points generic database code calls (runUpdateSqliteMigration[Async], beginUpdatePostgresMigration, beginUpdateSqliteCompanion). Without an active capture these behave exactly as before: run the operation or return undefined, and the async path keeps its abort-signal check and synchronous-callback refusal. Under a capture they dispatch to the attribution owner, which update-doctor-migration-attribution.ts registers inside runWithUpdateDoctorMigrationCapture, the only place a capture becomes active. Doctor/update callers are unchanged. The new module is added to the PR wrapper source inventory.

Evidence

  • Worker graphs (tsdown probe, base 1cb3f179eac → fix): the attribution module is absent from all 12 probed private worker graphs. Emitted files: fs-safe-copy 136 → 126, disk-budget 59 → 52, service-child-group-anchor 41 → 33, transcript-reconcile 37 → 31, openclaw-state-read 327 → 321, session-transcript 381 → 376, native-hook-relay 218 → 214, sqlite-readonly-location 103 → 102.

  • Installed package (npm 12 install on Crabbox AWS): main 25c97908924 46,768 → head c0ef2b277a2 46,712 entries (earlier head 6168a0413fc: 46,771 → 46,715).

  • Bound test: keeps database-opening workers outside update migration attribution (test/scripts/tsdown-config.test.ts) builds the fs-safe-copy worker with its real private config. It fails with base sources (update inspection modules in the graph) and passes on head c0ef2b277a2.

  • Native lanes on head c0ef2b277a2 (relabelled 2026.11.30): published 11.3 → fix via CLI succeeded (rc=0, readyz 200, 1 retained runtime, watched strings 0), and a managed update.run with a chat requester succeeded (readyz core, active).

  • Checks: tsgo:core, tsgo:core:test, oxlint and oxfmt clean; test-line ratchet +58 of 400. The attribution, open, Doctor backup/schema, client-credential, state-DB-open and dialect-ratchet suites pass. 25 tests in update-command-migrated-schema, doctor-health-startup.signal and two attribution cases fail identically on base locally (rollback-state-unverified), so they are pre-existing and environment-dependent.

  • Reviews on head c0ef2b277a2: autoreview scoped-clean at P2; the independent codex exec review (read-only) found nothing.

  • Remaining headroom: this doesn't reverse the overall trend. The structural lever, consolidating tiny shared chunks in the unified graph, is a build-owner decision recorded in the update-reliability ledger.

  • Branch refresh: main was merged in at 25c97908924 to pick up fix(ci): core lint fails on main after the MCP catalog JSON snapshot change #199944 (core lint broken on main); the PR's own diff is unchanged.

@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.

@steipete
steipete marked this pull request as ready for review November 16, 2026 04:10
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime cli CLI command changes commands Command implementations size: M labels Nov 16, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T05:33:42.423342Z c0ef2b2 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 16, 2026 •

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: c0ef2b277a22f7349a0239c94c58c2c95223ffd6
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/infra/client-credential-migration.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.

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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head af28594a8f5375fa2c6edffff8e779af97fca897, but the PR head is now c0ef2b277a22f7349a0239c94c58c2c95223ffd6. Its old verdict and PR readiness labels are no longer current.

Next step
Comment @clawsweeper re-review when the current head is ready; pushes after the first review are not reviewed automatically.

Review history (1 earlier review cycle)
  • reviewed 2026-11-16T04:27:30.107Z sha af28594 :: needs changes before merge. :: [P1] Include the new context module in the PR wrapper inventory

@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Nov 16, 2026
@clawsweeper clawsweeper Bot removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 16, 2026
@steipete
steipete merged commit a238f1c into main Nov 16, 2026
314 of 316 checks passed
@steipete
steipete deleted the codex/g84-lazy-pg-attribution branch November 16, 2026 06:24
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 17, 2026
…paths (openclaw#199943)

* perf(update): keep update migration attribution off generic database paths

* test(build): keep update migration attribution out of database workers

* fix(update): list the migration context in the PR wrapper inventory

* Merge remote-tracking branch 'origin/main' into codex/g84-lazy-pg-attribution

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations gateway Gateway runtime P2 Normal backlog priority with limited blast radius. scripts Repository scripts security-sensitive-changed size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant