Skip to content

refactor(auto-reply): deslop auto-reply - #156377

Merged
steipete merged 2 commits into
mainfrom
deslop/10-auto-reply-sweep-20260922
Sep 23, 2026
Merged

steipete merged 2 commits into
mainfrom
deslop/10-auto-reply-sweep-20260922

Conversation

@steipete

@steipete steipete commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Auto-reply and channel code still carries retired session-reset machinery and repeats command, delivery, setup, and type-contract logic that already has an owner.

User Impact

No intended behavior change. Command output, channel routing and delivery, credential prompts, public SDK exports, configuration, and persisted state retain their existing contracts.

Why This Change Was Made

  • Remove the unused role-ordering reset callback, its unreachable helper, and tests that only invoked that retired path. Conversation-state errors continue preserving the current session through the existing failure owner.
  • Remove the unreachable second context-overflow branch and recovery text for automatic resets that production no longer performs.
  • Share skill-snapshot patch construction, session-fork result types, session-hook context, and registry rejection types with their existing owners.
  • Reuse canonical internal reply options and exec-policy normalizers; remove duplicate option fields and unused queue arguments. Keep the metadata helper input independent of the higher-level command-handler type.
  • Use the existing authorized-command gate for models, stop, and abort handling, and parse ACP option values through one dispatch path.
  • Remove obsolete JSON-parse warning grouping after the SQLite export cutover and unused pre-rendered tool handling in the HTML template.
  • Share MCP action attachment selection and presentation merging; retain the seven existing cases in one test suite.
  • Remove private forwarding layers in lazy loading, ACP settings, compaction notices, delivery deduplication, history timestamps, and elevated matching.
  • Share direct/parent channel matching and model-override result projection.
  • Consolidate channel setup credential prompting and config helpers while preserving masked secret input and existing prompt order.
  • Reuse channel schema merging, credential-status keys, media/turn types, and capability inventories; simplify reaction-controller forwarding and typed capability aggregation.

The E2E proof also exposed a fixture mismatch: two OpenAI test models implicitly selected a native runtime, while the harness only supplies the embedded runner. Those fixtures now explicitly select openclaw; native slash-command ingress, model/account persistence, and all assertions remain intact. No test cases were added for this repair.

Evidence

Observed after-change behavior from the completed runtime checks:

  • Native model/account slash commands through getReplyFromConfig update the target session, create no phantom slash session, and the next ordinary turn uses the selected model/account. The three-file E2E replay passed all 243 cases.
  • An injected provider role-ordering exception through executeAgentTurn returns the canonical final error while preserving the run session ID and the complete stored row, including its lifecycle revision. This exercises the surviving executor after the reset helper was removed.
  • MCP presentation keeps answer text and attaches one action to the final eligible reply. Status, error, non-text, and Control UI payloads do not mint duplicate app actions; the rendered fallback text is checked for app and connect actions.
  • Channel setup preserves environment selection and existing-reference retention, plus default/named-account configuration writes and enabled flags.

The model and channel-network boundaries were mocked; runtime dispatch, session-store access, and reply/configuration projections were exercised. These are integration and boundary observations, not live-provider claims.

  • node scripts/check-changed.mjs --base 06bb025f03b09e4ad2b1010ff73506e4d11bc46a — passed (2,612.03 s), including selected production/test typechecks, lint, formatting, and structural guards.
  • node scripts/check-changed.mjs -- test/helpers/auto-reply/trigger-handling-test-harness.ts — passed after the fixture repair (259.85 s).
  • node scripts/run-vitest.mjs <focused and cross-shard paths> and scoped node --import ./scripts/tsx.mjs scripts/test-projects.mts <extension paths> — all 241 selected files passed, including 17 extension consumers. Selection traced changed-module imports across auto-reply, channels, agents, Gateway, infra, config, SDK, plugins, tooling, and E2E; extension files ran through their project owners.
  • Original E2E order replayed with node scripts/run-vitest.mjs src/agents/model-fallback.reply-entry.e2e.test.ts src/auto-reply/reply.triggers.trigger-handling.e2e.test.ts src/auto-reply/reply/agent-runner.runreplyagent.e2e.test.ts — 243/243 passed after the fixture repair.
  • pnpm plugin-sdk:surface:check, pnpm plugin-sdk:check-exports, and node scripts/run-vitest.mjs test/scripts/plugin-sdk-surface-report.test.ts — passed.
  • pnpm build — passed initially (318.30 s) and again after the type-cycle repair (9m 16.7s build phases).
  • Codex autoreview, local candidate through P2 — scoped-clean, no accepted/actionable findings. Complete producer evidence confirmed that the removed HTML renderer input had no reachable producer or public contract.
  • node scripts/check-changed.mjs --base origin/deslop/10-auto-reply-sweep-20260922 — passed for the incremental repair through the configured Testbox runner (the remote base resolved to 56cc223dc7c25ec549ab4a1ff3ae886667052090 for that run).
  • pnpm check:architecture — passed after the CI repair, including zero runtime and Madge cycles.
  • Metadata consumers: node scripts/run-vitest.mjs over dispatch, inline actions, fast path, name, goal, login, continuation settlement, and Gateway directive-tag suites — 8 files / 452 tests passed in 697.14 s.
  • Codex autoreview of the incremental cycle repair — scoped-clean through P2; the four-field input has identical types and optionality.
  • git diff --check — passed. Final rebase onto b4111411166741032e32f362b4f765c9dfafff64 was conflict-free; the combined pre/post rebase patch IDs match. Upstream authority forwarding remains intact.

Proof ran on frozen candidate snapshots using Blacksmith Testbox. The full changed gate and first 32 groups used tbx_01m36ed4kpdwsg5gapgyyd8tpn (run); repaired E2E, fixture checks, remaining consumers, and build used tbx_01m36mxs2k7s34g32xzg9fgtqk (run), wrapper exit 0. Both leases stopped. The incremental repair changed gate used tbx_01m36rnnkgksbgt5zeq8vrqm59 (run); its rebuilt candidate used tbx_01m36t87m0g106af1s063g5yjr (run). Both also completed with wrapper exit 0 and stopped. The linked hydration runs can display cancellation after the delegated lease lifecycle finishes; the wrapper and command results above own this proof.

Exact-head CI run 35855036597 passed on 710e3d5edea0e5abadde9381daf0ce481a31c7c8, including openclaw/ci-gate. Hosted job wall times include 202 s for architecture, 296 s for dependency checks, and 403/481/644 s for the previously failing shared test jobs; those include preparation and unchanged sibling tests.

CI found a type-only cycle in the cleanup; the metadata helper now takes its exact four-field input without importing the higher-level command-handler context. Unrelated main failures were resolved by rebasing over the workflow entrypoint/native SwiftLint fixes (54a9d03dcf0, d9a3356e19e), the UI pane-identity fixture repair (91ee6aa3de1), and complete lint/workflow fixtures (ceb109668b4). This PR changes none of those upstream UI or CI fixtures, and its combined patch ID remained unchanged across the rebases.

Production measurement command:

git diff --shortstat origin/main -- . ':(exclude)**/*.test.*' ':(exclude)**/test/**' ':(exclude)docs/**'
62 files changed, 598 insertions(+), 1626 deletions(-)

That filter reports 1,028 net lines removed. Strict classification is 995 production-source lines plus 1 production-tooling line removed, separately from 783 test/support lines and 5 ratchet lines. The requested glob also includes some test-support files and the ratchet, so this remains a below-1,000 production cleanup under strict accounting.

The work-order command pnpm plugin-sdk:api:check is absent from current main. The current SDK surface and export-registration checks are used alongside the SDK surface-report test. No SDK export or public barrel was removed.

Changed-test cost

Measured on the Testbox with pnpm test <file> --maxWorkers=1 (wall seconds):

File Seconds
src/auto-reply/reply.directive.parse.test.ts 1.67
src/auto-reply/reply/commands-acp/shared.test.ts 17.45
src/auto-reply/reply/agent-runner-context-recovery.test.ts 21.66
src/auto-reply/reply/agent-runner-execution-conversation-failures.test.ts 40.16
src/auto-reply/reply/agent-runner-direct-runtime-config.test.ts 46.37
src/auto-reply/reply/session-updates.test.ts 2.04
src/channels/channel-config.test.ts 1.79
src/auto-reply/reply/mcp-channel-actions.test.ts 1.67
src/auto-reply/reply.triggers.trigger-handling.e2e.test.ts 36.23

The files above 30 seconds exercise the existing executor, persisted preflight/session boundaries, and native slash-command model selection. The new assertions reuse their fixtures; the wall measurements include worker preparation and imports. The trigger-file measurement reused prepared E2E bundles; the original three-file E2E replay passed 243 cases in 519.49 seconds including cold bundle preparation. The retired reset-only suite and its production test seam are removed.

@clawsweeper

clawsweeper Bot commented Sep 23, 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 scripts Repository scripts agents Agent runtime and tooling size: XL labels Sep 23, 2026
@steipete
steipete force-pushed the deslop/10-auto-reply-sweep-20260922 branch 2 times, most recently from 90da20b to 1a52f45 Compare September 23, 2026 10:14
@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: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 23, 2026
@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 23, 2026, 8:07 AM ET / 12:07 UTC (Revision 4).

ClawSweeper review

What this changes

Simplifies automatic replies and channel helpers by removing unreachable session-reset machinery, consolidating existing logic and types, and updating associated tests.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: the cleanup remains useful, and no blocking introduced defect was found. Verified repository-admin authorship makes the external-contributor proof gate inapplicable.

Priority: P3
Reviewed head: 710e3d5edea0e5abadde9381daf0ce481a31c7c8

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Recorded reviewer rating: A sound cleanup with meaningful retained coverage and successful exact-head CI; no actionable blocking defect was found. Real behavior proof remains required by host policy.
Proof confidence 🌊 off-meta tidepool Recorded reviewer rating; Required by policy: the recorded not-applicable assessment does not satisfy the current PR proof policy. Put relevant after-change evidence in the main PR body, then request a fresh review with @clawsweeper re-review. Recorded reviewer context: Verified repository-admin authorship exempts this internal refactor from the external-contributor gate. Captured Testbox observations exercise reply execution, command ingress, session preservation, presentation, and setup with mocked provider/network boundaries. No material authority or stored-data contract change requires separate proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Required by policy Required by policy: the recorded not-applicable assessment does not satisfy the current PR proof policy. Put relevant after-change evidence in the main PR body, then request a fresh review with @clawsweeper re-review. Recorded reviewer context: Verified repository-admin authorship exempts this internal refactor from the external-contributor gate. Captured Testbox observations exercise reply execution, command ingress, session preservation, presentation, and setup with mocked provider/network boundaries. No material authority or stored-data contract change requires separate proof.
Evidence reviewed 11 items Pinned introduction and merge ownership: Reviewed the merge-base-to-head introduced hunks. The test merge's raw parents are the pinned base followed by the exact PR head; its changes remain confined to this cleanup.
Cleanup still absent from current main: Fetched main still constructs the unused role-ordering reset callback and retains the renderedTools branch. No merged replacement was established. The supplementary GitHub title search ended with a transport error, so it does not establish absence of related work.
Removed reset path was unreachable: The original-tree reference search found callback construction, forwarding, types, and test invocations, but no production invocation. The surviving fallback settlement handles context overflow and role-ordering failures before returning to the execution loop.
Findings None None.
Security None None.

How this fits together

Automatic replies turn incoming messages and commands into agent runs and channel responses. These helpers coordinate session state, command authorization, reply presentation, and channel configuration.

flowchart TD
  A[Incoming messages and commands] --> B[Command matching and authorization]
  B --> C[Agent execution and failure handling]
  D[Session state and channel configuration] --> C
  C --> E[Reply presentation]
  E --> F[Channel delivery]
Loading

Before merge

  • Add real behavior proof - Required by policy: the recorded not-applicable assessment does not satisfy the current PR proof policy. Put relevant after-change evidence in the main PR body, then request a fresh review with @clawsweeper re-review. Recorded reviewer context: Verified repository-admin authorship exempts this internal refactor from the external-contributor gate. Captured Testbox observations exercise reply execution, command ingress, session preservation, presentation, and setup with mocked provider/network boundaries. No material authority or stored-data contract change requires separate proof.
Agent review details

Security

None.

PR surface

Source -995, Tests -783, Other -6. Total -1784 across 79 files.

View PR surface stats
Area Files Added Removed Net
Source 55 593 1588 -995
Tests 22 177 960 -783
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 2 8 -6
Total 79 772 2556 -1784

Review metrics

None.

Technical review

Best possible solution:

Keep automatic replies on their existing execution, session, and channel owners while removing unreachable paths and duplicated projections.

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

Not applicable: this PR proposes behavior-preserving cleanup rather than a new bug fix; source inspection confirms the redundant paths.

Is this the best way to solve the issue?

Yes: consolidation uses existing owners, removes unreachable machinery, and retains observable-contract coverage without introducing a competing implementation.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is internal cleanup with preserved behavior and no identified urgent user-facing defect.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit. This is the recorded reviewer rating; real behavior proof remains required by host policy.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Required by policy: the recorded not-applicable assessment does not satisfy the current PR proof policy. Put relevant after-change evidence in the main PR body, then request a fresh review with @clawsweeper re-review. Recorded reviewer context: Verified repository-admin authorship exempts this internal refactor from the external-contributor gate. Captured Testbox observations exercise reply execution, command ingress, session preservation, presentation, and setup with mocked provider/network boundaries. No material authority or stored-data contract change requires separate proof.

Evidence

What I checked:

  • Pinned introduction and merge ownership: Reviewed the merge-base-to-head introduced hunks. The test merge's raw parents are the pinned base followed by the exact PR head; its changes remain confined to this cleanup. (a6d0f16a1033)
  • Cleanup still absent from current main: Fetched main still constructs the unused role-ordering reset callback and retains the renderedTools branch. No merged replacement was established. The supplementary GitHub title search ended with a transport error, so it does not establish absence of related work. (src/auto-reply/reply/agent-runner-run.ts:631, cfb58027051f)
  • Removed reset path was unreachable: The original-tree reference search found callback construction, forwarding, types, and test invocations, but no production invocation. The surviving fallback settlement handles context overflow and role-ordering failures before returning to the execution loop. (src/auto-reply/reply/agent-runner-fallback-settlement.ts:97, 710e3d5edea0)
  • Authorization and credential behavior preserved: The shared command wrapper performs the same text-command and sender checks before invoking handlers. Credential prompting retains environment selection, existing-value retention, and sensitive input masking. No material authority expansion was identified. (src/channels/plugins/setup-wizard-helpers.ts:647, 710e3d5edea0)
  • Existing-state and public-contract review: Skill snapshot persistence retains partial updates and session-generation checks; setup writes retain existing account-selection and enabled-field behavior. Shared media and turn types preserve their fields and optionality. No stored-data format, migration, public export removal, or new configuration option was identified. (src/auto-reply/reply/session-updates.ts:45, 710e3d5edea0)
  • HTML removal has no producer: The export owner constructs SessionData without renderedTools; the original reference search found that field only in the removed renderer branch. The remaining rendering path preserves escaping and existing output. (src/auto-reply/reply/commands-export-session.ts:300, 710e3d5edea0)

Likely related people:

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

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 (3 earlier review cycles)
  • reviewed 2026-09-23T10:23:10.327Z sha 1a52f45 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-23T11:01:00.265Z sha b1de036ac40b96a33dc34903a7839a50749d29ac :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-23T11:48:33.418Z sha 710e3d5 :: needs real behavior proof before merge. :: none

@steipete
steipete force-pushed the deslop/10-auto-reply-sweep-20260922 branch 2 times, most recently from 626b1b0 to b1de036 Compare September 23, 2026 10:53
@steipete
steipete force-pushed the deslop/10-auto-reply-sweep-20260922 branch from b1de036 to 710e3d5 Compare September 23, 2026 11:31
@steipete
steipete merged commit b1f980f into main Sep 23, 2026
238 checks passed
@steipete
steipete deleted the deslop/10-auto-reply-sweep-20260922 branch September 23, 2026 12:48
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant