Skip to content

improve(slack): expose accepted session states in verbose diagnostics - #169494

Open
changeroa wants to merge 3 commits into
openclaw:mainfrom
changeroa:fix/slack-status-terminal-20261012
Open

changeroa wants to merge 3 commits into
openclaw:mainfrom
changeroa:fix/slack-status-terminal-20261012

Conversation

@changeroa

@changeroa changeroa commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Related: #142772; follow-up to #145778. Adjacent, distinct work: #168544 (queued follow-up typing).

What Problem This Solves

Operators investigating a Slack agent that still appears to be working cannot tell from accepted status writes whether Slack reported the calling agent as active while the overall session remained processing.

User Impact

With existing verbose logging enabled, operators can inspect the requested state, API acceptance, and recognized returned session/agent states. This is a diagnostic improvement, not a fix or closure claim for the lingering Desktop indicator in #142772. No configuration migration is required.

Why This Change Was Made

The existing helper retains acceptance and title but discards status and agent_status. Those values can differ in a multi-agent session. Preserve them in the existing verbose diagnostic path using a fixed allowlist; do not log request/response identifiers, titles, tokens, or unknown response strings in the new line.

Status writes, retries, cleanup ordering, return values, and the existing error diagnostic are unchanged. The troubleshooting note explains the distinction and the evidence limits. #145778 already reports rejected terminal writes; this complements that work without duplicating #168544's lifecycle changes.

Evidence

  • Base: 656287c940a5287da9efe69aabde2348695e07e1.

  • Regression drives the real Slack monitor context and status helper with a recording Slack API fixture. On base, the expected response-state diagnostic is absent; the same assertion passes with this patch. The case includes accepted aggregate/agent disagreement, rejection, and private/unknown response sentinels.

  • Independent final-diff review: no actionable findings.

  • No production deployment, live Slack API, or Desktop-rendering test. The reported completed-turn symptom remains unresolved; this patch enables better evidence collection. No retry or reordering is proposed without such evidence.

  • Final head: 6c07d4ed8b1e0e6775e55c695a0e1f2b26a60122.

  • Focused regression: baseline failed (missing diagnostic, 18.05 s); final candidate passed (1 test, 33 skipped, 12.00 s wrapper wall / 8.99 s Vitest). Controlled API fixture, not live Slack.

  • Owning context and terminal-status suites: 37 tests passed, 28.52 s wrapper wall. The later acceptance-label-only change was rechecked by the focused regression and lint.

  • Extension production/test typechecks passed before that expression-only follow-up; final targeted type-aware lint, formatting, and git diff --check passed. Earlier lint findings on redundant boolean comparison/conversion were fixed; final lint took 27.24 s.

  • Docs MDX validation passed (1,341 files, 13.35 s wrapper wall). Repository-wide matrix, docs link audit and live Desktop proof were not run. Hosted CI results remain separate from local verification; no CI runtime is available at submission.

Review follow-up: shipped Gateway transport and logger proof

Verified the unchanged reviewed head 6c07d4ed8b1e0e6775e55c695a0e1f2b26a60122 through the supported CLI on October 12, 2026:

pnpm openclaw gateway run --port <isolated-port> --bind loopback --auth none --verbose

The process used disposable isolated state, synthetic credentials, and the existing SLACK_API_URL option directed at a local HTTP Slack stand-in. A synthetic provider supplied the reply. A genuinely HMAC-signed inbound Slack event passed through the Gateway HTTP route and Bolt HTTPReceiver, the normal message/typing lifecycle, the production status helper, and the real @slack/web-api 8.2.0 WebClient. Neither the WebClient nor the console/file logger was mocked or replaced.

Observed evidence:

  • The signed inbound request returned HTTP 200. The HTTP server recorded one agents.sessions.setStatus request for processing, followed by one for active.
  • The stand-in supplied ok: true, aggregate status: processing, and terminal agent_status: active. Both real Gateway stdout and its configured log file contained:
slack session status: requested=processing accepted=true status=processing agent_status=processing
slack session status: requested=active accepted=true status=processing agent_status=active
  • Four distinct private-response sentinels in title, token, channel_id, and response_metadata.private were absent from both log streams; the recognized state values above were present.
  • The lifecycle completed, one final chat.postMessage reached the local stand-in, and the Gateway reported one delivered reply.
  • The fixture process tree exited, both temporary listeners were gone, generated state was removed, and the reviewed source remained clean. The supported wrapper built the reviewed source successfully; no source changes or CI reruns were needed for this evidence update.

This closes the earlier mocked-client/mocked-logger coverage gap with an isolated shipped-Gateway transport run. It is not live Slack server acceptance or Slack Desktop proof: the returned states were controlled by the local HTTP stand-in. The original lingering-indicator symptom remains unresolved.

Fixture-only setup failures were corrected before the final run: retired nested DM config fields, an incorrect readiness-log matcher, and an early teardown that caused connection refusal after the first status capture. The final run waited for lifecycle completion and final delivery before teardown. These failures were not production changes or evidence of a product fix.

@clawsweeper

clawsweeper Bot commented Oct 12, 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 size: S labels Oct 12, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR adds verbose diagnostics showing requested Slack session states, API acceptance, and recognized returned session and agent states.

Example: A completed turn requests active, while Slack returns status=processing and agent_status=active.

  • Before: A successful status request produces no diagnostic exposing the returned states.
  • After: Verbose logging shows requested=active accepted=true status=processing agent_status=active.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, useful diagnostic improvement with shipped-entry-point evidence, preserved lifecycle behavior, and no open findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): At the unchanged reviewed head, a signed event through the supported Gateway CLI exercised the production status helper, real WebClient, and real stdout/file logger against local HTTP endpoints; captured terminal output shows aggregate/agent disagreement and excludes private sentinels, satisfying the prior rank-up request without proving live Slack or Desktop behavior.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Maintenance · Worth it: Yes · Fix scope: Complete
User problem: Operators cannot distinguish a successful terminal status request from Slack reporting different aggregate and agent states.
Reason: The stated diagnostic problem is fully addressed with existing logging and ownership; the PR correctly uses Related rather than claiming closure of the broader Desktop bug.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR provides useful, narrowly scoped Slack diagnostics absent from current main, with no actionable correctness findings.

Priority: P3
Reviewed head: 6c07d4ed8b1e0e6775e55c695a0e1f2b26a60122

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Slack plugin's existing status helper receives lifecycle status requests, calls the Slack WebClient, returns acceptance to its callers, and sends sanitized response states to the existing verbose logger.

flowchart LR
  A[Slack turn lifecycle] --> B[Monitor context]
  B --> C[Session status helper]
  C --> D[Slack WebClient]
  D --> E[Slack API]
  E --> C
  C --> F[Verbose logger]
  C --> B
Loading

Technical review

Best possible solution:

Land the focused diagnostics in the existing Slack status owner while leaving investigation of the Desktop indicator with its separate report.

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

Current main visibly discards returned status fields after an accepted request; the contributor reports baseline regression failure, candidate success, and matching Gateway output, without claiming reproduction of the Desktop symptom.

Is this the best way to solve the issue?

The existing helper is the appropriate owner, and a fixed response allowlist exposes useful evidence without speculative retries, lifecycle changes, or private payload logging.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Slack session-status helper keeps the original intent (b8e7b7b: One plugin-local owner introduced session states, native Stop support, and synchronized titles through the public Slack client.)
  • Terminal-status failure diagnostics keeps the original intent (5a36317: Report rejected terminal writes while preserving acceptance independently of aggregate state and leaving retries and ordering unchanged.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Introduced change and current-main comparison: The pinned introduction adds only diagnostics, their regression test, and documentation; current main's helper still returns acceptance and title without logging returned status fields. (extensions/slack/src/session-status.ts:63, 6c07d4ed8b1e)
  • Existing ownership and privacy regression: The added case exercises the real monitor context and status helper, checks differing aggregate and agent states, and excludes private fields and unknown response strings; it adds no production test seam. (extensions/slack/src/monitor/context.test.ts:690, 6c07d4ed8b1e)
  • Shipped Gateway transport and logger evidence: The current PR body records a signed inbound HTTP event through the supported Gateway CLI, real WebClient, and stdout/file logger at the reviewed head. Captured output includes the terminal aggregate/agent disagreement, excludes four private sentinels, and accompanies final reply delivery; external endpoints were local HTTP stand-ins. (6c07d4ed8b1e)
  • Scope and discussion: The linked report and inspected screenshot establish completed work alongside a lingering working indicator, not its cause; the contributor explicitly keeps that issue open and presents this change as evidence collection. Public docs: docs/channels/slack/troubleshooting.md. (docs/channels/slack/troubleshooting.md:87, 6c07d4ed8b1e)
  • Feature history and preserved intent: Symbol history identifies the original session-status owner in b8e7b7b and later typed-SDK refactoring in 6391a9a; the merged terminal-failure diagnostic preserves acceptance independently of aggregate status. (extensions/slack/src/session-status.ts:48, b8e7b7bb7792)
  • Pinned dependency contract: The patch consumes @slack/web-api response fields, establishing the dependency boundary. At the installed 8.2.0 tag, status and agent_status are optional strings; the WebClient throws on rejected API responses, which continue through the existing error diagnostic. Dependency instructions were read; no SDK implementation or generated types are changed. (packages/web-api/src/types/response/AgentsSessionsSetStatusResponse.ts:12, a98047a7f271)

Likely related people:

  • Peter Steinberger: Raw commit b8e7b7b adds extensions/slack/src/session-status.ts:46 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b8e7b7bb7792; files: extensions/slack/src/session-status.ts)
  • Alix-007: Raw commit 5a36317 adds docs/channels/slack/troubleshooting.md:83 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5a3631738432; files: docs/channels/slack/troubleshooting.md)

PR surface

Source +19, Tests +43, Docs +2. Total +64 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 19 0 +19
Tests 1 43 0 +43
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 64 0 +64

Review metrics

Metric Value Why it matters
Production versus test LOC Production +19; tests +43 Small production growth adds bounded response sanitization and logging, supported by one distinct diagnostic/privacy regression.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P3: This improves operator diagnostics without changing message delivery, status transitions, configuration, or normal-level output.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-12T01:08:45.814Z sha 6c07d4e :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-12T01:15:44.039Z sha 6c07d4e :: needs real behavior proof before merge. :: none

Reviewed October 11, 2026, 10:08 PM ET / October 12, 2026, 02:08 UTC (Revision 3).

@changeroa

Copy link
Copy Markdown
Contributor Author

Added shipped-Gateway transport/logger evidence to the PR body at the unchanged reviewed head 6c07d4ed8b1e0e6775e55c695a0e1f2b26a60122. A signed HTTP inbound event exercised the real WebClient and stdout/file logger; the captured terminal diagnostic and private-field exclusion checks passed. Slack and model responses came from local HTTP stand-ins, so this is explicitly not live Slack or Desktop proof. No code changes or production deployment.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 12, 2026

This branch has not been deployed

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

Labels

channel: slack Channel integration: slack docs Improvements or additions to documentation P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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