Skip to content

refactor: deslop secrets, process, sessions, security, media, WhatsApp and voice-call - #160969

Merged
steipete merged 10 commits into
mainfrom
steipete/deslop-core-media-channels
Sep 29, 2026
Merged

steipete merged 10 commits into
mainfrom
steipete/deslop-core-media-channels

Conversation

@steipete

@steipete steipete commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Several core areas and two channel plugins had seen few or no dedicated deslop passes: src/secrets (2 prior passes), src/sessions, src/media, src/security, src/tts (3 each), src/process, src/hooks, src/media-understanding, the voice-call plugin (4 each), and the WhatsApp plugin (5). They carried forwarding helpers, duplicated local types, repeated projections, redundant re-normalization, dead options, and a single-purpose policy module.

User Impact

None intended. This is a behavior-preserving refactor. The following are unchanged: SecretRef resolution order, redaction, permission and audit decisions, process supervision timing and ordering, session and media persistence, the security-audit output, TTS/media provider selection, WhatsApp and voice-call transport behavior, error and log text, the config schema, and plugin SDK exports. No migration or operator action.

Why This Change Was Made

The pass removes 1,397 net production lines (891 added, 2,288 removed) across 62 production files. Tests lose 64 net lines: four voice-call policy unit tests went with the module they covered, which was merged into the Twilio provider; the provider-level tests still assert the same four outcomes.

Commit Area
refactor(secrets): deslop secrets runtime, apply and configure src/secrets
refactor(process): deslop process supervision and hooks src/process, src/hooks
refactor(sessions): deslop sessions and media src/sessions, src/media
refactor(security): deslop security audit, media understanding and tts src/security, src/media-understanding, src/tts
refactor(whatsapp): deslop WhatsApp plugin extensions/whatsapp
refactor(voice-call): deslop voice-call plugin extensions/voice-call
refactor: keep WhatsApp identity a leaf contract and shrink baselines cycle fix, orphaned export, assertion baseline

Guardrails, applied per slice:

  • Files imported by Doctor, migration, or update code, and files in the scripts/pr wrapper inventory, were excluded from editing (28 in secrets, 30 in process, 8 in sessions, 7 in security, 2 in media, 1 in media understanding). Files claimed by other open deslop PRs were also excluded, so the upgrade path is untouched.
  • No new source files; nothing outside these ten areas changed except the assertion-safety baseline.
  • Plugin SDK re-exported types stayed structurally identical: the media-understanding request types were restructured around a shared base with the same fields, optionality, and docs.

Review decisions worth checking:

  • secrets/apply.ts inlines the removed auth-store target helper. Its body was exactly the scoped-env resolveAgentDir plus resolveAuthProfileDatabasePath, with no main-agent special case.
  • The security audit's group-policy summary no longer counts other. The only consumer renders open and allowlist, so the finding text is unchanged.
  • One WhatsApp change was reverted during integration. It replaced the structural identity input types with Pick<WebInboundCallbackMessage…>, which created a madge type cycle and made the identity leaf depend on its consumer.

Evidence

Head b188eab4b10c (the slice commits plus a merge of current main). Everything ran locally on macOS with Node 26.

Command Result
oxfmt --check on all changed files pass
Type-aware lint: node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json (41 core files) and --tsconfig extensions/tsconfig.json (23 extension files) pass
pnpm tsgo:core, pnpm tsgo:extensions pass
node scripts/run-vitest.mjs <619 explicit files>: every non-E2E test under the ten areas 612 files passed, 7 skipped; 7,287 tests passed, 74 skipped, 0 failed
WhatsApp identity-related tests after the leaf-contract revert 357 passed
pnpm plugin-sdk:surface:check pass (no SDK surface change)
Plugin SDK API renderer, merge base vs head, plus Equals<> compiler check on the 13 rewritten reachable types identical export set; all 13 shapes equal
pnpm check:import-cycles, pnpm check:madge-import-cycles 0 cycles (after reverting the WhatsApp identity change that introduced one)
pnpm deadcode:exports 0 entries (after unexporting the now file-local hasConfiguredSecretRef)
check-assertion-safety-ratchet pass; three shrink-only baseline entries, no others touched
Codex autoreview, P2 threshold, branch against the merge base scoped-clean

Plugin SDK API: the pnpm plugin-sdk:api:diff wrapper failed locally on tool process supervision, so I ran its renderer directly (scripts/plugin-sdk-api-diff.mts --render-root) on the merge base bb4573cd427c and on this head, then compared the two reports. The export set is identical: 4,591 exports, the same names, kinds and sources. The only export declaration that changed is VideoDescriptionRequest, which is now an alias of the shared request base instead of a repeated literal. The declaration text of 17 sections changed because repeated literals became shared bases (RequirementsMetadata, MediaUnderstandingProviderRequest, ImagesDescriptionInput, Omit<SpeechSynthesisRequest, ...>, UserTurnPersistenceOptions). About 200 exports reach one of those sections. A throwaway compiler check asserted Equals<> between the head type and its pre-PR literal for every rewritten reachable type: OpenClawHookMetadata, HookEligibilityContext.remote, PreparedImageDescriptionInput, ExtractStructuredWithModelParams, VideoDescriptionRequest, AudioTranscriptionRequest, StructuredExtractionImageInput, SpeechSynthesisStreamResult, SpeechTelephonySynthesisRequest, SpeechProviderPrepareSynthesisContext, the UserTurnTranscriptRecorder persist parameters, and resolveStoredModelOverrideCore params. All 13 hold, and a widened negative control fails as expected. asProviderConfigMap left the rendered TTS module text, but it was never an SDK export.

No tests were added. Test cost falls slightly: four duplicate unit tests were removed with their module. Cross-area E2E and live suites were not run locally; hosted CI covers the changed-scope lanes.

Test cost

Changed test files. Local wall time is node scripts/run-vitest.mjs <file> --maxWorkers=1; it is dominated by cold transform of the plugin graph. CI seconds are the summed per-test durations Vitest reported in CI run 36533649108 on this head.

File Tests One-worker local wall CI test seconds (job)
extensions/whatsapp/src/question-reactions.test.ts 3 35-103 s (84-92% transform) 0.01 s (checks-node-changed-extensions-bundle-5). main has the same case as one test; this PR splits it into three raw-channel variants.
extensions/whatsapp/src/channel-outbound.test.ts 19 19 s 0.07 s (checks-node-changed-extensions-bundle-5)
extensions/voice-call/src/providers/twilio.test.ts 26 13 s 0.07 s (checks-node-changed-extensions-bundle-4)
extensions/voice-call/src/webhook/realtime-audio-pacer.test.ts 28 3 s 0.18 s (checks-node-changed-extensions-bundle-4)
src/security/audit-workshop-skills.test.ts 15 14 s 2.1 s (checks-node-changed-compact-small-14)
extensions/voice-call/src/providers/twilio/twiml-policy.test.ts removed (4 tests, covered by twilio.test.ts) - -

Upgrade compatibility

I ran the published-driver x candidate cell locally: OPENCLAW_UPGRADE_SURVIVOR_SCENARIOS=legacy-operator-state pnpm test:docker:published-upgrade-survivor, with published openclaw@latest (2026.9.6) as the driver and this branch as the candidate. Every data and compatibility stage passed: baseline, formerly bundled plugin config, candidate schemas, automatic migration, survival, Gateway start, probes and status, legacy cron owners, the candidate agent turn, and the legacy plugin.

The lane failed at its final legacy-operator-update-noop check. That check deep-compares the maintenance advisory prose of the first update (written by the published updater) with the second (written by the candidate). #160056, already on main and not touched by this PR, reworded that advisory in src/infra/gateway-supervision.ts, so every candidate built from current main fails that text equality. A separate follow-up will fix the harness to compare advisory kind rather than prose.

CI flakes investigated

  • Attempt 1: checks-node-changed-compact-large-10 aborted a Vitest fork with SIGABRT while running src/gateway/server.roles-allowlist-update.test.ts. The worker printed no diagnostic. Locally the file passed 3/3 alone, and the original eight-file gateway shard passed 2/2 in order. No existing issue or PR mentions this signature. This PR does not change gateway code, and the cause remains unexplained.
  • Attempt 2: checks-node-changed-compact-large-13 failed src/agents/subagents/registry/subagent-registry.test.ts > settles a collector yield seen through agent.wait without canceling it. Locally it passed 3/3 on this branch and 3/3 on main (115 tests each run). The test drained owned root work before the zero-delay fake-timer continuation ran. test(subagents): settle yielded wait continuation #160987 diagnosed it (it failed the same way on fix: cron jobs treat node policy denials as failures #160620); the fix is now on main as 4c61161 and is merged into this branch.
  • Head 1cf36117d51a: checks-node-compact-small-18 failed two cases of test/scripts/ci-node-worker-owner-boundary.test.ts twice. It was not a flake. The test ran its sparse shard-runner copy with the host environment, so in prebuilt-dist CI shards OPENCLAW_E2E_USE_PREBUILT_DIST=1 made the copy import scripts/lib/vitest-build-prerequisites.mts from outside its closure. Setting the flag reproduced the failure locally on main. It is fixed on main by bb4573c (6/6 with and without the flag) and merged here.
  • Separately, the tooling test update-restart-module-outcome was red on main; it is fixed on main by d28f3f7 (direct red-main fix) and included through the merge.

@clawsweeper

clawsweeper Bot commented Sep 29, 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 Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components. This comment is informational because the PR author has repository Maintain or Admin access.

  • Current SHA: b188eab4b10cb7af15d6ad85a0b8a412d14ec8b6
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/secrets/apply.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.
  • src/secrets/runtime-config-collectors-core.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/secrets/runtime-config-collectors-plugins.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/secrets/runtime-web-tools.shared.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/secrets/runtime-web-tools.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/security/audit-extra.summary.ts: Controls product security checks or trust decisions. Check whether the change weakens detection, protection, or remediation.
  • src/security/audit-model-refs.ts: Controls product security checks or trust decisions. Check whether the change weakens detection, protection, or remediation.
  • src/security/audit.deep.runtime.ts: Controls product security checks or trust decisions. Check whether the change weakens detection, protection, or remediation.
  • src/security/audit.ts: Controls product security checks or trust decisions. Check whether the change weakens detection, protection, or remediation.
  • src/security/dangerous-config-flags-core.ts: Controls product security checks or trust decisions. Check whether the change weakens detection, protection, or remediation.

Carefully review these changes before merging.

@openclaw-barnacle openclaw-barnacle Bot added channel: voice-call Channel integration: voice-call channel: whatsapp-web Channel integration: whatsapp-web size: XL labels Sep 29, 2026
@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 Sep 29, 2026
@clawsweeper

clawsweeper Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 29, 2026, 3:52 AM ET / 07:52 UTC (Revision 7).

ClawSweeper review

What this changes

The branch consolidates helpers and types across secrets, process supervision, sessions, security audits, media, speech, WhatsApp, and voice calling without an intended user-visible change.

Merge readiness

⛔ Blocked before merge - 1 item remains

The cleanup remains absent from current main, and this review found no discrete introduced defect. The previous request for test-cost detail is addressed in the PR body; the related PRs concern separate validation failures and do not supersede this work.

Priority: P3
Reviewed head: b188eab4b10cb7af15d6ad85a0b8a412d14ec8b6

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The simplification is coherent and has substantial reported validation, with no concrete introduced defect found in this review.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The maintainer-authored refactor is exempt from the external-contributor proof gate. Its body reports a published 2026.9.6 driver exercising candidate Gateway, legacy state, and agent-turn stages; the final advisory-text assertion failed on an unrelated main change. The changed secret, channel, and voice-call owners were not independently run in this read-only review, and the diff changes no stored-data contract.
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 refactor is exempt from the external-contributor proof gate. Its body reports a published 2026.9.6 driver exercising candidate Gateway, legacy state, and agent-turn stages; the final advisory-text assertion failed on an unrelated main change. The changed secret, channel, and voice-call owners were not independently run in this read-only review, and the diff changes no stored-data contract.
Evidence reviewed 11 items Repository policy: The full root policy and applicable extensions policy were read. The review checked single-owner behavior, plugin boundaries, security-sensitive changes, and meaningful test coverage.
Introduced secret-resolution change: The pinned introduced diff moves provider credential reading into the shared selection owner while retaining configured-value precedence and keyless-provider selection controls.
Introduced WhatsApp change: Delivery identity extraction is shared by approval and question reactions; the approval caller retains its WhatsApp channel filter.
Findings None None.
Security None None.

How this fits together

Gateway configuration and credentials feed secret resolution, security checks, sessions, and process supervision. Media and speech handling then support channel plugins that deliver messages and calls.

flowchart LR
  A[Config and credentials] --> B[Secret resolution]
  A --> C[Security audit]
  B --> D[Sessions and processes]
  D --> E[Media and speech]
  E --> F[WhatsApp and voice calls]
  F --> G[Messages and calls]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source -1397, Tests -64, Other -1. Total -1462 across 68 files.

View PR surface stats
Area Files Added Removed Net
Source 62 891 2288 -1397
Tests 5 87 151 -64
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 3 -1
Total 68 980 2442 -1462

Review metrics

Metric Value Why it matters
Changed-test cost 4 modified test files have local wall and CI timings; 1 suite removed The PR body now supplies the cost detail requested in the previous review.

Stored data model

Persistent data-model change detected: unknown-data-model-change: src/hooks/gmail-setup-utils.ts, unknown-data-model-change: src/secrets/configure.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep the consolidated owners and existing public contracts, then complete normal exact-head maintainer review and merge gates.

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

Not applicable: this refactor alleges no current-main defect to reproduce. The review compared the pinned introduced changes with their existing owners and the validation reported in the PR.

Is this the best way to solve the issue?

Yes for the stated cleanup: the branch removes forwarding logic while retaining the existing credential, webhook, and channel owners. Its broad scope still calls for ordinary maintainer review.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against a8d20b7438e8.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is an internal cleanup with no intended user-visible behavior change or identified urgent regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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 refactor is exempt from the external-contributor proof gate. Its body reports a published 2026.9.6 driver exercising candidate Gateway, legacy state, and agent-turn stages; the final advisory-text assertion failed on an unrelated main change. The changed secret, channel, and voice-call owners were not independently run in this read-only review, and the diff changes no stored-data contract.

Evidence

What I checked:

  • Repository policy: The full root policy and applicable extensions policy were read. The review checked single-owner behavior, plugin boundaries, security-sensitive changes, and meaningful test coverage. (AGENTS.md:1, b188eab4b10c)
  • Introduced secret-resolution change: The pinned introduced diff moves provider credential reading into the shared selection owner while retaining configured-value precedence and keyless-provider selection controls. (src/secrets/runtime-web-tools.shared.ts:41, b188eab4b10c)
  • Introduced WhatsApp change: Delivery identity extraction is shared by approval and question reactions; the approval caller retains its WhatsApp channel filter. (extensions/whatsapp/src/inbound/send-result.ts:43, b188eab4b10c)
  • Introduced voice-call change: The Twilio provider now owns the former webhook and TwiML forwarding logic; verification still calls the existing webhook security owner with the same option fields. (extensions/voice-call/src/providers/twilio.ts:263, b188eab4b10c)
  • Bounded consult result retained: The removed local prompt truncation followed a shared result reader that already trims and limits the speakable text, including a truncation marker. (src/talk/consult-question.ts:123, b188eab4b10c)
  • Current-main comparison: Representative central files have not changed between the pinned base and fetched main, while this PR changes them. Its central cleanup is therefore still unique to the branch. (src/secrets/runtime-web-tools.shared.ts:39, a8d20b7438e8)

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)
  • Shakker: 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 (6 earlier review cycles)
  • reviewed 2026-09-29T05:00:54.464Z sha ff6dec6 :: blocked before merge. :: none
  • reviewed 2026-09-29T05:25:34.385Z sha bfecb5c :: blocked before merge. :: none
  • reviewed 2026-09-29T05:54:26.860Z sha bfecb5c :: blocked before merge. :: none
  • reviewed 2026-09-29T06:20:07.504Z sha 1cf3611 :: blocked before merge. :: none
  • reviewed 2026-09-29T06:30:30.681Z sha 1cf3611 :: blocked before merge. :: none
  • reviewed 2026-09-29T07:04:38.171Z sha b188eab :: blocked before merge. :: none

@steipete steipete self-assigned this Sep 29, 2026
steipete added a commit that referenced this pull request Sep 29, 2026
The subagent registry collector-yield case drained owned root work before the
fake-timer zero-delay agent.wait continuation ran, so under shard load the run
could still be running when asserted. It failed twice in checks-node-changed on
#160620 and on #160969 while passing standalone. Advance fake timers by zero
before draining, matching the suite's existing lifecycle-settlement pattern.

Diagnosis and fix from #160987.

Co-authored-by: Gio Della-Libera <[email protected]>
@steipete
steipete merged commit 398a85f into main Sep 29, 2026
216 of 217 checks passed
@steipete
steipete deleted the steipete/deslop-core-media-channels branch September 29, 2026 08:01
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 30, 2026
The subagent registry collector-yield case drained owned root work before the
fake-timer zero-delay agent.wait continuation ran, so under shard load the run
could still be running when asserted. It failed twice in checks-node-changed on
openclaw#160620 and on openclaw#160969 while passing standalone. Advance fake timers by zero
before draining, matching the suite's existing lifecycle-settlement pattern.

Diagnosis and fix from openclaw#160987.

Co-authored-by: Gio Della-Libera <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 30, 2026
…p and voice-call (openclaw#160969)

* refactor(secrets): deslop secrets runtime, apply and configure

* refactor(process): deslop process supervision and hooks

* refactor(sessions): deslop sessions and media

* refactor(security): deslop security audit, media understanding and tts

* refactor(whatsapp): deslop WhatsApp plugin

* refactor(voice-call): deslop voice-call plugin

* refactor: keep WhatsApp identity a leaf contract and shrink baselines

Restore the structural identity input types so identity.ts does not import inbound types (madge cycle), unexport the now file-local hasConfiguredSecretRef, and shrink the assertion-safety baseline for three files the pass cleaned.

* Merge remote-tracking branch 'origin/main' into steipete/deslop-core-media-channels

* Merge remote-tracking branch 'origin/main' into steipete/deslop-core-media-channels

* Merge remote-tracking branch 'origin/main' into steipete/deslop-core-media-channels

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: voice-call Channel integration: voice-call channel: whatsapp-web Channel integration: whatsapp-web 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