Skip to content

refactor(plugins): release scoped resources after actual work - #140674

Closed
steipete wants to merge 1 commit into
mainfrom
codex/db-next-registry-repair4
Closed

steipete wants to merge 1 commit into
mainfrom
codex/db-next-registry-repair4

Conversation

@steipete

@steipete steipete commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Split complete

All sixty-three focused replacements have landed with separate review, proportional checks, applicable runtime proof, and required CI. This aggregate remains closed and unmerged as the preserved historical reference.

Every replacement has a complete accepted native landing receipt. All 63 merge commits are on main. The final activation landed as 4cac00f89940bac08510360ee92c2194451c00c9; its 11 files exactly match the reviewed and built source. The original aggregate worktree and its 13 staged repairs remain byte-for-byte preserved.

The completed work gives finite consumers explicit custody of plugin resources through preparation, callbacks, cancellation, and physical cleanup. Fresh model-selected RUN registrations now use the existing owner/claim machinery, with warm reuse and bounded idle retention preserved. The internal model helper requires its caller-held snapshot and removes obsolete implicit acquisition. Public SDK and injected TTS contracts remain intact, and shared SDK state remains process-owned.

Final validation passed: required checks, independent Codex reviews, 42 lifecycle/helper cases, 28 Cron cases, a normal build in 208 seconds, and ten compiled runtime groups. Actual SQLite late reads, once-only disposal/reopen, loopback model transport, MCP/LSP cleanup, real OS SIGTERM, and terminal failure fencing passed. A final audit verified the complete source/index and artifact inventories unchanged; all owned runtime processes joined. Individual PR bodies qualify synthetic state, raw-host controls, programmatic donors, and shortened fixture timeouts.

Final-PR CI exposed a shared Cron mock missing the acquisition export; the reviewed fixture correction passed with assertions unchanged. An unrelated Matrix dependency download then returned HTTP 500 before prompt-snapshot tests ran. One unchanged retry and the dependent gate passed. Final exact-head CI is green, and native landing and remote source verification are complete.

Current-source audits found no further established RUN-only lifetime defect requiring another PR. Configured, standalone, active-root, and raw-cache domains retain their existing host contracts. Historical path counts do not require porting every original hunk or activating disposal in untouched domains.

Earlier matched five-sample timings measured warm acquisition around 0.18 ms and fresh-after-release acquisition increasing from 2.79 to 5.73 ms because managed sources register anew. This is an intentional fresh-owner cost, not a speedup claim or a benchmark of the final base. Source-specific runtime timings and limitations remain in each replacement PR.

Auxiliary #142804, #143034, and #143705 are excluded from the replacement count. Historical aggregate details below are archival and do not establish the current validation state of any replacement.


Closes #140003

What Problem This Solves

Plugin discovery, prepared runtimes, and CLI operations can retain database connections after their last user finishes. Closing resources at a caller's timeout causes the opposite failure: accepted callbacks can resume against a closed database. This implements the accepted resource-only registration disposer and migrates the consumers that retain executable callbacks.

Ownership And Behavior

One resource owner spans construction, caches, prepared generations, and actual callback completion. Optional registration dispose callbacks run after the last claim. Internal consumers acquire explicitly; shipped bare SDK APIs retain their documented host lifetime. Resource retention remains separate from execution authority.

The migration covers providers, tools, speech, memory, transcripts, CLI/setup, and Gateway operations. Metadata projections retain resources until their data is produced; direct compaction now retains the same exact prepared generation as the normal runner. Independent Codex teardown branches still run after middleware cleanup fails. Catalog discovery keeps its existing deadline, terminal Talk disposal errors release admission capacity, and Cron/computer cleanup joins independent branches.

Meeting sessions receive cleanup ownership before provider startup. Failed physical cleanup stays reachable through status and leave/retry. Unfinished engine/setup work fences replacement within the existing same-transport meeting identity; settled browser-only leave failure preserves its previous replacement behavior.

SQLite schemas, versions, stored representations, retention, configuration/defaults, protocol versions, dependencies, and host floors remain unchanged. Migration/embedding paths acquire their existing owners without introducing a data migration. Public SDK export limits account for exactly the approved ownership exports; explicit limits, including zero, remain absolute.

Production net +5,940 lines; tests/support +7,475; docs +149; tooling/baselines +46. The growth implements explicit custody across escaping callbacks and deferred teardown rather than leaving multiple implicit lifetime rules.

Validation

Current head: 591b5354c85ec5c598e2496d03ddd8bafc21b158. Integrated on main ed9861f2e87bba69c91630b214c8783782460a2f.

  • All previously failing local test families were rerun, covering shared generation/handle fixtures, auth provenance, canonical descendants, compaction, provider callbacks, CLI/setup, TUI, and plugin lifecycles. The original real pending-input/compaction cases pass, as do cold inventory and source/compiled TUI checks. Existing assertions, deadlines, and graph/line caps were preserved.
  • Canonical local checks are complete: core/extension/script/test types, lint, SDK exports/budgets, dead code, import cycles, database/Kysely guards, and remaining selected checks. The full architecture check also passed. Initial failures and their corrected runs are retained separately.
  • The new main composition passed 196 selected tests covering process shutdown/admission, configured and borrowed leases, actual completion, native parent-worker cancellation, loader/setup consumers, image generation, and model selection. A further 20 existing retention/shutdown cases passed after moving the unchanged retention declarations into their own module to preserve the file-size limit.
  • Independent P0–P2 review found no actionable production defect in the integration; its only finding concerned a partial review overlay's assertion baseline. Exact incoming-main source changes and the passing assertion guard resolve that finding without changing any limit. The final five-file extraction received a clean P0–P2 review. All 610 source/absence entries match the committed proof seal.
  • All affected canonical checks and the remaining guard steps passed after extraction. The committed full build passed in 350.965 seconds, and the maintained built-plugin singleton check passed in 11.780 seconds. The unchanged real Gateway auth-rewarm case passed (31.404 seconds in the test, 89.650 seconds including its wrapper): two rate-limit requests produced zero rewarms, while one auth failure produced one rewarm, with persisted failure state checked.
  • The actual rebuilt SQLite CLI sequence passed: runtime → metadata-only → runtime took 2.700 / 1.794 / 1.686 seconds. Both runtime generations disposed their native connections and passed read-only reopen; metadata inspection changed neither rows nor module-evaluation markers. All 610 source/absence entries and 13,651 build artifacts stayed unchanged, and owned processes joined.
  • Hosted CI is not green yet. Remaining failures cover unconverted handle/generation/scope test fixtures, an order-dependent shutdown assertion, and the real Codex delivery-cache scenario. Their local reproductions and repairs are in progress; this PR will not land until CI is green.

The real Gateway auth-rewarm flow on prior head bd6c8041 exposed a delayed timer retaining a failed attempt's released resource scope. The repair exits that inherited resource scope only at the rewarm owner, then retains the existing independent admission, current configuration/generation selection, cancellation, coalescing, and rate-limit policy. The regression fails with the old owner while four controls pass; all five cases pass with the fix. The unchanged built Gateway case now passes on this commit, as recorded above.

The first hosted run exposed incomplete fixture migrations and two real missing owners, around metadata projection and direct compaction. Repairs changed the producers, preserved assertions, and moved test callback ownership outside imported global disposal hooks. A conventional test-support filename resolves dead-code classification; direct type imports remove the static dependency cycle. Internal names distinguish core owners from public SDK wrappers. Later typechecking caught an over-broad rename of two distinct runtime objects; those four caller/mock files were restored to their original reviewed contracts.

Earlier full build/CLI evidence remains attributed to 3e1f70eb: build 335.460 seconds, runtime → metadata-only → runtime CLI calls 1.985 / 1.074 / 1.057 seconds. Both runtime generations physically closed SQLite and passed read-only reopen; metadata inspection changed neither rows nor runtime evaluation markers. These timings are not relabeled as measurements of the current commit.

An earlier matched Node 24.20 lookup benchmark against main 4b547c68 measured 263.311 → 261.221 ms per 200 lookups (-0.79%), with peak RSS 609,216 → 613,216 KiB (+3.9 MiB). Recorded background activity makes this descriptive and effectively flat, not an established performance win or a measurement of this final integration.

Compatibility And Review Disposition

An integrity-verified official 2026.9.2 installation supplied the minimum-host proof. Separate import regressions found during that validation are merged in #141207 for Discord/llama.cpp and #141267 for Voice Call. Their maintained package builds and actual old-host import/operation probes retain their own source pins.

The broader Codex minimum-host contract remains a separate follow-up: its full package import reaches agent-harness-registration, absent on 9.2 and introduced by #139911. An isolated newer-policy-helper fallback would not restore that package. The old VoiceCall facade's physical-close retry limitation also remains unchanged. Representative macOS arm64/Node 24 proof does not claim every plugin/platform combination or real carrier/model/browser execution.

Codex cleanup was checked directly against upstream turn interruption and thread unsubscribe. Existing native wire contracts remain separate from middleware release. Secops owner involvement is satisfied by the accepting maintainer's verified active team membership.

The latest ClawSweeper review found no concrete implementation defect. Its committed build/live Rank-up move is complete; the remaining gate is the hosted CI repair described above. The local integration review used complete before/after source and the directly inspected Codex revision; the remote reviewer’s missing historical blobs are a tooling limitation, not evidence of a data/config change. Meeting retry behavior, representative proof limits, and unchanged data/config contracts are explicit above. A separate browser-target ownership follow-up remains: nominal local and node routes can alias one physical target; this preserves the existing transport policy.

@clawsweeper

clawsweeper Bot commented Sep 7, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord channel: voice-call Channel integration: voice-call gateway Gateway runtime extensions: memory-core Extension: memory-core cli CLI command changes scripts Repository scripts commands Command implementations agents Agent runtime and tooling extensions: codex plugin: file-transfer plugin: workboard extensions: llama-cpp plugin: logbook Logbook automatic work journal plugin extensions: clickclack size: XL maintainer Maintainer-authored PR labels Sep 7, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

ClawSweeper closed this pull request because it changes 51,126 lines (32,368 added, 18,758 removed) across 581 files, above this repository's 50,000-line limit for review. Changes this large cannot be reviewed safely or scanned within limits and usually indicate a stale branch merged against an old base. Please open a fresh pull request from current main containing only the intended change, or split it into focused pull requests. A maintainer can apply size: accepted-large to exempt a deliberately large change.

@steipete
steipete force-pushed the codex/db-next-registry-repair4 branch from ec81d2b to db9a93e Compare September 7, 2026 09:05
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 7, 2026
@steipete
steipete force-pushed the codex/db-next-registry-repair4 branch 2 times, most recently from 94c5976 to 3e1f70e Compare September 7, 2026 11:50
@steipete

steipete commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot closed this Sep 10, 2026
@RomneyDa
RomneyDa deleted the codex/db-next-registry-repair4 branch October 22, 2026 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: discord Channel integration: discord channel: voice-call Channel integration: voice-call cli CLI command changes commands Command implementations docs Improvements or additions to documentation extensions: clickclack extensions: codex extensions: copilot extensions: llama-cpp extensions: memory-core Extension: memory-core gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. plugin: cua-computer plugin: google-meet plugin: logbook Logbook automatic work journal plugin plugin: workboard plugin: zoom Zoom plugin proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dispose scoped plugin resources after their last user finishes

1 participant