Repository navigation
fix(slack): recover bot identity after transient auth.test failure - #117253
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 1, 2026, 2:37 AM ET / 06:37 UTC. ClawSweeper reviewWhat this changesThe PR makes Slack retry and later recover its bot identity after a transient startup Merge readiness⛔ Blocked until real behavior proof is added - 5 items remain Keep this PR open for human merge review. Current Priority: P1 Review scores
Verification
How this fits togetherThe bundled Slack plugin authenticates at startup, records the account identity in its monitor context, and uses that identity to evaluate mentions and publish channel health. Incoming Slack events then pass through mention filtering before they are dispatched to the OpenClaw agent runtime. flowchart LR
A[Slack API] --> B[Startup auth check]
B --> C[Slack monitor identity]
C --> D[Mention evaluation]
D --> E[Agent message dispatch]
C --> F[Connection health status]
A --> G[Incoming Slack event]
G --> D
Decision needed
Why: Repository policy makes real after-fix behavior proof a merge gate for external non-doc PRs, while the contributor has explicitly left sufficiency to maintainers because no Slack credentials were available. Before merge
Agent review detailsSecurityNone. PR surfaceSource +140, Tests +115. Total +255 across 14 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Add a redacted real Slack proof that shows transient startup authentication failure, degraded readiness, later identity recovery, healthy status, and a required-mention message reaching the agent; then refresh the exact-head review after rebasing or GitHub’s merge result is current. Do we have a high-confidence way to reproduce the issue? Yes from current source: startup auth failure leaves an empty identity in the monitor context, and current tests assert continued degraded operation after reconnect. This read-only review did not execute a Slack workspace reproduction. Is this the best way to solve the issue? Unclear. The proposed late-bound recovery is at the Slack plugin ownership boundary and fits the observed frozen-state defect, but missing real behavior proof and inability to retrieve the exact PR head prevent a full best-fix confirmation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 51c41c25c8c3. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
Dependency retry-contract inspection (
|
|
Maintainer decision (explicit): landing on the standing evidence — end-to-end Bolt-path recovery test (degraded boot → first-event identity adoption → healthy status → required-mention dispatch), 977/977 monitor suite, dual clean autoreviews, green CI on this exact head, and the direct |
|
Merged via squash.
|
…penclaw#117253) * fix(slack): recover bot identity after transient auth.test failure * docs(slack): document identity selection invariant * fix(slack): resolve startup auth fetch through plugin runtime
What Problem This Solves
A single transient failure of Slack's boot-time
auth.test(one 429, one >10s network blip) leaves the account permanently connected but unable to recognize mentions. The startup auth client usedretries: 0+rejectRateLimitedCalls: true; the failure was swallowed; the emptybotUserIdwas frozen into the monitor context for the process lifetime; the socket then connected and publishedconnected: truewith ahealthState: "degraded"string no core consumer reads. WithrequireMentiondefaulting to true for channels, every non-app_mentionroom message was dropped asmention-detection-unavailable, forever. Nothing retried; nothing restarted; status looked healthy. This exact terminal state was asserted by the shipped testprovider.auth-test-token.test.ts.Two adjacent status lies: HTTP mode never published connected/health status at all, and relay mode hardcoded
healthState: "healthy"over a degraded identity.Why This Change Was Made
Identity now recovers instead of freezing, fixed at the plugin's ownership boundary:
botUserId/botId/identityHealthlive as mutable state on the monitor context (the existingchannelsConfigpost-construction pattern). A singleresolveSlackRuntimeIdentityhelper encodes the identity rules once: user identity needs nobot_id(its human id is both mention target and self-send dedupe source); bot identity staysbot_id-gated fail-closed; enterprise installs never adopt from runtime context.auth.testper event (tokenVerificationEnabled: false) — a newonContextIdentitymiddleware seam adopts that identity when degraded; and socketonStartedre-runsauth.testwhen degraded, so recovery does not require inbound traffic. Adoption only ever fires while degraded — a healthy identity is never overwritten. Recovery republishes status, clearing the degraded state; mention gating reads the context per message, so detection resumes automatically.connected: false— tri-state rules preserved); relay mode reports actual identity health instead of hardcoded healthy.enterpriseOrgInstallthrow) and bot/user identity selection are unchanged.User Impact
A Slack account that boots during a rate limit or network blip now heals itself — on the next inbound event or socket (re)connect — instead of silently ignoring mentions until an operator notices and restarts. Operators see truthful status in all three transport modes.
Evidence
provider.auth-test-token.test.ts— 21/21; assertion changes are deliberate and inverted on purpose: transient boot failure now expects recovery (previously asserted permanent degradation); invalid bot-token fixtures remain persistently degraded, proving missingbot_idis never adopted; boot warning asserts "while unresolved" wording.main.extensions/slackonly; no core, SDK, or config surface changes.🤖 Generated with Claude Code
Dependency contract + live-proof status (added post-review)
Direct
@slack/[email protected]source inspection confirming the retry semantics this PR relies on (429 sleeps the full Retry-After inside the attempt wheremaxRetryTimecannot interrupt it — the startup fetch wrapper is what enforces the 35s budget; oldrejectRateLimitedCalls: truemade one 429 immediately fatal at boot): #117253 (comment)No Slack credentials exist on the implementing host, so an after-fix real-workspace transcript is not included; the end-to-end HTTP-mode adoption test plus 977/977 monitor tests are the standing behavioral evidence. Maintainer call on sufficiency is explicitly open.