Skip to content

fix(slack): let verified linked admins assign sessions from Slack - #159694

Merged
steipete merged 7 commits into
mainfrom
steipete/slack-verified-requester-assign
Sep 27, 2026
Merged

steipete merged 7 commits into
mainfrom
steipete/slack-verified-requester-assign

Conversation

@steipete

@steipete steipete commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes “assign it to me” from Slack for verified senders linked to administrator profiles. Those turns could identify the requester and discover the owner-only sessions tool, but Gateway calls had no operator principal and returned a concealed “Session was not found” error—even when the agent created the target.

User Impact

Verified linked administrators can create visible work sessions from Slack and assign sessions visible to them to their own profile. Native Socket Mode and signature-verified HTTP events preserve verified native IDs and supply requester_profile in per-turn user context. System instructions remain stable.

The sessions tool remains owner-only. Asserted/relay, unlinked, and linked non-admin senders gain no operator principal. Configured command owners retain their existing behavior, including configured-owner precedence over a linked profile. Unlinking, role downgrade, channel/Gateway lifecycle replacement, database retirement, and stale captures fail closed with “Channel operator authority changed; send a new request.”

No configuration keys, database schemas, protocols, SDK exports, or approval/execution-identity audit storage change. No deployment or live Gateway restart is included. Release-note context: verified linked Slack administrators can now complete assign-to-me for visible sessions, including agent-spawned sessions. Requested and design-approved by Peter Steinberger.

Why This Change Was Made

Channel command-owner admission now carries its already-prepared profile, role scopes, and access-grant facts into the existing admitted operator-run authority owner. The host binds that authority to the original command-owner assertion and channel/Gateway lifecycle, then carries it through reply options and run admission. Access-policy aborts, profile changes, and role-assignment changes also recheck active model execution through that same command assertion, preserving the channel revocation error. Existing in-process dispatch applies the profile principal and rechecks live authority; existing router and mutation authorization remain in force. The shared authority factory retains its first revocation failure so concurrent model executions receive the same actionable channel error. Original/current model restrictions are preserved, and privileged calls do not rediscover identity or infer it from session keys, names, or email.

The prior assignment test accidentally used standalone system scope. Its replacement uses the real profileless channel request scope, admitted authority, sessions tool, router, and persisted session state. The QA scenario now sends both the spawn request and subsequent assignment through signed Slack HTTP.

Evidence

  • Pre-fix boundary regression: Session "agent:main:dashboard:human-created" was not found. The corrected regression fails on the original production files and passes with the bridge.
  • src/channels/message-access/operator-authority.test.ts: 55 passed on the rebased head, 133.15 s wrapper wall / 92.10 s Vitest duration (the reviewed pre-rebase run also passed all 55: 190.08 s / 142.88 s). Covers human-created and agent-created visible targets, persisted ownership, revocation and active-model cancellation cases, configured-owner behavior, absent principals, native Slack assurance, and existing identity/grant lifecycle siblings. This suite uses actual worker-backed profile/session storage and router authorization; helper-only mocks would miss the defect.
  • src/auto-reply/reply/get-reply.config-override.test.ts: 12 passed, 56.89 s wrapper wall. Existing host-brand and option-copy guarantees remain intact.
  • Remote QA: baseline 0 passed / 1 failed in 21.986 s; final pushed head 1 passed / 0 failed / 0 skipped in 27.210 s. Baseline signed Slack spawn is denied access to its parent. Candidate signed spawn creates a shared, agent-created/agent-owned session; a later signed assignment takes the key from the actual spawn receipt and the owner ID from requester_profile, then readback confirms that human owner. The unlinked control receives neither profile metadata nor sessions.
OPENCLAW_BUILD_PRIVATE_QA=1 pnpm openclaw qa suite \
  --provider-mode mock-openai \
  --scenario slack-verified-requester-assignment \
  --channel-driver crabline --channel slack \
  --output-dir <isolated artifact directory>

Provider: blacksmith-testbox, Linux / Node 24.19.0; final lease tbx_01m3jf2d2a2qkdt2evbhdgqxnz, exact-head QA workflow. Remote HEAD 2072973e6a687eb5af8200b96ef189df9f3ee677, source tree 9d362a78c3658472fd9fc6faf80d9b8b59f9f8a1, and clean source were verified before execution. The earlier baseline and candidate were also checked by source hashes. This is signed synthetic Slack/real isolated Gateway proof with a mock model, not live Slack workspace proof. Native Testbox execution resolved a wrapper source-sync failure; task-owned runtime permissions were corrected before scenario execution.

The requested node scripts/check-changed.mjs ran once after a frozen-lockfile install. All selected guards, formatting, full typechecks, and three dead-export scans passed; lint found one new test JSON-cloning expression. It was replaced with structuredClone, then focused lint over every changed core file, core/messaging typechecks, remaining stylesheet lint, and git diff --check passed. No second full changed-file run was used.

Independent review found a missing cancellation notification: three focused regressions failed because the active model signal remained un-aborted after unlink, role downgrade, or access-grant revocation. The constructor now observes those existing owner notifications; all three pass with the canonical channel error. A follow-up shared-execution regression failed for the second subscriber with a generic error instead of the required channel error. The capability factory now retains the original failure for every consumer; its fail-closed latch remains unchanged. Existing presence, session-dispatch, and hosted-question expectations were updated to their original source errors.

Additional serial single-file proof: admission context 23 passed / 4.66 s; presence 10 passed / 33.94 s; session scopes/creation commit 14 passed / 81.49 s; hosted questions 6 passed / 43.32 s (wrapper wall). The two shared-model cancellation cases and access-grant case are included in the 55-test authority suite. Tests use existing broker-backed fixtures; no new per-test Gateway process, serial configuration, sleep, polling, or production test seam was added.

Final independent Codex autoreview is scoped-clean through P2. The review used the requested isolated route; all accepted findings were corrected and re-reviewed.

Rebased without conflicts onto b459eb600f238d38f8b7156675e5868751f52c54; git range-diff confirms all six task commits are patch-identical. Main added independently branded Gateway-local ingress attribution beside the channel admission path; the Slack path retains its original branch and operator-authority propagation. The final rebased boundary run passed all 55 tests, and exact-head signed Slack QA passed. Final QA installation and private build also passed (7.7 s and 29.8 s); all task-owned Testbox leases are stopped. The combined JSON verdict retains baseline, candidate, and exact post-rebase source identities.

Pushed head: 2072973e6a687eb5af8200b96ef189df9f3ee677. Signed Slack QA passes on this exact final head. The reviewed implementation remains patch-identical through both rebases. CI repair round 1: run 36351366557 reached 53 successful jobs, then checks-node-compact-large-13 failed one stale expected error in operator-role-policy.test.ts:252 (1,000 sibling assertions passed in that shard). The implementation correctly retained “operator source identity changed; start a new request”; the second assertion still expected “no longer active.” Fail-fast canceled 107 jobs. A bounded census found one analogous host retained-source assertion. The repair changes only those two expectations: role policy 22 passed / 35.04 s, retained host source 10 passed / 31.83 s, and focused lint passed. No production or QA source changes and no REST rerun. The test-only repair was committed in 79ae6bf397d711e20fb4a19c0faa82d3c2fef587 and is the patch-identical final commit 2072973e6a687eb5af8200b96ef189df9f3ee677; its independent Codex review is scoped-clean through P2. That run then reached 135 successful jobs before an unrelated main PR-wrapper fixture failure.

Upstream base repair: run 36353298117 failed four test/scripts/pr-wrappers.test.ts assertions expecting eight dispatch arguments after main added two more. All wrapper/test sources were byte-identical to the main base; a local single-file reproduction failed the same four cases (40.65 s). Main already landed the exact repair in 02c68e2a0cca157d5fab8b12d6346e234828ae29. Rebased specifically onto that named fix without conflicts; all seven task commits remain patch-identical. The four failing cases then passed (35.25 s). No unrelated tooling edit or REST rerun was made. Refreshed signed-Slack QA passed on this exact final head. Final CI run 36354660181 succeeded: 162 jobs passed, 19 skipped, zero failed or canceled. watch-pr-ci.mjs returned GREEN; gh run list and an exact-run read both confirm head 2072973e6a687eb5af8200b96ef189df9f3ee677. The raw combined GitHub rollup retained 17 superseded old-head records; the pinned watcher correctly excluded them. No REST job rerun was issued.

Final CI job wall times (shards include sibling files): build artifacts 221 s; production types 232 s; test types 234 s; core lint shard 2 417 s; the formerly failing role-policy shard 413 s; the formerly failing PR-wrapper shard 359 s. All five Windows shards passed (247–343 s); openclaw/ci-gate passed.

The prior Windows PNG-fixture failure is pre-existing on main and unrelated: main run 36329748142, failing Windows job reports the same media-tool-file-url.windows.test.ts:97 image assertion and incorrect data check. This PR does not change that fixture or media implementation. The rebased main includes the independent repair in 7969275f362c (test(media): use a decodable PNG in the Windows media tool test).

B3: docs +11 / −4, tests/support +584 / −85, production +122 / −6.

Full PR: tooling +2 / −0, docs +45 / −0, tests/support +1299 / −101, production +361 / −69.

This PR is intentionally unmerged.

@clawsweeper

clawsweeper Bot commented Sep 27, 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 docs Improvements or additions to documentation channel: slack Channel integration: slack gateway Gateway runtime extensions: qa-lab size: XL labels Sep 27, 2026
@steipete
steipete marked this pull request as ready for review September 27, 2026 14:30
@github-actions

github-actions Bot commented Sep 27, 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: 2072973e6a687eb5af8200b96ef189df9f3ee677
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/channel-operator-authority.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/operator-run-authority.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 27, 2026, 6:45 PM ET / 22:45 UTC (Revision 9).

ClawSweeper review

What this changes

The branch carries verified linked Slack requester identity into agent turns and Gateway authority so administrators can assign visible sessions, with documentation and QA coverage.

Merge readiness

✅ Ready for maintainer review

Current main still lacks the authority bridge needed for the reported assignment. The reviewed head addresses the earlier blocking finding, and I found no new blocking defect.

Priority: P1
Reviewed head: 2072973e6a687eb5af8200b96ef189df9f3ee677

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is coherent and boundary-tested, with credible reported real-path proof and no identified blocking defect.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The captured PR evidence reports baseline failure and after-fix persisted assignment through signed synthetic Slack HTTP, the real isolated Gateway, the sessions tool, and a mock model; the checked-in scenario tests an unlinked control, while boundary tests exercise revocation before final I/O. The referenced exact-head QA workflow was canceled and is not counted as a pass. No stored-data contract changes were identified.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The captured PR evidence reports baseline failure and after-fix persisted assignment through signed synthetic Slack HTTP, the real isolated Gateway, the sessions tool, and a mock model; the checked-in scenario tests an unlinked control, while boundary tests exercise revocation before final I/O. The referenced exact-head QA workflow was canceled and is not counted as a pass. No stored-data contract changes were identified.
Evidence reviewed 9 items Current main still lacks the bridge: The fetched main revision binds command-owner authority but does not attach operator-run authority to the Slack turn.
Introduced authority bridge: The introduced hunk binds the prepared channel command-owner assertion to a host-issued operator-run authority.
Native Slack assurance: A private receiver marker distinguishes native Socket Mode or signed HTTP reception from asserted relay messages before sender authentication is promoted.
Findings None None.
Security None None.

How this fits together

Slack receives messages and establishes sender identity before OpenClaw starts an agent turn. The agent's session tool passes an admitted operator principal to Gateway authorization, which decides whether to update a session owner.

flowchart LR
A[Slack event] --> B[Sender verification]
B --> C[Linked profile and role]
C --> D[Agent turn authority]
D --> E[Gateway session policy]
E --> F[Persisted session owner]
B --> G[Unverified sender denied]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +388, Tests +879, Docs +45, Other +225. Total +1537 across 48 files.

View PR surface stats
Area Files Added Removed Net
Source 29 476 88 +388
Tests 15 961 82 +879
Docs 2 45 0 +45
Config 0 0 0 0
Generated 0 0 0 0
Other 2 225 0 +225
Total 48 1707 170 +1537

Review metrics

Metric Value Why it matters
Production versus test growth production +361/−69; tests and support +1299/−101 The production growth connects existing authority owners; the larger test change covers assignment and forbidden callers at the boundary.

Technical review

Best possible solution:

Verified linked administrators can assign sessions visible to them, while unlinked, non-admin, asserted, and revoked senders cannot change session ownership.

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

Yes. A signed Slack message from a linked administrator followed by assignment of an agent-spawned visible session is a specific path; current main lacks the operator bridge, and the captured PR evidence reports the baseline failure.

Is this the best way to solve the issue?

Yes. The patch carries the already admitted identity through existing run and session authorization owners, with live checks before the ownership write.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P1: Verified linked Slack administrators currently encounter a failed session-assignment workflow.
  • merge-risk: 🚨 security-boundary: The branch carries a Slack principal into privileged Gateway session writes, making sender verification and live revocation security-critical even though the reviewed controls cover them.
  • 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. Sufficient (terminal): The captured PR evidence reports baseline failure and after-fix persisted assignment through signed synthetic Slack HTTP, the real isolated Gateway, the sessions tool, and a mock model; the checked-in scenario tests an unlinked control, while boundary tests exercise revocation before final I/O. The referenced exact-head QA workflow was canceled and is not counted as a pass. No stored-data contract changes were identified.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured PR evidence reports baseline failure and after-fix persisted assignment through signed synthetic Slack HTTP, the real isolated Gateway, the sessions tool, and a mock model; the checked-in scenario tests an unlinked control, while boundary tests exercise revocation before final I/O. The referenced exact-head QA workflow was canceled and is not counted as a pass. No stored-data contract changes were identified.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Josh Avant: 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 (8 earlier review cycles)
  • reviewed 2026-09-27T14:38:33.266Z sha f568b00cfe01252890e98c15394af8a834017de9 :: blocked before merge. :: [P1] Complete assignment authority before instructing agents to assign
  • reviewed 2026-09-27T14:54:39.016Z sha dd76be0e21f308b4956cbcf294b13b2c5cacd776 :: needs real behavior proof before merge. :: [P1] Complete assignment authority before guiding agents to assign
  • reviewed 2026-09-27T15:18:22.405Z sha ada62a1 :: needs real behavior proof before merge. :: [P1] Complete assignment authority before instructing the agent
  • reviewed 2026-09-27T15:38:12.578Z sha ada62a1 :: needs real behavior proof before merge. :: [P1] Carry linked operator authority through assignment
  • reviewed 2026-09-27T16:35:18.058Z sha ada62a1 :: needs real behavior proof before merge. :: [P1] Carry linked operator authority through assignment
  • reviewed 2026-09-27T21:30:40.824Z sha 668dcd94ceaacb78449a12616d2446bd28ee56c6 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-27T21:59:53.453Z sha 79ae6bf397d711e20fb4a19c0faa82d3c2fef587 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-27T22:23:53.968Z sha 2072973 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 27, 2026
@steipete
steipete force-pushed the steipete/slack-verified-requester-assign branch from dd76be0 to ada62a1 Compare September 27, 2026 15:10
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 27, 2026
@steipete
steipete force-pushed the steipete/slack-verified-requester-assign branch from ada62a1 to 668dcd9 Compare September 27, 2026 21:20
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Sep 27, 2026
@steipete steipete changed the title fix(slack): let verified linked Slack users assign sessions to themselves fix(slack): let verified linked admins assign sessions from Slack Sep 27, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 27, 2026
Release note: Slack users linked to an administrative profile can ask an
agent to assign a session to them from ordinary messages and app mentions
received through Socket Mode or signature-verified HTTP. Generic trusted
requester metadata now carries the canonical linked profile ID and display
label; Discord verified senders benefit from the same core path. The
sessions tool remains owner-only.

Mint transport assurance at native reception and preserve it through the
existing durable ingress kind. Keep relay and mixed-assurance batches
asserted. Preserve the exact native Slack sender ID so the host identity
handoff matches finalized SenderId instead of rejecting its lowercase form.

Resolve requester facts through the existing worker-backed identity owner.
Bind their private carrier to the admitted sender, account, and channel,
recheck context and live link authority at prompt use, and retain no new
stored identity fields. Consolidate shared message-source and slash input
types to keep existing large modules within their line-growth limits.

Validation: 199 tests passed across five serial single-file Vitest runs,
including real Socket/HTTP receiver preparation, relay replay, linked
admin/member/unlinked senders, unlink/relink, genuine-carrier transplant
rejection, and persisted sessions.assignOwner through the agent tool.
Regressions failed before their corresponding repairs. Independent Codex
review is scoped-clean through P2; git diff --check passed.

The once-authorized check-changed run stopped at line-growth violations.
Those were repaired and affected tests rerun; the one-run host limit left
that gate unrepeated and typecheck/lint unrun. No live deployment was tested.

Follow-ups: native slash commands still need host-bound requester context;
assignment for non-owner channel requesters needs a separate permission design.
Forward the single prepared linked-identity result, including known absence,
through command-owner authorization instead of resolving it a second time.
Keep the existing live authority checks and owner-only sessions policy.

Release note: linked requester profiles and short assign-to-me guidance now
live in host-generated per-turn conversation info, keeping the system prompt
byte-stable across different or unlinked senders. Use the canonical account
default and preserve lowercase Slack allowFrom and stored pairing approvals
while retaining native sender ID case for identity handoff.

Correct the cross-boundary Slack test fixture to use the maintained public
artifact loader, retain the context builder overloads, return synchronous
avatar data, and await preparation after SDK socket events. No SDK export,
protocol, configuration, schema, or permission expansion is introduced.

Validation: single-file authority tests 40 passed; Slack authorization tests
57 passed, including real persisted lowercase pairing approvals and a wrong-
sender negative control. New read-count and prompt-cache regressions failed
before the repair. Affected fixture cases passed again after type/lint fixes.
Full check-changed passed core/extension and test typechecks, lint, all guards,
and its six Doctor-contract tests. Independent Codex review of the final
staged candidate is scoped-clean through P2; git diff --check passed.
Prove signed Slack HTTP ingress carries a linked administrative requester
profile in per-turn user context and offers the owner-only sessions tool.
An unlinked sender receives neither fact. Seed only the personal-profile
prerequisite while the ephemeral Gateway is stopped; use public role/link RPCs.

Capture strict Crabline readiness before runtime API traffic, retain the
unaltered runtime recorder, and probe the same adapter at final capture.
The recorder regression fails before the repair and passes afterward.

The optional model-issued assignment diagnostic still fails at the separate
admitted operator-authority boundary, despite a real shared target existing.
Record this coordinator gap without broadening permissions or claiming full
assignment success. Native slash requester context remains a follow-up.

Validation: signed-ingress QA passed on Blacksmith Testbox; focused tests,
applicable lint/typecheck/guards, and independent review through P2 passed.
The one full changed-file run exposed stale installed fs-safe; restoring the
pinned version fixed core types. Remaining core-test failure is fixed on main
by e9af8eb. No changelog, schema, protocol, or SDK surface changes.
Declare the process-launched QA fixture as a Knip executable root so its dependency graph remains audited. The exact failing unused-file scan now passes for both production and the full tree; independent review is clean through P2.
… owner authority

Carry the prepared linked administrator through the existing admitted operator authority. Preserve live command-owner, role, model, and access-grant restrictions for every dispatch and active model execution. Retain the original revocation failure for shared consumers. Prove visible-session assignment and fail-closed lifecycle behavior without changing tool gating, schemas, protocol, or SDK exports.
@steipete
steipete force-pushed the steipete/slack-verified-requester-assign branch from 79ae6bf to 2072973 Compare September 27, 2026 22:15
@steipete
steipete merged commit a2c698f into main Sep 27, 2026
258 of 260 checks passed
@steipete
steipete deleted the steipete/slack-verified-requester-assign branch September 27, 2026 23:52
@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 28, 2026
…enclaw#159694)

* fix(slack): resolve verified linked requester profiles

Release note: Slack users linked to an administrative profile can ask an
agent to assign a session to them from ordinary messages and app mentions
received through Socket Mode or signature-verified HTTP. Generic trusted
requester metadata now carries the canonical linked profile ID and display
label; Discord verified senders benefit from the same core path. The
sessions tool remains owner-only.

Mint transport assurance at native reception and preserve it through the
existing durable ingress kind. Keep relay and mixed-assurance batches
asserted. Preserve the exact native Slack sender ID so the host identity
handoff matches finalized SenderId instead of rejecting its lowercase form.

Resolve requester facts through the existing worker-backed identity owner.
Bind their private carrier to the admitted sender, account, and channel,
recheck context and live link authority at prompt use, and retain no new
stored identity fields. Consolidate shared message-source and slash input
types to keep existing large modules within their line-growth limits.

Validation: 199 tests passed across five serial single-file Vitest runs,
including real Socket/HTTP receiver preparation, relay replay, linked
admin/member/unlinked senders, unlink/relink, genuine-carrier transplant
rejection, and persisted sessions.assignOwner through the agent tool.
Regressions failed before their corresponding repairs. Independent Codex
review is scoped-clean through P2; git diff --check passed.

The once-authorized check-changed run stopped at line-growth violations.
Those were repaired and affected tests rerun; the one-run host limit left
that gate unrepeated and typecheck/lint unrun. No live deployment was tested.

Follow-ups: native slash commands still need host-bound requester context;
assignment for non-owner channel requesters needs a separate permission design.

* fix(channels): reuse requester facts and keep prompts stable

Forward the single prepared linked-identity result, including known absence,
through command-owner authorization instead of resolving it a second time.
Keep the existing live authority checks and owner-only sessions policy.

Release note: linked requester profiles and short assign-to-me guidance now
live in host-generated per-turn conversation info, keeping the system prompt
byte-stable across different or unlinked senders. Use the canonical account
default and preserve lowercase Slack allowFrom and stored pairing approvals
while retaining native sender ID case for identity handoff.

Correct the cross-boundary Slack test fixture to use the maintained public
artifact loader, retain the context builder overloads, return synchronous
avatar data, and await preparation after SDK socket events. No SDK export,
protocol, configuration, schema, or permission expansion is introduced.

Validation: single-file authority tests 40 passed; Slack authorization tests
57 passed, including real persisted lowercase pairing approvals and a wrong-
sender negative control. New read-count and prompt-cache regressions failed
before the repair. Affected fixture cases passed again after type/lint fixes.
Full check-changed passed core/extension and test typechecks, lint, all guards,
and its six Doctor-contract tests. Independent Codex review of the final
staged candidate is scoped-clean through P2; git diff --check passed.

* test(qa): cover verified Slack requester assignment

Prove signed Slack HTTP ingress carries a linked administrative requester
profile in per-turn user context and offers the owner-only sessions tool.
An unlinked sender receives neither fact. Seed only the personal-profile
prerequisite while the ephemeral Gateway is stopped; use public role/link RPCs.

Capture strict Crabline readiness before runtime API traffic, retain the
unaltered runtime recorder, and probe the same adapter at final capture.
The recorder regression fails before the repair and passes afterward.

The optional model-issued assignment diagnostic still fails at the separate
admitted operator-authority boundary, despite a real shared target existing.
Record this coordinator gap without broadening permissions or claiming full
assignment success. Native slash requester context remains a follow-up.

Validation: signed-ingress QA passed on Blacksmith Testbox; focused tests,
applicable lint/typecheck/guards, and independent review through P2 passed.
The one full changed-file run exposed stale installed fs-safe; restoring the
pinned version fixed core types. Remaining core-test failure is fixed on main
by 2872954. No changelog, schema, protocol, or SDK surface changes.

* test(qa): register requester profile fixture entrypoint

Declare the process-launched QA fixture as a Knip executable root so its dependency graph remains audited. The exact failing unused-file scan now passes for both production and the full tree; independent review is clean through P2.

* fix(gateway): act as the linked admin for channel turns with verified owner authority

Carry the prepared linked administrator through the existing admitted operator authority. Preserve live command-owner, role, model, and access-grant restrictions for every dispatch and active model execution. Retain the original revocation failure for shared consumers. Prove visible-session assignment and fail-closed lifecycle behavior without changing tool gating, schemas, protocol, or SDK exports.

* test(qa): prove linked Slack admins can assign agent-owned sessions

* test(gateway): preserve original operator revocation assertions

Co-authored-by: Peter Steinberger <[email protected]>
obviyus added a commit that referenced this pull request Nov 25, 2026
…roves it (#205155)

## Problem

An owner listed in `commands.ownerAllowFrom` got a different answer depending on the channel they wrote from (OA2 D23).

- Since #204904, a configured owner on a channel that declares its sender id `verified` is the Gateway owner: same grant as the owner's Control UI turn, including operator tools and pull request actions.
- Only Discord, Telegram, Google Chat, Mattermost, X and native Slack declared `verified`. The other bundled channels used the default `asserted`, even where the platform authenticates the sender.
- So an owner on Signal, WhatsApp, Matrix, Teams and others kept owner-only tools but got no operator grant: `github_publish` refused them with "This conversation has no Gateway operator identity … A Gateway owner adds this sender to commands.ownerAllowFrom", which they already were.

## Fix

Each channel plugin declares what its transport proves. No core decision changes.

**Now `verified`** (the platform authenticates the sender id, and the plugin reads it from the platform's authenticated delivery):

| Channel | Why the sender id is proven |
|---|---|
| WhatsApp | Baileys reads DM `remoteJid` / group `participant` from WhatsApp stanza metadata on the linked-device session (Noise handshake pinned to WhatsApp's certificate chain); LIDs resolve through the device's own mapping, never message text. The primary identifier was typed `phone`, which the host never treats as a person; it is WhatsApp's stable id, so that override is removed. |
| Signal | signal-cli reports `sourceNumber`/`sourceUuid` from the decrypted, sender-certified envelope; the daemon is the operator's own linked device. |
| Matrix | `event.sender` comes from the homeserver, which authenticates local users and checks federation signatures; allowlists match MXIDs only, never display names. |
| Microsoft Teams | The Teams SDK validates the Bot Framework JWT before dispatch (401 on bad signature or audience); the connector supplies `from.aadObjectId`/`from.id`. |
| LINE | `X-Line-Signature` HMAC over the raw body is checked before the user id is read. |
| Nextcloud Talk | The bot webhook HMAC (bot secret) is checked before the actor id is read. |
| Zalo | Bot API updates arrive on the secret-token webhook or token-authenticated polling. |
| Zalo Personal | `uidFrom` arrives on the authenticated Zalo session, not from message content. |
| Synology Chat | The NAS sends `user_id` on the token-checked outgoing webhook. |

**Stays `asserted`:**

| Channel | Why |
|---|---|
| iMessage | The same `imsg` watch also delivers SMS (spoofable caller id), and rows carry no validated service field. |
| SMS | Twilio signs the webhook, not the originating number. |
| IRC | Server prefixes prove no account. |
| Tlon | Club authors are explicitly unverified; group authors come from content. |
| Slack relay | The relay authenticates the router, not each Slack event. Native Socket Mode / HTTP Events (the default) were already `verified` per event (#159694); unchanged here. |
| A2A | The token authenticates a peer agent, not a person. |
| Feishu | Its primary identifier is a plugin kind, not a stable id, so `verified` would not change the grant. |
| QA channel | Synthetic test transport. |

**Not in this PR (cut less), follow-up:** Nostr and Buzz (every event signature is verified against the sender pubkey), Twitch (`user-id` tag on the authenticated chat connection) and ClickClack (author from the re-fetched server message) also prove the sender. Their declaration sits inside a transport loop, so a red-on-base owner cell needs either a test-only export (refused by the unused-export check) or moving the declaration into an `ingress-identity.ts` module. That move is a separate PR.

**Refusal text.** Where a channel cannot prove the sender, the `github_publish` refusal now says: "This channel cannot confirm who you are, so it cannot inspect PRs; use Control UI, Discord or Telegram for this. If you are not the Gateway owner, ask an admin to link your channel account to your Gateway profile first." Same text at both throw sites (`github-publication-inspect.ts`, `github-publication-inspect-reader.ts`).

**Docs:** `gateway/config-channels/commands.md` lists the channels that prove the sender.

## Decisions (recorded, not asked)

- **Transport security is the operator's configuration**, as for Telegram's API root: a Signal daemon, a Matrix homeserver on a private network (plaintext is opt-in), or a Zalo API override reached over plaintext is the operator's choice. Accepted edge, named here, no code. The delta is small: an asserted owner already had owner-only tools (exec), which a forged transport would reach anyway.
- **One refusal text for every no-identity case.** The inspect refusal cannot tell an asserted-channel owner from an unlinked sender or a source-less scheduled run; the second sentence covers the non-owner case.
- **Declarations moved next to their normalizers** so the test can run the real declaration: LINE → `bot-access.ts`, Nextcloud Talk → `policy.ts`, Zalo → `group-access.ts`, Zalo Personal → `ingress.ts` (with its allowlist normalizer). The Zalo/Zalo Personal moves also keep `monitor.ts` under the line cap.
- Production lines are not net negative: each channel adds its declaration and a one-line reason (requested behavior).

## User impact

- An owner on WhatsApp, Signal, Matrix, Teams, LINE, Nextcloud Talk, Zalo, Zalo Personal or Synology Chat gets the same permissions as in the Control UI (operator tools, `github_publish`, PR actions), with no Control UI step.
- A linked person on those channels gets their profile's Control UI grant (same rule as Discord/Telegram since #204904).
- An owner on iMessage, SMS or IRC is told the channel cannot confirm who they are and where to go instead.

## Evidence

- **Owner cell per channel** (`test/channel-verified-owner.integration.test.ts`, new): each flipped channel's real declaration (WhatsApp, Signal, Matrix, Teams, Synology Chat through the plugin's own ingress function) runs through the real host ingress and context builder, with the real plugin registered so the owner entry uses its allowlist normalizer; asserts the owner profile with `operator.admin`. Head 9/9. **Base (declarations `asserted`): all fail** (no operator authority).
- Pre-push, E2E and CI: comments below.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 26, 2026
…roves it (openclaw#205155)

## Problem

An owner listed in `commands.ownerAllowFrom` got a different answer depending on the channel they wrote from (OA2 D23).

- Since openclaw#204904, a configured owner on a channel that declares its sender id `verified` is the Gateway owner: same grant as the owner's Control UI turn, including operator tools and pull request actions.
- Only Discord, Telegram, Google Chat, Mattermost, X and native Slack declared `verified`. The other bundled channels used the default `asserted`, even where the platform authenticates the sender.
- So an owner on Signal, WhatsApp, Matrix, Teams and others kept owner-only tools but got no operator grant: `github_publish` refused them with "This conversation has no Gateway operator identity … A Gateway owner adds this sender to commands.ownerAllowFrom", which they already were.

## Fix

Each channel plugin declares what its transport proves. No core decision changes.

**Now `verified`** (the platform authenticates the sender id, and the plugin reads it from the platform's authenticated delivery):

| Channel | Why the sender id is proven |
|---|---|
| WhatsApp | Baileys reads DM `remoteJid` / group `participant` from WhatsApp stanza metadata on the linked-device session (Noise handshake pinned to WhatsApp's certificate chain); LIDs resolve through the device's own mapping, never message text. The primary identifier was typed `phone`, which the host never treats as a person; it is WhatsApp's stable id, so that override is removed. |
| Signal | signal-cli reports `sourceNumber`/`sourceUuid` from the decrypted, sender-certified envelope; the daemon is the operator's own linked device. |
| Matrix | `event.sender` comes from the homeserver, which authenticates local users and checks federation signatures; allowlists match MXIDs only, never display names. |
| Microsoft Teams | The Teams SDK validates the Bot Framework JWT before dispatch (401 on bad signature or audience); the connector supplies `from.aadObjectId`/`from.id`. |
| LINE | `X-Line-Signature` HMAC over the raw body is checked before the user id is read. |
| Nextcloud Talk | The bot webhook HMAC (bot secret) is checked before the actor id is read. |
| Zalo | Bot API updates arrive on the secret-token webhook or token-authenticated polling. |
| Zalo Personal | `uidFrom` arrives on the authenticated Zalo session, not from message content. |
| Synology Chat | The NAS sends `user_id` on the token-checked outgoing webhook. |

**Stays `asserted`:**

| Channel | Why |
|---|---|
| iMessage | The same `imsg` watch also delivers SMS (spoofable caller id), and rows carry no validated service field. |
| SMS | Twilio signs the webhook, not the originating number. |
| IRC | Server prefixes prove no account. |
| Tlon | Club authors are explicitly unverified; group authors come from content. |
| Slack relay | The relay authenticates the router, not each Slack event. Native Socket Mode / HTTP Events (the default) were already `verified` per event (openclaw#159694); unchanged here. |
| A2A | The token authenticates a peer agent, not a person. |
| Feishu | Its primary identifier is a plugin kind, not a stable id, so `verified` would not change the grant. |
| QA channel | Synthetic test transport. |

**Not in this PR (cut less), follow-up:** Nostr and Buzz (every event signature is verified against the sender pubkey), Twitch (`user-id` tag on the authenticated chat connection) and ClickClack (author from the re-fetched server message) also prove the sender. Their declaration sits inside a transport loop, so a red-on-base owner cell needs either a test-only export (refused by the unused-export check) or moving the declaration into an `ingress-identity.ts` module. That move is a separate PR.

**Refusal text.** Where a channel cannot prove the sender, the `github_publish` refusal now says: "This channel cannot confirm who you are, so it cannot inspect PRs; use Control UI, Discord or Telegram for this. If you are not the Gateway owner, ask an admin to link your channel account to your Gateway profile first." Same text at both throw sites (`github-publication-inspect.ts`, `github-publication-inspect-reader.ts`).

**Docs:** `gateway/config-channels/commands.md` lists the channels that prove the sender.

## Decisions (recorded, not asked)

- **Transport security is the operator's configuration**, as for Telegram's API root: a Signal daemon, a Matrix homeserver on a private network (plaintext is opt-in), or a Zalo API override reached over plaintext is the operator's choice. Accepted edge, named here, no code. The delta is small: an asserted owner already had owner-only tools (exec), which a forged transport would reach anyway.
- **One refusal text for every no-identity case.** The inspect refusal cannot tell an asserted-channel owner from an unlinked sender or a source-less scheduled run; the second sentence covers the non-owner case.
- **Declarations moved next to their normalizers** so the test can run the real declaration: LINE → `bot-access.ts`, Nextcloud Talk → `policy.ts`, Zalo → `group-access.ts`, Zalo Personal → `ingress.ts` (with its allowlist normalizer). The Zalo/Zalo Personal moves also keep `monitor.ts` under the line cap.
- Production lines are not net negative: each channel adds its declaration and a one-line reason (requested behavior).

## User impact

- An owner on WhatsApp, Signal, Matrix, Teams, LINE, Nextcloud Talk, Zalo, Zalo Personal or Synology Chat gets the same permissions as in the Control UI (operator tools, `github_publish`, PR actions), with no Control UI step.
- A linked person on those channels gets their profile's Control UI grant (same rule as Discord/Telegram since openclaw#204904).
- An owner on iMessage, SMS or IRC is told the channel cannot confirm who they are and where to go instead.

## Evidence

- **Owner cell per channel** (`test/channel-verified-owner.integration.test.ts`, new): each flipped channel's real declaration (WhatsApp, Signal, Matrix, Teams, Synology Chat through the plugin's own ingress function) runs through the real host ingress and context builder, with the real plugin registered so the owner entry uses its allowlist normalizer; asserts the owner profile with `operator.admin`. Head 9/9. **Base (declarations `asserted`): all fail** (no operator authority).
- Pre-push, E2E and CI: comments below.

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

Labels

agents Agent runtime and tooling channel: slack Channel integration: slack docs Improvements or additions to documentation extensions: qa-lab gateway Gateway runtime merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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