Skip to content

refactor(channels): reuse setup config patch helpers - #140761

Merged
steipete merged 2 commits into
mainfrom
steipete/dedup-channel-setup-0906
Sep 7, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/dedup-channel-setup-0906

Conversation

@steipete

@steipete steipete commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Synology Chat and Feishu repeat root/account configuration patching already owned by the shared setup helpers. Keeping separate mutation paths risks inconsistent field clearing, enabling and account placement.

Why This Change Was Made

Synology delegates to patchScopedAccountConfig while preserving explicit enabling and clear-before-patch order. Its CLI/wizard callers already normalize account IDs. Feishu uses the shared root-enable helper and top-level section patching while preserving exact named-account keys, including the empty string, and leaving the channel-enabled flag unchanged for named-account updates.

The only follow-up code-accounting change is the maintainer-authorized assertion baseline shrink for Synology setup, 5 → 3, reflecting two deleted casts. No baseline grows and no SDK export, configuration option or persistent-state contract changes. This is a maintainer-requested channel de-duplication.

User Impact

No intended behavior change. Root placement, named-account credentials, sibling accounts, field clearing and enable flags remain the same.

Evidence

Before changing the draft, a clean detached current-main checkout was created outside ancestor installations, with a frozen-lockfile install. The exact command was:

node scripts/run-vitest.mjs extensions/synology-chat/src/channel.integration.test.ts

Checkout Revision Result Vitest duration
Fresh physical checkout Main 110a636dd16e48af3fa68acc11fe00215bb54e96 5 passed 33.69s
Same checkout Patch-identical rebased candidate 89dad4f282c3a06dc5738df37e6fafb984b42db3 6 passed 25.92s
Original nested worktree Same main 5 passed 19.30s
Original nested worktree Same candidate 6 passed 11.80s

The earlier 180000ms import-hook timeout did not reproduce in any control. No candidate-specific import failure was demonstrated. Its exact historical cause remains unproven; these results do not establish a pre-existing failure on current main. No test, timeout, skip or mock was changed during this attribution run. The final head differs from the tested candidate only by the assertion-baseline shrink. Timings vary with cache and host load and are not performance claims.

  • node scripts/run-vitest.mjs extensions/feishu/src/setup-surface.test.ts src/channels/plugins/setup-helpers src/channels/plugins/config-helpers: 54 tests passed.
  • node scripts/check-changed.mjs --base 110a636dd16e48af3fa68acc11fe00215bb54e96: passed in the separate physical checkout, including extension production/test types, extension lint, script lint, zero unused exports and zero runtime import cycles.
  • The two initial setup reviews and two fresh reviews found no actionable P0–P2 defect; the latest includes the exact shrink-only baseline update.
  • Full pnpm build: passed in 7m 19.2s in the separate physical checkout, including all 152 public SDK subpaths, 90 external plugins and native loads of 53 built modules.
  • Exact-head hosted CI run 34094604722: passed on cffbad32c9be6ac48ae4df8e0f77217930f877e7.

Known gap: validation uses synthetic configuration and webhook/SDK harnesses, with no live Synology or Feishu account and no external channel send. Local test runs have no hosted run URL.

@clawsweeper

clawsweeper Bot commented Sep 7, 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 channel: feishu Channel integration: feishu channel: synology-chat size: S maintainer Maintainer-authored PR labels Sep 7, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 3:21 AM ET / 07:21 UTC.

ClawSweeper review

What this changes

Feishu and Synology Chat setup reuse existing configuration helpers, add account-preservation tests, and reduce Synology’s assertion allowance to match removed casts.

Merge readiness

✅ Ready for maintainer review

This remains useful, maintainer-requested consolidation. No introduced correctness defect was found, and the updated validation evidence addresses the earlier Synology import-stall concern.

Priority: P3
Reviewed head: cffbad32c9be6ac48ae4df8e0f77217930f877e7

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused consolidation with preserved semantics, useful contract coverage, and reported successful validation resolving the prior concern.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied MEMBER association exempts this internal refactor from external-contributor live proof. The reported synthetic setup runs exercise the changed configuration owners; they do not demonstrate live Feishu or Synology messaging, which this patch does not change.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied MEMBER association exempts this internal refactor from external-contributor live proof. The reported synthetic setup runs exercise the changed configuration owners; they do not demonstrate live Feishu or Synology messaging, which this patch does not change.
Evidence reviewed 7 items Introduced scope: The complete host-pinned merge-base-to-head patch contains only the two plugin refactors, their tests, and the assertion allowance shrink. The verified test merge preserves this same scope; unrelated endpoint drift is not attributed to this PR.
Synology preserves setup semantics: The adapter supplies explicit account enablement through accountPatch, disables the helper’s implicit account-enabling behavior, and passes clearFields through. The shared implementation clears before patching, preserves root and sibling settings, and retains default-account root placement. CLI setup resolves account IDs before applying the adapter.
Existing shared contract: patchScopedAccountConfig implements selected-account clearing and patch precedence. Existing tests cover default credential replacement, preservation of disabled siblings, and explicit re-enabling. All three reused helpers already have exports through the setup SDK; this PR adds no public API.
Findings None None.
Security None None.

How this fits together

Channel setup turns CLI or wizard input into OpenClaw configuration. These helpers place settings at the channel root or selected account while preserving credentials, sibling accounts, and enablement rules.

flowchart TD
  A[CLI or wizard input] --> B[Plugin setup adapter]
  C[Existing channel settings] --> B
  B --> D{Root or named account}
  D --> E[Shared configuration helpers]
  E --> F[Updated channel settings]
  F --> G[Channel runtime]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -37, Tests +73, Other 0. Total +36 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 2 26 63 -37
Tests 2 73 0 +73
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 1 0
Total 5 100 64 +36

Review metrics

None.

Technical review

Best possible solution:

Keep channel-specific account semantics in the plugins while delegating configuration merging to the existing shared helpers.

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

Not applicable: this is a behavior-preserving refactor, and source inspection found no introduced failure. The supplied control runs no longer reproduce the earlier import timeout.

Is this the best way to solve the issue?

Yes: existing helpers cover the required behavior, and the adapters explicitly retain the plugin-specific enablement and account-key semantics without expanding the SDK.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P3: This is bounded maintenance that removes duplicate setup mutation code without introducing a user-facing capability or intentional behavior change.
  • 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 supplied MEMBER association exempts this internal refactor from external-contributor live proof. The reported synthetic setup runs exercise the changed configuration owners; they do not demonstrate live Feishu or Synology messaging, which this patch does not change.

Evidence

What I checked:

  • Introduced scope: The complete host-pinned merge-base-to-head patch contains only the two plugin refactors, their tests, and the assertion allowance shrink. The verified test merge preserves this same scope; unrelated endpoint drift is not attributed to this PR. (cffbad32c9be)
  • Synology preserves setup semantics: The adapter supplies explicit account enablement through accountPatch, disables the helper’s implicit account-enabling behavior, and passes clearFields through. The shared implementation clears before patching, preserves root and sibling settings, and retains default-account root placement. CLI setup resolves account IDs before applying the adapter. (extensions/synology-chat/src/setup-surface.ts:75, cffbad32c9be)
  • Existing shared contract: patchScopedAccountConfig implements selected-account clearing and patch precedence. Existing tests cover default credential replacement, preservation of disabled siblings, and explicit re-enabling. All three reused helpers already have exports through the setup SDK; this PR adds no public API. (src/channels/plugins/setup-helpers.ts:236, cffbad32c9be)
  • Feishu preserves exact account keys: Top-level section patching leaves named-account keys unchanged and does not enable the channel. The added table checks empty, whitespace-containing, and default keys while preserving credentials and siblings; root enablement delegates to an equivalent existing helper. (extensions/feishu/src/setup-core.ts:13, cffbad32c9be)
  • Previous validation concern addressed: The captured PR body reports successful Synology main/candidate controls in both fresh and nested checkouts, 54 passing focused setup/helper tests, and a successful changed-file check. The historical timeout’s cause remains unproven, but no candidate-specific failure was reproduced. Inspection confirms that the tested candidate differs from the final head only by the assertion allowance changing from 5 to 3. Build and hosted checks remain routine validation gates; no tests were executed during this read-only review. (config/assertion-safety-baseline.txt:1174, cffbad32c9be)
  • Still necessary on current main: The fetched main still contains the manual Feishu and Synology patching replaced by this branch. The latest release commit also retains the manual Feishu implementation. No merged replacement is established by the supplied discussion or inspected source. (extensions/feishu/src/setup-core.ts:17, 2d58961f33fd)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Tak Hoffman: 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 (1 earlier review cycle)
  • reviewed 2026-09-07T04:08:13.892Z sha a981ce8 :: blocked before merge. :: none

Preserve Synology enabling and Feishu exact account keys through existing
shared config helpers, without adding SDK exports.

Proof attempted: node scripts/run-vitest.mjs extensions/synology-chat/src/channel.integration.test.ts
The import hook times out at 180000ms; 31 config/Feishu tests pass. Draft only.
The setup consolidation removes two manual result casts. Shrink its assertion allowance from 5 to 3; no baseline grows. Matched main/candidate Synology controls and 54 focused setup/helper tests passed, and isolated autoreview is clean.
@steipete
steipete force-pushed the steipete/dedup-channel-setup-0906 branch from a981ce8 to cffbad3 Compare September 7, 2026 07:14
@steipete
steipete marked this pull request as ready for review September 7, 2026 07:15
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 7, 2026
@steipete
steipete merged commit 4dd8d3e into main Sep 7, 2026
220 of 221 checks passed
@steipete
steipete deleted the steipete/dedup-channel-setup-0906 branch September 7, 2026 07:27
@steipete

steipete commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 8, 2026
* refactor(channels): reuse setup config patch helpers

Preserve Synology enabling and Feishu exact account keys through existing
shared config helpers, without adding SDK exports.

Proof attempted: node scripts/run-vitest.mjs extensions/synology-chat/src/channel.integration.test.ts
The import hook times out at 180000ms; 31 config/Feishu tests pass. Draft only.

* chore(config): shrink Synology setup assertion allowance

The setup consolidation removes two manual result casts. Shrink its assertion allowance from 5 to 3; no baseline grows. Matched main/candidate Synology controls and 54 focused setup/helper tests passed, and isolated autoreview is clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu channel: synology-chat maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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