Skip to content

refactor: trust prepared runtime and channel facts - #174559

Merged
steipete merged 2 commits into
mainfrom
deslop/z07-8-runtime-facts-20261015
Oct 16, 2026
Merged

steipete merged 2 commits into
mainfrom
deslop/z07-8-runtime-facts-20261015

Conversation

@steipete

@steipete steipete commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Simplifies runtime and channel plumbing that repeatedly copies or checks already prepared internal facts.

User Impact

No intended feature, CLI, configuration, persisted-data, or protocol change. External validation, live effect authority, FIFO ordering, resource bounds, durability, and write settlement remain.

Why This Change Was Made

Recover the runtime/channel area of an earlier cleanup as an independently attributable slice. Reuse the plugin registry's published snapshot, consolidate ACP cached-handle cleanup, consume prepared hook configuration, and remove redundant request/result clones and checks. Cron configuration snapshots follow serialized command arrival rather than maintaining a second version-ordering mechanism. Keep the cron authority clone that normalizes wire prototypes before CAS comparison.

Production delta: 155 net lines removed. Synthetic caller-mutation and delayed-preview tests are removed only with the unsupported mechanism they pinned; ordinary transcript, fault/idempotency, replacement, final-delivery, and cleanup coverage remains.

Best-effort tradeoffs accepted

  • Progress retirement/publication overlap can briefly affect preview deduplication until the next update. The introducing fix(mattermost): keep replacement previews through retraction #143621 describes synthetic deferred-callback fixtures, not a human actual-use report; final delivery and transport cleanup stay protected.
  • In-place mutation of a published registry array without the registry owner's publication operation no longer refreshes lookup caches. refactor: deslop channels core and mid-size core dirs #161029 introduced snapshot ownership; legitimate registry replacements still invalidate through that owner.
  • Unsupported mutation of an outstanding internal request or prepared result no longer receives a defensive deep snapshot. Inputs have one owner and RPC/schema boundaries remain; the caller-mutation exercise came from the synthetic test cleanup test(core,plugins,ui): remove low-value tests (batch d024) #158907, not a human mutable-request incident.
  • Cron snapshot reordering outside its serialized command queue is not separately fenced. refactor(cron): move scheduling into the worker actor #169766 introduced internal configuration versions without a cited human ordering incident; ordinary startup/change publication and current execution authority remain.
  • Hook configuration is resolved once for a mapper invocation rather than reread by the enablement helper. Mid-call configuration changes take effect on the next invocation; the effect-boundary policy checks are unchanged.
  • Direct internal MCP bridge calls trust their typed arguments. The real MCP schema continues to reject malformed and oversized requests, with boundary coverage retained; no alternate public entry point bypasses it.
  • Fresh private scalar projections are not frozen or copied again. Shared cached facts and mutable provider-owned arguments retain their existing isolation; accidental mutation of a private projection is best effort rather than an additional runtime integrity pass.

Evidence

  • Main drift was inspected and preserved; this is an incremental recovery from fresh main, not replacement with stale checkpoint files.
  • git diff --check: pass.
  • Installed formatter, changed files only: pass, 78 files, 56 ms.
  • Fresh isolated independent P2 review: scoped-clean, no accepted/actionable findings.
  • First-head CI found an adjacent standalone MCP fixture defect: its copied SDK host omitted workers reached through computed manifest paths, so both native-disposal cases closed before dispose-entered. Use the existing linked, frozen invocation graph, as native module-loader proof already does. Lifetime assertions, modes, deadlines, process-tree joins, and cleanup are unchanged; independent copied-host relocation coverage remains unchanged. The one-line repair has fresh scoped-clean P2 review, formatting, lint, and diff checks. Exact corrective-head CI is required before landing.
  • Parse-only lint, all changed TypeScript files with the installed byte-identical repository configuration: pass. The first sparse-local configuration attempt failed only because the lint plugin was absent from that sparse checkout; no rule was disabled.
  • Runtime tests, targeted types, cycle checks, and suppression ratchets are delegated to exact-head hosted CI. Local runtime dependencies do not match this fresh main snapshot; the shared loaded host is not being subjected to another installation/build or broad compiler graph. No local runtime-test pass is claimed.
  • The focused lint-suppressions.test.ts --maxWorkers=1 wrapper was attempted in isolated state and stopped before test execution because this fresh sparse worktree has no dependency installation (exit 2). This is a prerequisite gap, not a passing test or a product failure.
  • The earlier managed-image failure remains unattributed: its exact signature is absent from the refreshed eight-run main census. No CI retry or inherited-failure exception is claimed on that basis.

First-head CI attribution

Run 38951811373, head ce6ba18056dc22e8f4623a007428bd6cb6d28745, completed with only these component failures; all other selected suites, lint, types, architecture, and ratchets passed:

Job Attribution and disposition
checks-node-changed-compact-large-14 / 117145768049 Two standalone MCP lifetime cases could not reach physical disposal because the fixture's copied SDK host omitted computed worker assets. Repaired with existing linked frozen-graph mode; fresh independent review is clean.
PostgreSQL conformance / 117145765005 Inherited: the same three untouched matrix-roots.postgres.test.ts port/resume/rollback cases resolve phase: preflight instead of rejecting on scheduled main run 38948575054, head 24f9be0a7c945c70ad216399cfab085147e2f698. Exact test names and assertion signatures match; no PostgreSQL test or schema is modified here.
openclaw/ci-gate Aggregate of those component failures.

No Actions rerun was requested. The corrective source push requires new exact-head CI. Any remaining inherited-only red will use the authorized native exception/failure table; tooling bootstrap has failed twice before dispatch on stale installed dependencies, so coordinator rule 10 permits the SHA-guarded fallback only after the exact-head gates qualify.

@clawsweeper

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: mattermost Channel integration: mattermost gateway Gateway runtime size: L labels Oct 16, 2026
@steipete
steipete marked this pull request as ready for review October 16, 2026 19:01
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 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-16T19:07:20.389783Z ce6ba18 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.

@github-actions

github-actions Bot commented Oct 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: 3d64739369d8ab9384ed5a5814c528e57377c87f
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/pairing/command-owner.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added 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. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR removes redundant copying and validation of prepared runtime facts and consolidates existing cleanup paths.

Example: Resolve the registered channel alias "a" repeatedly after publishing the alpha plugin.

  • Before: Each lookup checks registry identity, array identity, channel count, and version before reusing cached maps.
  • After: Each lookup reuses the registry owner's published snapshot identity to select the cached maps.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Source review found no actionable defect; evidence remains test-based and corrective-head hosted validation is unfinished.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored internal refactor is outside the ordinary contributor proof gate; supplied validation is test-based, and no shipped-entry-point execution is claimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Repeated internal copying and validation add runtime work and obscure the owners of prepared facts.
Reason: The maintainer-authored direction matches repository policy, removes redundant mechanisms, and records the specific best-effort guarantees being relaxed.

Merge readiness

✅ Ready for maintainer review

Keep this maintainer-authored cleanup open. No concrete introduced defect was found; the documented best-effort tradeoffs are accepted, while corrective-head CI remains incomplete.

Priority: P3
Reviewed head: 3d64739369d8ab9384ed5a5814c528e57377c87f

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway, channel, cron, and worker adapters consume prepared configuration and runtime facts, then route messages, execute queued operations, and publish committed results.

flowchart TD
  A[External requests] --> B[Schema and admission owners]
  B --> C[Prepared runtime facts]
  C --> D[Channel and ACP adapters]
  C --> E[Cron and worker queues]
  D --> F[Transport and persistence owners]
  E --> F
Loading

Technical review

Best possible solution:

Retain the simpler existing owners and accepted best-effort behavior, with corrective-head validation completed before landing.

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

This PR is an intentional refactor; no failing user scenario is claimed or reproduced, and no target code was executed during review.

Is this the best way to solve the issue?

The change follows the existing ownership contracts: validation stays at public boundaries, mutation stays with producers, and the maintainer explicitly accepts the removed defensive guarantees.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Channel preview publication and retirement changes intended behavior with a stated reason (8436617: fix(mattermost): keep replacement previews through retraction #143621 protected replacement previews during overlapping publication and deletion; this PR explicitly accepts the narrower deduplication overlap while retaining transport cleanup and final delivery.)
  • Channel registry lookup invalidation changes intended behavior with a stated reason (1ecd46f: [Fix] Cache selected channel registry lookups #80333 cached selected-registry lookups to avoid repeated scans and stale fallback results; the new lookup uses the existing registry snapshot publication owner.)
  • ACP cached-handle cleanup keeps the original intent (058152c: refactor: extract ACP manager runtime handle cache #88725 separated cache lifecycle from session orchestration; consolidation preserves identity-checked removal and owner-repair error propagation.)
  • Cron scheduler snapshot ordering changes intended behavior with a stated reason (b943945: refactor(cron): move scheduling into the worker actor #169766 moved scheduling into the worker actor and ordered pushed configuration with versions; this PR explicitly chooses serialized command-arrival ordering instead.)
  • Hook enablement policy keeps the original intent (5cb2f45: History identifies the shared hook-policy extraction; both production callers now supply their already-resolved configuration, preserving disabled and workspace-default behavior.)
  • Media decision formatting changes intended behavior with a stated reason (9c9ab89: fix(media-understanding): guard malformed attachments arrays #28024 guarded malformed array shapes; current production decision construction supplies attachment and attempt arrays, and this cleanup removes tests injecting unsupported internal shapes.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Reviewed introduced patch: Reviewed the pinned merge-base-to-head diff; the change since the previous review is the MCP fixture's switch to the existing linked compiled graph. (src/mcp/plugin-tools-registration.stdio.test.ts:21, 3d64739369d8)
  • Accepted product tradeoffs: The maintainer-authored body explicitly accepts preview deduplication overlap, unsupported caller mutation, owner-mediated registry invalidation, and cron command-arrival ordering; these choices do not require renewed product approval. (3d64739369d8)
  • External MCP bounds remain: Public MCP schemas retain integer bounds of 500 conversations, 200 messages or events, and 300000 milliseconds before calling the simplified bridge. (src/mcp/channel-tools.ts:137, 3d64739369d8)
  • Mutation isolation remains at its owner: Cron edits still clone their target job, and add/remove maintenance clones the other jobs before mutating them; authority reconciliation remains in the existing mutation owner. (src/cron/store/job-mutations.worker.ts:202, 3d64739369d8)
  • Transcript resource bounds remain: Transcript submission still measures complete candidate frames before RPC, while the embedded transcript producer retains its message-frame check and serialized write settlement. (src/worker/worker-rpc-transcript-client.ts:106, 3d64739369d8)
  • Exact-head validation pending: Paginated current-head check results still contain running jobs and no completed failure at inspection; the earlier head's results are not treated as corrective-head passes. (3d64739369d8)

PR surface

Source -155, Tests -73, Docs 0, Other -1. Total -229 across 80 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 67 206 361 -155
Tests 11 96 169 -73
Docs 1 4 4 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 2 -1
Total 80 307 536 -229

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is an internal simplification with accepted recoverable edge cases and no established urgent user-facing failure.
  • 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-16T19:18:59.519Z sha ce6ba18 :: needs maintainer review before merge. :: none

Reviewed October 16, 2026, 3:34 PM ET / 19:34 UTC (Revision 2).

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete

Copy link
Copy Markdown
Contributor Author

Exact-head landing evidence for 3d64739369d8ab9384ed5a5814c528e57377c87f.

CI run 38955054455 completed successfully. Every paginated check run was enumerated: no failed, cancelled, queued, or running check remains; selected Node suites, MCP lifetime proof, types, lint, architecture, ratchets, UI boundary suites, PostgreSQL conformance, and security checks passed. Scope-unselected jobs are skipped and CodeQL is neutral. Combined commit statuses openclaw/ci-gate, security-sensitive review, and dependency review are all successful. PR head is unchanged and mergeable; no enforced review or actionable finding remains.

First-head failures were not rerun: the MCP copied-host fixture was repaired once with existing linked frozen-graph mode and fresh independent review; the three PostgreSQL assertion failures matched scheduled main run 38948575054 exactly. Neither failure recurs on this corrective head. No inherited-red exception is needed for the current run. Local runtime/types/cycles are not claimed; the body records the unavailable fresh-main dependency installation and narrow parse-only checks.

Coordinator rule 10 applies to the landing transport only. Two native review-init attempts failed before dispatch: canonical installed tsx 4.23.12 versus required 4.23.15, then the supported alternate tooling root's installed @openclaw/fs-safe 0.26.5 versus required 0.26.6; automatic refresh refused the clean detached tooling checkout. No dependency or guard was changed and no merge intent was submitted. Exact native writer is verified as steipete. Using the coordinator-authorized SHA-guarded squash API after these infrastructure failures, without waiving any CI, security, or review gate.

Production delta: 155 net lines removed. Phase E remains untouched.

@steipete
steipete merged commit 7f5c0c3 into main Oct 16, 2026
170 checks passed
@steipete
steipete deleted the deslop/z07-8-runtime-facts-20261015 branch October 16, 2026 19:53
steipete added a commit that referenced this pull request Oct 16, 2026
Main d25d32d (#173712) added an Enterprise session-reader consumer
after the original audit base. The first PR merge build failed with
MISSING_EXPORT/TS2305 because the hygiene commit removed its helper.
Restore factoryGitHubRequestDigest exactly as on main and rebase for the
named build failure, preserving request binding and authorization checks.

The current export scan also finds three helpers used only by their own
modules: sessionGitHubRepositoryUrl, copyProgressDraftLineMetadata and
cloneBoardSnapshot. Make them private; keep all implementations intact.
The progress snapshot consumer was retired deliberately in #174559.

Proof: CI artifact build passes (377.09s); 39 Enterprise consumer tests
pass (95.55s, --maxWorkers=1). Four visibility suites pass (347.37s, --maxWorkers=1); export scan passes
with zero findings (202.10s). Fresh P2 review is scoped-clean. Additional
local type, lint and importer proof is recorded in the PR.
steipete added a commit that referenced this pull request Oct 16, 2026
* fix(ci): restore dependency and runtime hygiene checks

Owner refactors left unused exports and moved deprecated outbound test calls
into a scanned shared helper. Use the supported durable send API while keeping
the prior queue default, result arrays, and error behavior. Remove dead helpers,
internalize local implementations, and keep catalog discovery with its owner.

Keep the public quota type for declaration emission and check the marker at
its producer. Receipt tests use the canonical file reader with unchanged byte
assertions. The client credential API is intentionally staged by #174294;
model its entry until cutover instead of deleting the unactivated owner.
No Knip ignores or credential implementation changes.

Proof: deadcode dependencies/exports/unused-files and deprecated API guards
pass; core/scripts/UI and affected test types, declaration emission, targeted
lint/boundary lint/format, and P2 review pass. Focused quota/Doctor tests pass
(53.0s wall), as do 49 completion tests (160.21s wall), using maxWorkers=1.
Remaining importer proof and inherited architecture findings are recorded in
the PR. The full architecture command reaches four unchanged legacy sentinel
references from #174489; no baseline or assertion is weakened.

* fix(ci): preserve live GitHub digest and localize unused helpers

Main d25d32d (#173712) added an Enterprise session-reader consumer
after the original audit base. The first PR merge build failed with
MISSING_EXPORT/TS2305 because the hygiene commit removed its helper.
Restore factoryGitHubRequestDigest exactly as on main and rebase for the
named build failure, preserving request binding and authorization checks.

The current export scan also finds three helpers used only by their own
modules: sessionGitHubRepositoryUrl, copyProgressDraftLineMetadata and
cloneBoardSnapshot. Make them private; keep all implementations intact.
The progress snapshot consumer was retired deliberately in #174559.

Proof: CI artifact build passes (377.09s); 39 Enterprise consumer tests
pass (95.55s, --maxWorkers=1). Four visibility suites pass (347.37s, --maxWorkers=1); export scan passes
with zero findings (202.10s). Fresh P2 review is scoped-clean. Additional
local type, lint and importer proof is recorded in the PR.

* chore(ci): leave UI helper cleanup to focused peer fix

READY PR #174625 now covers the exact openNewSessionPlusMenu deletion.
Restore this file to the base version so this branch contains only the
remaining hygiene repairs. No UI code or assertions differ from main.

The duplicate guard verified the peer's diff and fresh OPEN/non-draft
state. P2 review of this scope reduction is clean; existing runtime,
export, type and owner-test proof remains valid for the retained changes.

* chore(ci): defer parser fixture cleanup to existing PR

The final duplicate guard found READY PR #174631 with the exact
observeJsonParse deletion. Restore the fixture to the base version so
this PR no longer overlaps that active cleanup. Its importing tests
and assertions are unchanged and had already passed locally.

Fresh P2 review is clean. Retained runtime changes keep their completed
build, focused test, type, lint and declaration proof.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
* refactor: trust prepared runtime and channel facts

* test: retain compiled graph for MCP lifetime fixture
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
* fix(ci): restore dependency and runtime hygiene checks

Owner refactors left unused exports and moved deprecated outbound test calls
into a scanned shared helper. Use the supported durable send API while keeping
the prior queue default, result arrays, and error behavior. Remove dead helpers,
internalize local implementations, and keep catalog discovery with its owner.

Keep the public quota type for declaration emission and check the marker at
its producer. Receipt tests use the canonical file reader with unchanged byte
assertions. The client credential API is intentionally staged by openclaw#174294;
model its entry until cutover instead of deleting the unactivated owner.
No Knip ignores or credential implementation changes.

Proof: deadcode dependencies/exports/unused-files and deprecated API guards
pass; core/scripts/UI and affected test types, declaration emission, targeted
lint/boundary lint/format, and P2 review pass. Focused quota/Doctor tests pass
(53.0s wall), as do 49 completion tests (160.21s wall), using maxWorkers=1.
Remaining importer proof and inherited architecture findings are recorded in
the PR. The full architecture command reaches four unchanged legacy sentinel
references from openclaw#174489; no baseline or assertion is weakened.

* fix(ci): preserve live GitHub digest and localize unused helpers

Main faa7f43 (openclaw#173712) added an Enterprise session-reader consumer
after the original audit base. The first PR merge build failed with
MISSING_EXPORT/TS2305 because the hygiene commit removed its helper.
Restore factoryGitHubRequestDigest exactly as on main and rebase for the
named build failure, preserving request binding and authorization checks.

The current export scan also finds three helpers used only by their own
modules: sessionGitHubRepositoryUrl, copyProgressDraftLineMetadata and
cloneBoardSnapshot. Make them private; keep all implementations intact.
The progress snapshot consumer was retired deliberately in openclaw#174559.

Proof: CI artifact build passes (377.09s); 39 Enterprise consumer tests
pass (95.55s, --maxWorkers=1). Four visibility suites pass (347.37s, --maxWorkers=1); export scan passes
with zero findings (202.10s). Fresh P2 review is scoped-clean. Additional
local type, lint and importer proof is recorded in the PR.

* chore(ci): leave UI helper cleanup to focused peer fix

READY PR openclaw#174625 now covers the exact openNewSessionPlusMenu deletion.
Restore this file to the base version so this branch contains only the
remaining hygiene repairs. No UI code or assertions differ from main.

The duplicate guard verified the peer's diff and fresh OPEN/non-draft
state. P2 review of this scope reduction is clean; existing runtime,
export, type and owner-test proof remains valid for the retained changes.

* chore(ci): defer parser fixture cleanup to existing PR

The final duplicate guard found READY PR openclaw#174631 with the exact
observeJsonParse deletion. Restore the fixture to the base version so
this PR no longer overlaps that active cleanup. Its importing tests
and assertions are unchanged and had already passed locally.

Fresh P2 review is clean. Retained runtime changes keep their completed
build, focused test, type, lint and declaration proof.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: mattermost Channel integration: mattermost docs Improvements or additions to documentation gateway Gateway runtime 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 size: L 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