Skip to content

refactor(core): deslop core reply and config paths - #166085

Merged
steipete merged 7 commits into
mainfrom
deslop/l414-single-comments-core-rest-20261005
Oct 6, 2026
Merged

steipete merged 7 commits into
mainfrom
deslop/l414-single-comments-core-rest-20261005

Conversation

@steipete

@steipete steipete commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Core reply, channel, and config flows spread single-use operations across forwarding modules, parameter bags, private type aliases, and comments that repeat the code.

User Impact

Normal behavior is unchanged: configuration, persisted data, protocol payloads, command output, model-facing text, and public Plugin SDK shapes remain intact. A small archive repair also removes unpublished temporary files after a write or fsync failure; existing archive and collided temporary-file bytes are preserved.

Why This Change Was Made

This batch removes 1,484 net production lines, excluding tests and baselines:

  • Inline deferred-final recovery and observer forwarding into their existing callers; remove two private modules and use canonical fallback state types directly. Preserve prompt bytes, recovery outcomes, and settlement ordering. Retain helper boundaries where inlining would exceed established file caps.
  • Inline channel ingress input projections, durable-send intent construction, preview-result accumulation, and route DM scope application. Remove the private route-scope module while retaining its admission-evidence transfer.
  • Build command lists, plugin-command preparation, and model picker projections directly where consumed. Keep owner/admin gates, lazy imports, selection policy, and rendered strings.
  • Inline private config schema fragments, config recovery classification, snapshot helpers, and redacted-array restoration. Retain schema defaults, metadata registrations, secret identity checks, and authored-value rules.
  • Simplify session message-cut assembly, archive worker dispatch, range sizing, and timestamp/query helpers without changing transaction, retention, fencing, or worker ownership.
  • Inline queue creation and async registration; remove node-label and Markdown forwarding wrappers and inline private types. Delete narration while retaining comments about authority, lifecycle, ordering, cleanup, and platform constraints.

Fixes Found Along the Way

Archive publication wrote its exclusive temporary file before entering the publisher's cleanup block. A write or fsync failure therefore left unpublished bytes behind. The durable writer now cleans only a file it successfully created, after closing its writable descriptor. Exclusive-open collisions remain outside that cleanup ownership, and the link/publication path is unchanged.

The regression calls the real archive publisher with write/fsync faults and a real exclusive-open collision. Before the fix, both fault cases failed on the leftover file; the collision control passed. Afterward, all three passed and successful retry preserved the exact archive bytes. No schema, retention, permission, or durability-policy change is required.

Evidence

  • Independent Codex reviews of the batch, archive repair, and subsequent corrections: scoped-clean at P0–P2.
  • AWS Crabbox, lease cbx_04a15b04ddb8, final head 61a11c6f4d98a51c852726caf4c511b666ecf896: 96 files / 1,976 cases passed across eight shards in 434.28s. The source commit/tree and clean tracked state were verified inside the remote checkout. Final test run.
  • Final worker lint: zero warnings/errors. Both final cycle checks: 0. Clean-base Madge also reported zero.
  • Changed-file validation passed its line-cap/suppression/assertion/SQLite-worker ratchets, config metadata/docs checks, plugin boundaries, core production types, all core-test type shards, and extension production/test types. Full core lint identified only two Node worker message calls; explicit empty transfer lists fixed them, and the focused final worker lint passed. Extension/script lint and the remaining architecture/auth guards passed. Static checks and SDK comparison.
  • SDK declaration build passed. Canonical API comparison against a51a76bda63cd58d548a9f56ace00e6a153b7eb1 reports zero entrypoint/export additions or removals (digest b2f94299). The ten direct signature changes expand private aliases or expose the canonical Markdown helper type; all 81 distinct reachable-declaration changes were inspected and preserve their structural contracts. The final worker transfer-list correction changes no declarations.
  • Archive regression: 2 expected failures / 1 collision-control pass before the fix, then 3 passes. pnpm test src/config/sessions/session-accessor.sqlite-archive-artifact.test.ts --maxWorkers=1 took 30.68s including startup on the overloaded Mac; test bodies took 284ms. It also passes in the final AWS selection. No timers, worker boots, or production-only test seams were added.

The dead-export scan remains red only for these two independently reproduced entries on clean base a51a76bda63cd58d548a9f56ace00e6a153b7eb1; neither owner is changed by this PR. The candidate scan contains exactly the same two findings. Baseline run.

  • extensions/voice-call/src/webhook/realtime-call-session-control.ts: OUTBOUND_GREETING_FALLBACK_MS
  • src/agents/model-catalog.runtime.ts: loadManifestModelCatalog

A local fallback run timed out during setup of the unchanged large SQLite branch-graph fixture. That test passed unchanged on both the AWS base and candidate, and took 3.073s in the final run. No timeout or assertion was weakened, and no flake fix is claimed. An inherited missing gatewayLog fixture binding was fixed on main in 7b9405e22d7; that fix is included through rebase.

Hosted CI run 37452544692 completed with four failed test jobs. Each is tracked separately:

Job Failure Independent evidence
checks-node-changed-compact-large-18 server.startup-recovery-webchat.test.ts: agent.wait client timeout at the queued-admission assertion Same case and timeout on main run 37450633056 / job 112226285417. Test and wait/registration owners are unchanged by this PR.
checks-node-changed-compact-large-11-2 server-rpc-restart-owner.test.ts: 120s test timeout and 180s cleanup-hook timeout Same case and both timeouts on main run 37450633056 / job 112226285349. No restart marker was reached; delivery/settlement owners are unchanged by this PR.
checks-node-changed-compact-small-25-2 openclaw-database-preflight.startup-index.test.ts: missing fixture clean_close receipt (undefined, expected 1) before activation Same case/assertion on main run 37444136587 / job 112204987890. Receipt storage, close/drain, and lease-release owners are unchanged by this PR.
checks-node-changed-14 gateway-steer-fifo.e2e.test.ts: missing ordinary-B queued final, unexpected tail execution, and old input instead of queued steer All three assertions reproduced without the PR on clean main 9eb998b7d1b03428aa909395cf6d3610eac65315, the exact CI merge parent, in AWS run run_ebc10b552d96445127ad683bf435540a: 3 failed / 4 passed. The test and steering/admission owners are unchanged by this PR.

The resulting CI-gate failure is downstream of those four jobs. The final paginated head snapshot has 161 successful checks, 61 skipped, one neutral, those four test failures and the aggregate failure; every check is complete and none is cancelled. Relevant intersecting edits are comments/types or identical synchronous inlining; the failed owners are unchanged. The archive cleanup fix is not exercised by these failing phases. The clean-main probe also passed all eight startup-index cases, which does not erase its independently recorded main-CI failure or constitute a fix.

Merged as 83908d3f49ee8a8049eb90a0fe649824994e79ff using the maintainer-authorized inherited-main-failure exception on exact head 61a11c6f4d98a51c852726caf4c511b666ecf896. This records failed hosted CI with separately qualified baseline evidence, not a green CI claim.

Post-merge verification: merge ancestry is confirmed on current main; all 280 changed paths match the actual hosted-CI merge tree 6ae4a0f19d0ff67c925248e31ce39043444aaed8. The landed production diff is +928 / −2,412 = −1,484. AWS lease cbx_04a15b04ddb8 is released.

@clawsweeper

clawsweeper Bot commented Oct 6, 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 6, 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: 61a11c6f4d98a51c852726caf4c511b666ecf896
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/config/redact-snapshot.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/config/types.agents-shared.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/shared/device-bootstrap-profile.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@steipete
steipete enabled auto-merge (squash) October 6, 2026 10:53
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 6, 2026
@clawsweeper

clawsweeper Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 6, 2026, 7:35 AM ET / 11:35 UTC (Revision 2).

ClawSweeper review

What this changes

The branch inlines private reply, channel, configuration, and session helpers and removes unpublished archive temporary files after write or fsync failures.

Merge readiness

⛔ Blocked before merge - 4 items remain

Keep open: this maintainer PR contains useful cleanup and an archive repair absent from current main. No concrete introduced defect was found, but the recorded FIFO failure remains unattributed.

Priority: P3
Reviewed head: 61a11c6f4d98a51c852726caf4c511b666ecf896

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, coherent simplification with meaningful archive regression coverage and no concrete introduced finding; CI attribution remains a separate landing requirement.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR is exempt from ordinary contributor proof. Its reported archive fault regression maps directly to the production publisher and real filesystem cleanup/collision behavior; broader test results remain supplemental. No stored-data format or migration contract changes were identified.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from ordinary contributor proof. Its reported archive fault regression maps directly to the production publisher and real filesystem cleanup/collision behavior; broader test results remain supplemental. No stored-data format or migration contract changes were identified.
Evidence reviewed 8 items Pinned introduction and merge ownership: Reviewed the merge-base-to-head introduction at a51a76b..61a11c6. Raw test-merge records identify exactly the pinned base followed by the PR head; its dispatch delta preserves the same deferred-final refactor without attributing unrelated base changes to this branch.
Archive repair remains necessary: Current main still writes and fsyncs the exclusive temporary file without failure cleanup. The proposed writer closes its descriptor before removing a file it successfully created; exclusive-open collisions remain outside its cleanup block. Publication, permissions, hash verification, and existing archive bytes retain their contracts.
Meaningful archive regression: The complete new test calls the production publisher against real temporary directories, injects write/fsync faults, checks removal and successful retry bytes, and verifies preservation of a real exclusive-open collision. The captured body reports two intended baseline failures, a passing collision control, and all three cases passing afterward; this review did not execute tests.
Findings None None.
Security None None.

How this fits together

OpenClaw’s reply and channel layers turn incoming messages and configuration into authorized agent runs and delivered replies. Session storage preserves their transcripts and publishes cold-storage archives.

flowchart TD
  A[Incoming messages] --> B[Channel admission]
  C[Configuration] --> B
  B --> D[Agent and reply dispatch]
  D --> E[Channel delivery]
  D --> F[Session transcripts]
  F --> G[Archive publication]
Loading

Before merge

  • Resolve merge risk (P1) - The recorded Gateway FIFO failures remain unattributed; available evidence does not establish either an inherited failure or a regression introduced by this PR.
  • Complete next step (P2) - Resolve attribution of the recorded gateway-steer-fifo.e2e.test.ts failures: repair any candidate regression, or document independent inherited-failure evidence before using the native landing exception.
  • 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.
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-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the existing owners and public contracts while landing the simplification and archive cleanup once failure attribution supports the native merge gates.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the existing owners and public contracts while landing the simplification and archive cleanup once failure attribution supports the native merge gates.

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

Yes for the incidental archive defect: current main leaves an exclusively created temporary file when write or fsync throws, and the new regression exercises that production publisher. No runtime reproduction was executed during this read-only review.

Is this the best way to solve the issue?

Yes: inlining private forwarding paths preserves the existing decision owners, and cleanup belongs in the exclusive writer that owns the unpublished file.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is principally behavior-preserving internal cleanup with a bounded archive temporary-file repair; failing CI alone does not increase urgency.
  • 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 maintainer-authored PR is exempt from ordinary contributor proof. Its reported archive fault regression maps directly to the production publisher and real filesystem cleanup/collision behavior; broader test results remain supplemental. No stored-data format or migration contract changes were identified.

Evidence

What I checked:

  • Pinned introduction and merge ownership: Reviewed the merge-base-to-head introduction at a51a76b..61a11c6. Raw test-merge records identify exactly the pinned base followed by the PR head; its dispatch delta preserves the same deferred-final refactor without attributing unrelated base changes to this branch. (src/auto-reply/reply/dispatch-from-config.execute.ts:89, 6ae4a0f19d0f)
  • Archive repair remains necessary: Current main still writes and fsyncs the exclusive temporary file without failure cleanup. The proposed writer closes its descriptor before removing a file it successfully created; exclusive-open collisions remain outside its cleanup block. Publication, permissions, hash verification, and existing archive bytes retain their contracts. (src/config/sessions/session-accessor.sqlite-archive-artifact.ts:160, 78e8de276bd2)
  • Meaningful archive regression: The complete new test calls the production publisher against real temporary directories, injects write/fsync faults, checks removal and successful retry bytes, and verifies preservation of a real exclusive-open collision. The captured body reports two intended baseline failures, a passing collision control, and all three cases passing afterward; this review did not execute tests. (src/config/sessions/session-accessor.sqlite-archive-artifact.test.ts:21, 61a11c6f4d98)
  • Security and compatibility preservation: The redacted-array rewrite retains unique-ID matching, reservation of matched original indexes, and rejection of secret borrowing by a new identity. Channel admission projections retain policy values, and route-scope replacement still transfers admission evidence through its existing owner. Device-bootstrap and shared sandbox-type changes only remove comments. No material authority expansion, dependency change, or stored-format migration was identified. (src/config/redact-snapshot.ts:551, 61a11c6f4d98)
  • SDK surface assessment: Inspected the channel adapter, approval, setup, and configuration type expansions and their SDK references. Removed aliases preserve structural shapes; ChannelConfigRuntimeParseResult is not exported through the inspected public SDK entrypoints. The captured body additionally reports zero public entrypoint/export additions or removals and inspection of reachable declaration changes. (src/channels/plugins/types.config.ts:25, 61a11c6f4d98)
  • Validation evidence and unresolved attribution: The captured body reports 1,976 passing cases on the exact head, static checks, and three independently matched main failures. It expressly leaves the FIFO failure unclassified and says no admin exception has been applied. A read-only REST check confirmed checks-node-changed-14 failed at https://github.com/openclaw/openclaw/actions/runs/37452544692/job/112233294834. Inspection of its log was blocked by the network allowlist; no inherited-failure or PR-regression attribution is claimed. (test/gateway-steer-fifo.e2e.test.ts:815, 61a11c6f4d98)

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.

  • Add controlled base-versus-candidate evidence for the recorded Gateway FIFO failures without weakening their assertions.

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 (1 earlier review cycle)
  • reviewed 2026-10-06T10:57:28.770Z sha 61a11c6 :: blocked before merge. :: none

@steipete

steipete commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Pinned-head inherited-failure qualification for 61a11c6f4d98a51c852726caf4c511b666ecf896.

All checks are terminal: 161 successes, 61 skips, one neutral, four failed test jobs and the downstream CI gate. No cancelled or missing selected checks are being excused.

  • checks-node-changed-compact-large-18: the WebChat recovery agent.wait timeout matches main run 37450633056 / job 112226285417.
  • checks-node-changed-compact-large-11-2: the RPC restart fixture's 120s test and 180s cleanup-hook timeouts match main run 37450633056 / job 112226285349.
  • checks-node-changed-compact-small-25-2: the missing startup-index fixture clean-close receipt matches main run 37444136587 / job 112204987890.
  • checks-node-changed-14: all three Gateway steer FIFO assertions reproduce on clean main 9eb998b7d1b03428aa909395cf6d3610eac65315, the actual PR CI merge parent, in AWS baseline run. This is a failing clean-base reproduction, not a passing retry: 3 failed / 4 passed, with the same missing ordinary-B final, extra tail execution, and old input instead of QUEUED_STEER_A.

Source review and the clean-base counterexamples attribute these to unchanged wait, admission, receipt and fixture owners. The intersecting shared changes preserve synchronous registration and execution order; media/TTS paths and the archive cleanup repair are not exercised by the failed phases. No test assertions, deadlines or retry policies were changed.

The candidate separately passed 1,976 focused cases, its required type/lint/architecture proof, both zero-cycle checks and SDK shape review. Applying the maintainer-authorized pinned squash exception for these independently attributed baseline failures; the main failures remain for their coordinator.

@steipete
steipete merged commit 83908d3 into main Oct 6, 2026
234 of 240 checks passed
@steipete
steipete deleted the deslop/l414-single-comments-core-rest-20261005 branch October 6, 2026 11:48
gloss-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 6, 2026
Resolves src/channels/message/ingress-queue.types.ts against upstream
openclaw#166085 (deslop): keep ChannelIngressQueueRecordGeneration, take
upstream's removal of the claim type's doc comment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UJeJ4awZGktQ8rkwNhdueo
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 7, 2026
Simplify single-use reply, channel, config, session and shared helpers and types while retaining behavior and meaningful ownership comments. Remove 1,484 net production lines.

Also clean exclusively created archive temporary files when writing or fsync fails, preserving collided files. Add real publisher regression coverage.

Validation: independent review; 96 focused files / 1,976 cases on AWS; core and extension types; scoped lint and architecture guards; zero import cycles; SDK comparison with no added or removed public exports.

Hosted CI completed with four independently reproduced main fixture/queue failures and its downstream gate failure. No cancelled checks. See PR evidence for each baseline and the authorized pinned-head exception.
amittell added a commit to amittell/openclaw that referenced this pull request Oct 9, 2026
Brings the branch onto current main; GitHub reported it CONFLICTING.

inbound-meta.ts conflicted because main rewrote the helpers this branch had
moved out of it: openclaw#157000, openclaw#161129, openclaw#164547 and openclaw#166085 trimmed the file,
openclaw#158028 dropped its max-lines suppression, and openclaw#167236 merged the transcript
sanitizers into sanitizeTranscriptText. The split is re-applied on main's
code rather than on the branch's older copies:

- inbound-meta.text.ts holds main's normalizePromptMetadataString,
  normalizePromptMetadataStringArray, sanitizePromptBody,
  truncateBodyHeadTail and sanitizeTranscriptText, moved verbatim.
- inbound-meta.current-message.ts builds both projections with
  sanitizeTranscriptText(..., "body") in place of the branch's
  sanitizeTranscriptBody; the inline projection keeps main's bare header.
- inbound-meta.ts is main's file minus the moved helpers.
- config/max-lines-baseline.txt takes main's side, which already dropped the
  inbound-meta.ts entry.

The carrier projection stays in its own module: get-reply-run.media-only.test.ts
and followup-turn-admission.test.ts mock ./inbound-meta.js with closed
factories, and prompt-prelude.ts must not import the projection through them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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