Skip to content

refactor(runtime): retire private construction and reset seams - #178787

Merged
steipete merged 3 commits into
mainfrom
deslop/z19-107-native-state-20261015
Oct 21, 2026
Merged

steipete merged 3 commits into
mainfrom
deslop/z19-107-native-state-20261015

Conversation

@steipete

@steipete steipete commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Private construction and reset controls still expose choices that serving callers never select. Some tests bypass the native owner through those seams, while three search providers wrap fixed metadata in single-caller factories.

Changes

Remove the fixed status Tailnet/update suppliers, ACP's private injected clock, active-memory's private grace/circuit/map-reset controls, and the migration state-directory reset. Tests retain the original asynchronous operations and native database cohorts, join them before cleanup, and use existing per-run operations or reload the original owner graph. The product's grace period, leases, migration algorithms and persisted shapes stay unchanged.

Inline Brave, Perplexity and Parallel Free's sole metadata bases into their actual provider descriptors without loading search execution eagerly. Remove Firecrawl's unused private DNS callback plumbing; native DNS and every SSRF guard remain.

Image, video and music constructors now choose the native background scheduler directly. Tests hold external results, observe the actual terminal publication, and join the cron fixture's real cleanup tail before retiring mocks. GitHub publication uses the native in-process caller; integration tests retain actual request/authorization dispatch behind a per-invocation module-boundary transport. Transcripts capture the native state directory and logger; delayed fixture constructors explicitly select their own isolated directory. Catalog helpers rely on the already-required application context while preserving connection, scope and asynchronous identity checks.

This accumulated residue removes 101 net production lines across 70 paths. Tests/support grow by 472 lines, for 371 overall lines added. Fixture growth replaces production test controls with original-operation lifetime observation; the migration fixture's sequential import graph, restart/reopen operation and recall tracking live in sibling test-support modules. Moved metadata and fixture code are fully counted.

Best-effort tradeoffs accepted

No public SDK/configuration/CLI/protocol contract, persisted shape, dependency, permission, durability, security guard or realistic-concurrency behavior is removed. Phase E standalone session memory is untouched.

  • A malformed internal catalog caller violating the owner's already-required application context now fails at the first read instead of silently skipping refresh. The optional old host context dates to refactor(ui): move sidebar session data ownership into a reactive controller #112853; refactor(ui): retire sidebar session data host #174714 replaced that host with required context inputs but retained the stale helper branches. Context replacement after awaited bootstrap still checks exact identity.
  • Private reset operations no longer erase unresolved native work or rewrite the product's grace interval for synthetic fixtures. Tests must settle their original operations and then retire their own IDs/keys or reload their closed graph. No serving cancellation or shutdown behavior is removed.

Evidence

Completed exact-head CI (39516699338, attempt 1) passes every selected runtime, type, extension, architecture, boundary, UI, PostgreSQL and security gate, including the repaired resource-publication and transcript fixtures. The only substantive failure is inherited Doctor lint118951551770: src/flows/doctor-repair-flow.ts:73:28, typescript(unbound-method) on captured check.repair; aggregate118963727543 is downstream. Actual tested mergea9b3f9a5988a6f0277c11fa28a766b785905153a has ordered baseline140e8841b1e491f4523bbc52a20454cef326ebb7 and exact3f350521f92d2c77763e6a3dbd7ab20354e862b5 parents. Determining flow/types/core lint configuration are byte-identical baseline..tested merge and baseline..independently replayed clean maine6b866d3adb8d19ca878d493e4a0d21f1e9c3974, which reproduces the identical diagnostic. Old cancelled metadata is superseded by successful exact-head metadata. This is an inherited-only native exception, not a green-CI claim; no rerun, source workaround, optional rebase or push was made for it.

The first exact-head CI run found 18 owned media-resource fixture failures across the resources and donor-resources suites. The settlement observer obtained no implementation from bare Vitest spies and suppressed the real terminal publisher. The repair captures and explicitly delegates to the native completion/failure owners before observation; all assertions that native operations actually publish success/failure remain. The installed Vitest spy API reproduces the original suppression and the corrected delegation. Independent P0-P2 repair review is scoped-clean with no findings (confidence 0.99), before only mechanical receiver binding required by lint. Final repair types (5.890s), format (9.880s), lint (39.011s), line-cap ratchet (5.540s), and all 14 suppression-audit cases pass. The focused resources/donor-resources replay stops at the compiled-worker prerequisite before cases; it is not a runtime pass. Exact-head hosted CI must validate the repaired fixture graph.

The next exact-head CI run (39509057480, job 118926216864) passes those resource suites but fails the transcript future-title case: active capture count is zero. The changed transcript fixture published plugin metadata before setting its isolated state directory, invalidating the metadata environment fingerprint and allowing unintended cold discovery during provider-absence retries. Move only the existing directory creation/environment stub before metadata construction and publication. Storage paths, tests, assertions, timers and production compatibility checks stay unchanged. Targeted types (10.683s), formatting (16.412s), typed lint (64.485s), line caps (7.246s) and all 14 suppression-audit cases (36.638s driver) pass. Fresh incremental P0–P2 review is scoped-clean, no findings, confidence 0.99. The isolated transcript replay stops before cases at the compiled-worker prerequisite (20503ms; owned runner joined, 32.696s overall), so complete causality and runtime repair remain exact-head hosted-CI proof gaps. This is a concrete fixture-scope repair, not a claim that a passing local replay reproduced or resolved the CI failure.

Expanded targeted core and UI typechecks pass. Native formatting passes for all 70 files. Five focused UI catalog/event/discovery/warm-boot files pass 135 tests across two serial shards (67.176 seconds wall time). They retain context replacement, scope/currentness, reconnect, pagination, visible error, authority and deletion coverage. Existing unrelated Solid diagnostic warnings are emitted; no assertion fails. Typed lint passes after the disposable-variable naming repair; the line-cap ratchet passes for all 70 files after moving the unchanged restart fixture operation into its existing test-support owner. Final affected-fixture types pass in 6.547s, typed lint in 36.616s, the line-cap gate in 8.168s and all 14 suppression-audit tests in 36.017s. Fresh independent P0-P2 review of the final 70-path candidate, including the helper extraction, is scoped-clean with no findings (confidence 0.87).

The final focused native attempt selects59 explicit changed/sibling keeper files. It stops before cases at the compiled-worker cache prerequisite (13292ms cache miss); the task-owned runner is interrupted and fully joined21.634s, then independently verified absent. This is incomplete runtime proof, not59 passing files. The shared-host budget prohibits broad local builds, whole-graph checks and E2E; exact-head PR CI supplies broad consumer/cycle/deadcode proof. UI lint's original configuration selection incidentally emitted the SDK declaration prerequisite; no separate broad build was run, and subsequent checks use the canonical boundary-free UI lint config. No timeout, retry, skip, assertion, cap allowance or suppression is weakened. There is no visual markup/style change or live-provider claim.

@clawsweeper

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T21:26:16.644969Z ac5b055 Draft marked ready
ℹ️ 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.

@steipete
steipete enabled auto-merge (squash) October 20, 2026 21:40
@clawsweeper

clawsweeper Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR removes private construction and reset controls, inlines provider metadata, and adapts tests to the native runtime owners.

Example: Generate poster.png through image_generate.

  • Before: Production uses the native background scheduler; tests can replace that scheduler.
  • After: Production retains the same scheduler; tests hold provider results and observe terminal completion.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, source-consistent cleanup with no identified defect; incomplete native runtime validation limits confidence.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored internal refactor is outside the ordinary contributor proof gate; supplied validation covers UI unit behavior and static checks, with native runtime execution explicitly incomplete.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: No user-visible defect is claimed; private test controls and redundant factories increase maintenance work.
Reason: The maintainer-authored direction removes unused production choices while preserving serving defaults, authority checks, and existing owners.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-directed cleanup preserves serving behavior, and source review found no actionable introduced defect.

Priority: P3
Reviewed head: ac5b05546fd9a982ffc37667476c80803ef9c2f8

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No shipped-entry-point run is recorded for the native runtime paths, and the selected native test attempt stopped before executing cases.
Agent review details

How this fits together

CLI commands, agent tools, plugins, and the session sidebar call runtime owners that coordinate Gateway requests, providers, and database workers and return results or lifecycle updates.

flowchart TD
  A[CLI and agent requests] --> B[Native runtime owners]
  C[Session sidebar] --> B
  B --> D[Gateway and providers]
  B --> E[Database workers]
  D --> F[Results and lifecycle updates]
  E --> F
Loading

Technical review

Best possible solution:

Retain the existing runtime owners and land this simplification once the required checks are satisfied.

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

This is a behavior-preserving refactor rather than a reported product bug; source and caller searches confirm the removed controls are private seams.

Is this the best way to solve the issue?

The change uses existing owners, removes the superseded controls, preserves provider metadata and lazy execution, and retains distinct lifecycle assertions without adding production machinery.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 2f7572ad13d1.

Provenance checked

  • Sidebar application context keeps the original intent (11e25c9: The prior UI refactor replaced the render host with explicit presentation inputs and a required application context.)
  • State-directory reset changes intended behavior with a stated reason (8aab4ff: The migration-module split retained mutable reset state with its owning module; this PR explicitly replaces test resets with closed-graph reloads.)
  • Media construction keeps the original intent (4675c2b: Shared media preflight retained scheduler selection; serving callers selected the existing native default, which remains.)
  • GitHub publication keeps the original intent (0606e31: The Gateway publication broker owns credentials, publication identity, recovery, and live authorization; removing constructor injection preserves that path.)
  • Firecrawl endpoint resolution keeps the original intent (b66459e: Self-hosted endpoint support introduced DNS-based private-network classification; only unused callback plumbing is removed.)
  • Active Memory private controls changes intended behavior with a stated reason (409d13f: The runtime-module split carried private reset and timing controls; this PR explains their replacement with native grace timing and scoped cleanup.)
  • Search provider metadata keeps the original intent (983b65b: Parallel Free's descriptor provides keyless search; its later opt-in requirement, credential contract, and lazy execution remain intact alongside the equivalent Brave and Perplexity moves.)
  • Transcript construction keeps the original intent (cac0b2d: Transcript tooling moved into core with state-directory and logger defaults; serving callers already use those defaults.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

Likely related people:

  • Shakker: Raw commit bf90074 adds src/agents/tools/github-publish-tool.ts:39 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: bf90074c33e2; files: src/agents/tools/github-publish-tool.ts)

PR surface

Source -101, Tests +470. Total +369 across 70 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 22 117 218 -101
Tests 48 1456 986 +470
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 70 1573 1204 +369

Review metrics

Metric Value Why it matters
Production versus test growth Production +117/-218, net -101; tests/support +1456/-986, net +470. The fixture growth replaces production injection/reset controls with native-operation observation and database-cohort cleanup.

Labels

Label changes:

  • add P3: Internal ownership and test-maintenance cleanup with no intended user-visible behavior change.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: Internal ownership and test-maintenance cleanup with no intended user-visible behavior change.
  • 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.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Complete the already-selected native consumer suites on the reviewed head.

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 October 20, 2026, 5:47 PM ET / 21:47 UTC.

@steipete
steipete disabled auto-merge October 20, 2026 22:29
@steipete

Copy link
Copy Markdown
Contributor Author

Exact-head CI39516699338 attempt1 is complete at 3f35052. All167 check runs were enumerated:105 success,58 intentional scope-selected skips,1 neutral,2 failures and1 superseded metadata cancellation. No pending check or missing selected proof remains. All selected runtime/types/extensions/architecture/boundaries/UI/PostgreSQL/ratchets pass, including the repaired resource-publication and transcript fixtures. Security-fast118951065636 succeeds.

Failed job Attribution
118951551770 check-lint-core-2 One error: src/flows/doctor-repair-flow.ts:73:28, typescript(unbound-method) on captured check.repair, introduced on main by #178767. Flow, determining health-check types and core lint configuration are byte-identical between actual baseline140e8841 and tested mergea9b3f9a5, and between baseline and independently replayed clean maine6b866. That clean-main replay reproduces the identical diagnostic in16.907s. The PR does not change this owner/type chain.
118963727543 openclaw/ci-gate Downstream aggregate of the sole inherited lint error; all other selected jobs pass.

Cancelled metadata118950449211 is superseded by successful exact-head metadata118950580637/run39516736257 and118960361525/run39519737190. It is not treated as inherited failure or missing proof. Actual tested mergea9b3f9a5988a6f0277c11fa28a766b785905153a has ordered parents140e8841b1e491f4523bbc52a20454cef326ebb7 / exact3f350521. Independently recomputed tree d9fe782eee27859c9eea50d91a329cf665082e84 matches.

The native inherited-failure exception pins the reviewed exact head and preserves the confirmed-retired auto outcome through explicit replacement recovery. CI remains red, not relabeled green. Final70-path cut removes101 production lines and adds472 fixture/support lines. No product guard, assertion, timeout, suppression or baseline allowance is weakened; no rerun, repush or optional rebase is used to chase green.

@steipete
steipete merged commit e62b64e into main Oct 21, 2026
175 of 179 checks passed
@steipete
steipete deleted the deslop/z19-107-native-state-20261015 branch October 21, 2026 00:36
@steipete

Copy link
Copy Markdown
Contributor Author

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

steipete added a commit that referenced this pull request Oct 21, 2026
Remove PluginRuntimeResolver after the registry factory was folded into its owner (#178830). Keep the capture logger local after native logger ownership replaced injection (#178787). Privatize local GitHub, port and UI declarations introduced by #178712, #178866, #176382 and #176347.

Validation: 76 targeted tests, production and affected test typechecks, typed lint, formatting, and P2 review. Deadcode scans now contain only pending UI mounting surfaces and a separately identified subagent fixture export.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 21, 2026
…law#178787)

* refactor(runtime): retire private construction and reset seams

* test(media): preserve native lifecycle spy delegation

* test(transcripts): establish state scope before metadata
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 21, 2026
Remove PluginRuntimeResolver after the registry factory was folded into its owner (openclaw#178830). Keep the capture logger local after native logger ownership replaced injection (openclaw#178787). Privatize local GitHub, port and UI declarations introduced by openclaw#178712, openclaw#178866, openclaw#176382 and openclaw#176347.

Validation: 76 targeted tests, production and affected test typechecks, typed lint, formatting, and P2 review. Deadcode scans now contain only pending UI mounting surfaces and a separately identified subagent fixture export.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant