Skip to content

refactor(runtime): deslop impossible internal states - #165236

Merged
steipete merged 6 commits into
mainfrom
deslop/l375-impossible-states-rest-20261004
Oct 5, 2026
Merged

steipete merged 6 commits into
mainfrom
deslop/l375-impossible-states-rest-20261004

Conversation

@steipete

@steipete steipete commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Internal code repeatedly rechecks shapes guaranteed by its current owners and pinned dependencies, making real validation and lifecycle boundaries harder to follow.

User Impact

The cleanup preserves config, persisted data, protocol shapes, CLI output, model-facing text, and visible UI. A Matrix fix also stops valid recovery keys from being discarded when verification does not newly enable a backup. Wrong keys and a changed active key remain rejected.

Why This Change Was Made

This is one cross-cutting batch of simplifications, with validation retained at external, persisted-data, permission, and ownership boundaries.

  • Use native Matrix SDK verification/crypto types; remove impossible capability probes against pinned grammY and Playwright APIs. Keep real crypto-disabled, network-error, partial public override, and throwing-getter paths.
  • Give OC Path's concrete edit owner its actual insertion types and direct implementation; remove unused embedding-cache helper modes after the cache owner makes the decision.
  • Carry converter-owned OpenAI messages and Google tool results with their real types. Merge the one-use schema serialization projection and reuse canonical timeout parsing.
  • Remove the private ACP-only driver registry and registration layer, while preserving lazy loading, readiness authority, reset behavior, and the public configured-binding factory shape.
  • Produce channel status snapshots directly; derive loaded plugin lookups from their registration owner; resolve usage-template verbs once; remove native timer guards.
  • Consume Zod's typed issue union and prompt-selected objects directly. Centralize required-text validation, and stop re-normalizing schema-admitted configuration and normalized media attachments.
  • Replace the generic UI outlet forwarding class with the concrete application's lifecycle; strengthen internal schema results; remove duplicate patch-parser state, memory-selection DTOs and checked parallel chart arrays. Rendering and external schema admission remain unchanged.
  • Remove the unused snapshot provider interface, an impossible plugin-state namespace comparison, and small closed-type CLI and Markdown fallbacks. Preserve inherited-property guards on indexed JavaScript records.

Fixes Found Along the Way

Matrix's secretStorageKeyValidityMap is indexed by secret names, but recovery verification indexed it by storage-key ID. It reports stored-secret coverage, not cryptographic key validity. Recovery verification now shares the existing authenticated key-check owner, requires IV/MAC metadata, validates the key's MAC, and rechecks the active key after the awaited validation. The existing independently proven backup transition remains available when key proof is unavailable.

Evidence

Production change: 1,104 added / 2,158 removed = 1,054 net production lines removed, excluding tests, fixtures, documentation, and generated files.

Validation used isolated Linux on Hetzner, Node 24.21.0, and pinned pnpm 12.5.1. The final test-only correction is bound to reviewed and tested tree 33b3f530433725fc594c55d9eb65f913482046f9; passing results for unchanged inputs were retained:

  • Five Matrix test files: 193 passed, including real SDK MAC checks for a matching recovery key, a wrong key, and a default-key rotation during validation. Selection wall time: 55 seconds including setup.
  • The matching-key regression fails on the original SDK owner at the intended assertion (expected false to be true).
  • Both import-cycle checks: 0 cycles.
  • Core, UI, extension production, and extension-test typechecks: passed.
  • Focused lint of 60 core/package/UI files and 47 extension files: 0 warnings, 0 errors.
  • Independent review completed with no accepted actionable findings remaining; the final correction review was scoped-clean at P0-P2.

Commands included node scripts/run-vitest.mjs with the five changed Matrix suites, scripts/check-madge-import-cycles.ts and scripts/check-import-cycles.ts, scripts/run-tsgo.mjs with the four owning graphs, and scripts/run-oxlint.mjs with the touched paths. Hosted CI 37258399667 passed on exact head 16f759397ec33905dc96f4414265b92512e50a1e: 81 jobs succeeded and 20 were skipped. Squash auto-merge completed as ae6676dc252516ebe479631d474fe66531f4df01; merge ancestry was verified on fresh main.

Validation also caught two incomplete test fixtures: an onboarding timeout response lacked native Headers, and a Matrix backup-error case depended on a missing SDK method. The fixtures now model the actual Fetch/SDK contracts while retaining their original assertions. Matrix event fixtures were extracted intact to satisfy the file-growth ratchet.

The first hosted CI correction supplies the required native browser event lifecycle and Matrix room-list promises in two test doubles, retaining their assertions. Both suites pass all 18 tests on Hetzner; both cycle checks remain at zero, and the affected test typecheck and lint pass. The assertion baseline was regenerated with its owner and only shrank (26 assertions).

The second CI correction documents the existing ACP mocks' genuine import-time isolation and removes two obsolete mock-baseline entries for the deleted registry suite through the owning generator. The two ACP suites pass all 26 tests (17 seconds including setup); lint passes, both cycle checks remain at zero, and the regenerated mock-export ratchet passes with 10,774 entries.

Inherited Control UI failures were reproduced on clean main 43856f78ec629f0c72180359a0ce85f06759974f, without this PR: the sidebar suites produced 5 failed / 6 passed, and the full metadata-observation suite produced 2 failed / 14 passed with the same assertion values. These failing-baseline results are recorded separately from passing candidate proof and required no exception: the final exact-head CI run passed.

Use canonical typed owners for bundled SDK capabilities, config and prompt
results, normalized attachments, channel state, and UI projections. Remove
the private ACP-only driver registry and copied interface/projection layers.
Preserve external input validation and authority, lifecycle, and storage checks.

Fix Matrix recovery-key confirmation by verifying authenticated key metadata
instead of indexing a secret-name status map by storage-key ID. Retain the
existing backup-transition fallback and reject wrong keys or a changed active key.
@clawsweeper

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

@github-actions

github-actions Bot commented Oct 5, 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: 16f759397ec33905dc96f4414265b92512e50a1e
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/secrets/configure-plan.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/secrets/configure.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.

@openclaw-barnacle openclaw-barnacle Bot added channel: matrix Channel integration: matrix channel: telegram Channel integration: telegram app: web-ui App: web-ui extensions: memory-core Extension: memory-core commands Command implementations extensions: oc-path extensions: browser size: XL labels Oct 5, 2026
@steipete
steipete enabled auto-merge (squash) October 5, 2026 01:07
@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 4, 2026, 11:19 PM ET / October 5, 2026, 03:19 UTC (Revision 3).

ClawSweeper review

What this changes

This PR simplifies internal runtime, plugin, provider, and UI contracts and fixes confirmation of valid Matrix recovery keys.

Merge readiness

⛔ Blocked before merge - 4 items remain

The Matrix recovery-key fix remains useful and is absent from current main and the latest release. The previously reported OC Path baseline finding remains unresolved; no additional blocking runtime defect was established.

Priority: P2
Reviewed head: 16f759397ec33905dc96f4414265b92512e50a1e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The useful owner-based cleanup has substantial recorded validation and one small unresolved baseline correction.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary external-contributor proof gate does not apply to this verified maintainer-authored PR. Matrix owner-boundary regressions use real SDK MAC checks and observe retained-key outcomes for matching, wrong, and rotated keys; these are supplemental tests, not a claimed live Matrix run. No stored-data format or schema changes were identified.
Patch quality 🐚 platinum hermit (4/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary external-contributor proof gate does not apply to this verified maintainer-authored PR. Matrix owner-boundary regressions use real SDK MAC checks and observe retained-key outcomes for matching, wrong, and rotated keys; these are supplemental tests, not a claimed live Matrix run. No stored-data format or schema changes were identified.
Evidence reviewed 12 items Pinned introduction and clean checkout: Reviewed the introduced merge-base-to-head delta, rather than endpoint drift. The checkout remained clean. The supplied test merge is stale and was not used to claim removal of current-main behavior.
Prior finding remains unchanged: The PR removes universal.ts’s max-lines suppression but retains its baseline entry at line 124. Both files have identical blob identities at the previous reviewed head and current head; universal.ts also matches the first reviewed head.
Exact-head hosted warning: The completed checks-fast-baseline-ratchets check reports this exact stale OC Path entry. Its success conclusion does not contradict the finding: reportLimitViolations makes limit violations advisory on GitHub Actions, while local checks reject them.
Findings 1 actionable finding [P3] Remove the retired OC Path suppression from its baseline
Security None None.

How this fits together

OpenClaw’s runtime connects configured providers, channel plugins, browser operations, and the Control UI through shared typed contracts. Matrix recovery verification checks supplied key material before retaining it for encrypted account recovery.

flowchart TD
  A[Configuration and user requests] --> B[Typed runtime owners]
  B --> C[Providers and channel plugins]
  B --> D[Browser and Control UI]
  E[Matrix recovery key] --> F[Authenticated key check]
  F --> G[Active key recheck]
  G --> H[Retain or discard recovery key]
Loading

Before merge

  • Remove the retired OC Path suppression from its baseline (P3) - The patch removes universal.ts’s max-lines suppression while this entry remains. The local ratchet rejects that stale entry; the current-head hosted check also reports it, although hosted limit checks are advisory. Remove the entry through the canonical shrink-only baseline owner. This previously reported late discovery remains unchanged from both earlier reviewed heads.
  • Complete next step (P2) - Remove the retired OC Path max-lines baseline entry through its canonical owner and validate the local ratchet.
  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.

Findings

  • [P3] Remove the retired OC Path suppression from its baseline — config/max-lines-baseline.txt:124
Agent review details

Security

None.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

None.

Stored data model

Persistent data-model change detected: unknown-data-model-change: config/assertion-safety-baseline.txt, unknown-data-model-change: extensions/memory-core/src/memory/manager-embedding-ops.ts, unknown-truncated-pull-files, vector/embedding metadata: extensions/memory-core/src/memory/manager-embedding-cache-ops.ts, vector/embedding metadata: extensions/memory-core/src/memory/manager-embedding-cache.ts, vector/embedding metadata: extensions/memory-core/src/memory/manager-embedding-ops.ts, and 2 more. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep the canonical typed owners and authenticated Matrix recovery check, with the suppression baseline accurately reflecting the remaining exceptions.

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

Yes, from source: the removed suppression and retained baseline entry deterministically violate the local ratchet, and the current-head hosted annotation names the same entry. No local tests were executed.

Is this the best way to solve the issue?

Yes, the owner-based simplifications and shared authenticated key check are appropriate; the remaining baseline correction is mechanical.

Full review comments:

  • [P3] Remove the retired OC Path suppression from its baseline — config/max-lines-baseline.txt:124
    The patch removes universal.ts’s max-lines suppression while this entry remains. The local ratchet rejects that stale entry; the current-head hosted check also reports it, although hosted limit checks are advisory. Remove the entry through the canonical shrink-only baseline owner. This previously reported late discovery remains unchanged from both earlier reviewed heads.
    Confidence: 1
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is correct
Overall confidence: 0.88

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: The branch includes a bounded Matrix recovery-key correctness fix alongside internal cleanup.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary external-contributor proof gate does not apply to this verified maintainer-authored PR. Matrix owner-boundary regressions use real SDK MAC checks and observe retained-key outcomes for matching, wrong, and rotated keys; these are supplemental tests, not a claimed live Matrix run. No stored-data format or schema changes were identified.

Label justifications:

  • P2: The branch includes a bounded Matrix recovery-key correctness fix alongside internal cleanup.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary external-contributor proof gate does not apply to this verified maintainer-authored PR. Matrix owner-boundary regressions use real SDK MAC checks and observe retained-key outcomes for matching, wrong, and rotated keys; these are supplemental tests, not a claimed live Matrix run. No stored-data format or schema changes were identified.

Evidence

Acceptance criteria:

  • [P1] pnpm check:max-lines-ratchet --base 5837209.
  • [P1] git diff --check.

What I checked:

  • Pinned introduction and clean checkout: Reviewed the introduced merge-base-to-head delta, rather than endpoint drift. The checkout remained clean. The supplied test merge is stale and was not used to claim removal of current-main behavior. (16f759397ec3)
  • Prior finding remains unchanged: The PR removes universal.ts’s max-lines suppression but retains its baseline entry at line 124. Both files have identical blob identities at the previous reviewed head and current head; universal.ts also matches the first reviewed head. (config/max-lines-baseline.txt:124, 16f759397ec3)
  • Exact-head hosted warning: The completed checks-fast-baseline-ratchets check reports this exact stale OC Path entry. Its success conclusion does not contradict the finding: reportLimitViolations makes limit violations advisory on GitHub Actions, while local checks reject them. (scripts/lib/check-limits.mts:11, 16f759397ec3)
  • Canonical baseline repair owner: The max-lines ratchet derives current suppressions, identifies stale baseline entries, and provides a shrink-only --prune operation. (scripts/check-max-lines-ratchet.mts:250, 16f759397ec3)
  • Matrix validation boundary: The shared key-check owner requires IV and MAC metadata, checks the candidate key, and rechecks the active default key after awaited validation. Recovery verification consumes that result before deciding whether to retain the staged key. (extensions/matrix/src/matrix/sdk/client-base.ts:330, 16f759397ec3)
  • Meaningful recovery regressions: The parameterized regression exercises verifyWithRecoveryKey with matching and wrong keys and a default-key change during validation. It uses the real SDK MAC implementation and checks recoveryKeyStored as well as the returned acceptance result. The captured body reports these suites passing on isolated Linux; this reviewer did not execute them. (extensions/matrix/src/matrix/sdk.test.ts:2882, 16f759397ec3)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Remove the stale OC Path max-lines baseline entry and validate the local ratchet.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-05T01:07:55.603Z sha b05a0d0 :: blocked before merge. :: none
  • reviewed 2026-10-05T02:26:24.202Z sha ec97148 :: blocked before merge. :: [P3] Remove the retired OC Path suppression from its baseline

@steipete
steipete disabled auto-merge October 5, 2026 01:22
@steipete
steipete enabled auto-merge (squash) October 5, 2026 02:24
@steipete
steipete disabled auto-merge October 5, 2026 03:04
@steipete
steipete enabled auto-merge (squash) October 5, 2026 03:13
@steipete

steipete commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Evidence: inherited Control UI failures

The UI failures from CI run 37254795343 were reproduced independently in a clean checkout of main 43856f78ec629f0c72180359a0ce85f06759974f, with no PR changes, on isolated Linux using Node 24.21.0 and Chromium:

  • checks-ui-e2e (5/9), job 111589770911: four sidebar-agent-first.e2e.test.ts cases fail identically. The 258px case misses the expected name overflow; the other three report header height 68 instead of 48.
  • checks-ui-e2e (2/9), job 111589770917: sidebar-name-marquee.e2e.test.ts fails the closed mobile drawer bound (right <= 0). Together, the two clean-main sidebar suites produced 5 failed / 6 passed.
  • checks-ui-e2e (7/9), job 111589770902: both burst-coalescing cases in chat-metadata-observation.e2e.test.ts issue one extra models.list request: 2 instead of 1 at line 285, then 3 instead of 2 at line 308. The full clean-main file produced 2 failed / 14 passed.

The metadata change is attributable to main commit 84c2e861be4 (#165190), which removed retained catalog keys and catalog-projection validation. It is an ancestor of the current failed run's main parent f04c2c0388a38c8bbe25b92629841d1a77c9767f; the PR's production source did not change between those runs.

The sidebar is owned by the application shell, outside the changed router outlet. The metadata failures also reproduce with main's unmodified outlet. No assertions, timers, thresholds, or retries were changed to qualify these results.

Baseline commands used node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner with the two sidebar files together, then the full metadata-observation file. The baseline source remained clean. These are failing-baseline results, not passing PR proof.

The initial Windows declaration-fixture failure was separately reproduced in unrelated PR #165225, run 37248949425, job 111572759573. Main fixed the missing runtime-postbuild-shared.mjs fixture copy in 12785be2ff0 (#165221); it no longer fails in this PR's current run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 Oct 5, 2026
@steipete
steipete merged commit ae6676d into main Oct 5, 2026
167 checks passed
@steipete
steipete deleted the deslop/l375-impossible-states-rest-20261004 branch October 5, 2026 03:21
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
* refactor(runtime): deslop impossible internal states

Use canonical typed owners for bundled SDK capabilities, config and prompt
results, normalized attachments, channel state, and UI projections. Remove
the private ACP-only driver registry and copied interface/projection layers.
Preserve external input validation and authority, lifecycle, and storage checks.

Fix Matrix recovery-key confirmation by verifying authenticated key metadata
instead of indexing a secret-name status map by storage-key ID. Retain the
existing backup-transition fallback and reject wrong keys or a changed active key.

* test(matrix): initialize crypto fixtures independently

* test: align SDK fixtures with native contracts

* refactor: preserve concrete contracts in deslop

* test: honor native browser and Matrix fixture contracts

* test(channels): document ACP fixture isolation
steipete added a commit that referenced this pull request Oct 5, 2026
#165236 shrank extensions/oc-path/src/oc-path/universal.ts under the max-lines budget, so the shrink-only ratchet requires removing its grandfathered entry. Main's check:changed failed on it (run 37266484130).
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 6, 2026
openclaw#165236 shrank extensions/oc-path/src/oc-path/universal.ts under the max-lines budget, so the shrink-only ratchet requires removing its grandfathered entry. Main's check:changed failed on it (run 37266484130).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui channel: matrix Channel integration: matrix channel: telegram Channel integration: telegram commands Command implementations extensions: browser extensions: memory-core Extension: memory-core extensions: oc-path P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. security-sensitive-changed size: XL 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