Skip to content

refactor: consolidate single-consumer core surfaces - #180711

Merged
steipete merged 17 commits into
mainfrom
deslop/z25-98-core-surface-20261015
Oct 22, 2026
Merged

steipete merged 17 commits into
mainfrom
deslop/z25-98-core-surface-20261015

Conversation

@steipete

@steipete steipete commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Single-consumer internal modules and factory exports spread one responsibility across unnecessary API boundaries.

User Impact

No user-visible change or migration. Public CLI, package, Plugin SDK, configuration, and protocol contracts remain unchanged, as do lazy imports, authorization, durable state, and ordinary concurrency. Phase E session memory is untouched.

Why This Change Was Made

Keep node-plugin and conversation tool assembly with their serving owners; colocate internal approval/event types and process adapters; localize systemd, migration-selection, CLI-output, and terminal-parser preparation. Tests that depended on retired leaves now use the existing serving entry points with their assertions retained.

This is the core/runtime/CLI/packages area of an 88-path family, split under campaign rule 11 to keep CI attribution bounded. The disjoint plugin area follows separately. After dropping the native-codegen-reachable slice below, this area removes 214 net production lines (+944/-1158) across 33 production paths, excluding tests, fixtures, test support, generated files, and declarations. Relocated bodies are not counted as eliminated behavior.

Best-effort tradeoffs accepted

None for supported behavior. No protective guard is removed. The same checks, tool order, schema identities, requester fields, cancellation, deadlines, idempotency, process cleanup, and live effect-authority boundaries remain. Three construction-time copies of an already-prepared plain conversation-options record become one read-only captured record.

Evidence

Every packet has focused public-consumer tests, targeted native typing, typed lint, formatting, and independent P0–P2 review. Retained proof includes 36 conversation/prefix cases across five files, 17 selected node-materialization/tooling cases plus six prefix cases, 90 approval/system-event cases, 30 Gateway configuration/warning cases, 34 exec-output cases, and 46 terminal cases. Conversation and warning test migrations also passed against unchanged production before their folds. Gateway node-deadline E2E was migrated and typechecked, not run locally under the campaign's no-E2E budget.

All 15 area commits applied patch-identically, without conflicts, onto fresh main c5650f3a5e59d6523c913a8ebfff2b787cf58435. Full-area independent P0–P2 review is clean. Runtime and static cycle checks report zero; wrapper/eager-import closure and line caps pass. Two orphan ratchet entries shrink with deleted paths; no allowance, suppression, timeout, retry, or skip is added. The moved existing schema cast documents why normalized node JSON schemas do not need TypeBox-only metadata when forwarded.

Local baseline limitation: suppression inventory reports 103 entries against 100, with extras in untouched cron mutation, transcript test support, and sessions-view files. Those files, the inventory test, parser, and file-enumeration helpers are byte-identical to this branch's main base. No allowlist was widened. Exact-head hosted CI is broad proof; no local build, broad typecheck, E2E, live model/channel, or native-device claim is made.

CI attribution and dropped slice

Run 39800506556 on former head dd290b8ede4a3d7ad937b118d356b855a0275ffb failed Android Play's TalkModeManagerTest.publishedGatewayRelayContractsStartTheAdvertisedTransport while awaiting its local mock WebSocket connection. This was not a matching catalog flake, and all six recent scheduled main Android jobs passed. Although the relevant generated Kotlin values are source-equivalent, native generation imports the modified core method-policy owner, so a whole-build-graph disjointness claim would be wrong. A serial native head-versus-base replay is unavailable within the campaign's proof budget.

Under campaign rule 8, the two reachable changed files (core-method-policy.ts and core-profile-access.ts) are restored to current main. Only that seven-line cut is dropped, not unrelated families. It is preserved without a PR on deslop/z25-parked-android-native-codegen-20261015 for source-bound native replay. The next exact-head CI is required; the failed former head is not reported green or reused as broad success.

Final exact-head landing

The replacement head 6233e6c9906553ad61afb1012f6b31374fbe1db8 passed native completed-hosted preparation and ordinary replacement recovery after the prior auto intent was confirmed cancelled. The exact-head aggregate CI, dependency and security gates succeeded; no failing check was reported. Four leaf checks retained stale in-progress metadata despite successful test and cleanup steps; the native verifier accepted the completed hosted evidence. No CI rerun, synthetic push, admin exception or renewed auto intent was used.

Merged through the native workflow as squash cf3702eb9a43628bdfe2ac93d8c697f4709812ea. GitHub reports MERGED with the exact reviewed head, and the squash is ancestry-verified against fetched main 1be2a77ca03b120301a47e21455f9fb23627e3ca. The native completion receipt and comment retain the replacement history. The seven-line native-codegen slice remains parked; it is not part of this landed result.

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 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 October 22, 2026 14:58
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 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-22T15:29:30.153465Z 6233e6c 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.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime scripts Repository scripts commands Command implementations agents Agent runtime and tooling size: XL labels Oct 22, 2026
@github-actions

github-actions Bot commented Oct 22, 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: 6233e6c9906553ad61afb1012f6b31374fbe1db8
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/infra/exec-approval-channel-runtime.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/infra/exec-approval-channel-runtime.types.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.

Carefully review these changes before merging.

@clawsweeper

clawsweeper Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR folds private helpers and tool factories into their existing consumers while preserving supported behavior.

Example: A direct message send returns message ID m1 for chat c1 on Alpha.

  • Before: The outbound formatting helper produces “✅ Sent via Alpha. Message ID: m1 (chat c1)”.
  • After: The CLI formatting owner produces the same text directly.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The source changes are coherent and preserve existing contracts; validation is limited to test evidence and unresolved current-head CI.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate; its supplied evidence covers focused consumer tests and static checks, while the migrated node-deadline E2E is explicitly unexecuted locally.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
Reason: The maintainer has approved the direction through authorship, and the diff reduces private API boundaries while retaining supported behavior.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-directed refactor consolidates private ownership without a definite introduced defect; current-head CI remains unresolved.

Priority: P3
Reviewed head: dd290b8ede4a3d7ad937b118d356b855a0275ffb

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No shipped-entry-point run of the consolidated runtime is supplied; the maintainer-authored PR is outside the ordinary contributor proof gate.
Agent review details

How this fits together

Agent assembly, Gateway policy, service installation, subprocess execution, and terminal formatting consume prepared configuration and requests and produce tools, process results, service operations, and user-facing text.

flowchart TD
  A[Prepared configuration and requests] --> B[Existing core owners]
  B --> C[Agent tool assembly]
  B --> D[Gateway and service policy]
  B --> E[Process lifecycle]
  C --> F[Tools and results]
  D --> F
  E --> G[CLI and terminal output]
Loading

Technical review

Best possible solution:

Keep the consolidation with its existing owners and resolve current-head CI before landing.

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

This PR claims no user-visible bug fix; inspection confirms the principal changes relocate existing implementations.

Is this the best way to solve the issue?

The consolidation follows existing owners, removes replaced paths, and preserves observable contracts without introducing parallel machinery.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Node-plugin and conversation tool assembly keeps the original intent (49b5b86: Node-hosted plugins added dynamic tools; subsequent consolidation retained grant policy, naming, transport deadlines, and requester identity.)
  • Broker command adapter keeps the original intent (67cedc3: Avoid Linux Gateway spawn stalls while preserving stream, cancellation, IPC, and cleanup ownership contracts.)
  • Systemd installation recovery keeps the original intent (2444509: Reconcile managed services pinned to another installation while preserving enablement, running state, authority checks, and rollback.)
  • Systemd environment parsing keeps the original intent (5fe1414: Keep private operations with their owners while preserving systemd parsing and credential bytes.)
  • Bundle LSP spawning keeps the original intent (9bbd4fa: Withhold Gateway secrets from language servers while retaining configured environment and actionable warnings.)
  • CLI diagnostic output tails keeps the original intent (71bea81: Keep bounded diagnostic tails UTF-8 safe when truncation crosses a multibyte character.)
  • Terminal OSC-8 wrapping keeps the original intent (840f349: Preserve C1 and OSC-8 sequences and close hyperlinks before table padding and borders.)
  • Legacy environment warning keeps the original intent (aa1834a: Warn once about ignored legacy environment prefixes without exposing secret-shaped names or values.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 49b5b86 adds src/agents/openclaw-plugin-tools.ts:129 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 49b5b862acf3; files: src/agents/openclaw-plugin-tools.ts)
  • pick-cat: Raw commit 840f349 adds packages/terminal-core/src/table.ts:315 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 840f349d5d3f; files: packages/terminal-core/src/table.ts)

PR surface

Source -221, Tests +128, Other -5. Total -98 across 57 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 35 973 1194 -221
Tests 18 380 252 +128
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 4 1 6 -5
Total 57 1354 1452 -98

Labels

Label changes:

  • add P3: This is behavior-preserving internal cleanup with no established urgent user-facing defect.
  • 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: This is behavior-preserving internal cleanup with no established urgent user-facing defect.
  • 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.

  • Attribute the Android Play failure and complete the current-head CI gate.

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 22, 2026, 11:18 AM ET / 15:18 UTC.

@steipete
steipete disabled auto-merge October 22, 2026 15:20
@steipete
steipete merged commit cf3702e into main Oct 22, 2026
184 of 185 checks passed
@steipete
steipete deleted the deslop/z25-98-core-surface-20261015 branch October 22, 2026 15:50
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 23, 2026
* refactor(migrate): resolve selection in its existing kind loop

* refactor(daemon): keep single-use systemd frames in their callers

* refactor(agents): keep static catalog row conversion private

* refactor(runtime): keep identity caches and resource ports with their owners

* refactor(agents): spawn bundle LSP servers in their runtime owner

* refactor(agents): truncate CLI diagnostic tails in their owner

* refactor(process): keep broker command adapters private to spawn owner

* refactor(gateway): classify profile families at descriptor construction

* refactor(commands): format delivery summaries at the CLI owner

* refactor(infra): colocate approval and event queue surfaces

* refactor(gateway): own legacy environment notices at startup

* refactor(exec): localize approval follow-up formatting

* refactor(agents): assemble node plugin tools at their sole caller

* refactor(terminal): localize single-use ANSI parser frames

* refactor(agents): assemble conversations in their serving owner

* refactor(agents): document relocated schema invariant and prune orphan ratchets

* refactor(gateway): defer native-codegen slice pending replay
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling ci:full Keep ordinary native-locale CI selection on the next PR run. commands Command implementations gateway Gateway runtime scripts Repository scripts security-sensitive-changed size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant