Repository navigation
diag(slack): log thread-resolution decision on tool sends (ENG-16509) - #88
Merged
convyusboy merged 1 commit intoJul 30, 2026
Conversation
A PSS agent-turn Slack message posted top-level instead of in-thread while its siblings from the same turn threaded correctly. It went through the agent message-send TOOL path (action-runtime.ts sendMessage/uploadFile), whose thread auto-inject decision (resolveThreadTsFromContext) is completely silent — no INFO/DEBUG record says WHY one send dropped its thread anchor. This is a distinct class from ENG-16286 (invalid_thread_ts): that fingerprint is absent in the PSS logs, and the send.ts invalid-thread degrade never fired. The context is built once per turn and shared across tool calls, so currentThreadTs was set for the whole turn (siblings threaded). A single divergent send can therefore only go top-level via one of two silent branches: (1) the agent passed topLevel:true / threadId:null, or (2) slackContextTargetsMatch returned false for that send's channel-target format. Existing logs can't disambiguate. Add logSlackThreadResolution — a logVerbose (DEBUG-level, matching send.ts convention) trace emitted from sendMessage and uploadFile capturing topLevel, threadIdNull, explicitThreadTs, currentThreadTs, replyToMode, targetsMatch, and the resolved value (TOP-LEVEL when suppressed). Message content is never logged. No behavior change — the resolver inputs/outputs are identical. A verbose repro can now pin cause 1 vs 2 to pick the real fix. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
There was a problem hiding this comment.
cubic analysis
No issues found across 2 files
Linked issue analysis
| Status | Acceptance criteria | Notes |
|---|---|---|
| ✅ | Emit a DEBUG/verbose trace on Slack tool sends (sendMessage and uploadFile) that records the thread-resolution decision and key inputs (topLevel, threadIdNull, explicitThreadTs, currentThreadTs, currentChannelId/currentMessagingTarget, replyToMode, hasReplied, sameChannelThreadRequired, targetsMatch, and the resolved value). | A new helper logSlackThreadResolution builds a verbose string containing the listed fields and is invoked from both sendMessage and uploadFile branches. |
| ✅ | Log uses 'TOP-LEVEL' (or equivalent) when the anchor is suppressed and records whether suppression was due to explicit opt-out (topLevel/threadId:null) vs target mismatch (targetsMatch=false). | The resolver log includes resolved= with resolved defaulting to 'TOP-LEVEL'; tests assert resolved=TOP-LEVEL and check topLevel/threadIdNull or targetsMatch flags for the two causes. |
| ✅ | Do not log message content (only diagnostic/context fields). | The logging helper accepts only action/to/explicitThreadTs/topLevel/threadIdNull/context/resolvedThreadTs and constructs a diagnostic string; no message content parameter is included or interpolated. |
| ✅ | Add tests that validate the verbose log distinguishes cause 1 (explicit topLevel/threadTs null) from cause 2 (targetsMatch=false) and covers uploadFile sends. | action-runtime.test.ts adds a block 'thread-resolution DEBUG logging (ENG-16509)' with tests that assert presence of expected log fragments for normal threading, topLevel/threadTs-null suppression, targetsMatch=false, and uploadFile. |
| ✅ | No behavioral change to thread resolution (logging only) — resolveThreadTsFromContext remains functionally unchanged. | The PR extracts and names locals purely for logging and passes the same inputs to resolveThreadTsFromContext; test run and CI notes indicate no regressions (tsc and oxlint clean). |
There was a problem hiding this comment.
Approve — clean, well-scoped diagnostic.
- Traces to ENG-16509; problem statement crisply distinguishes it from ENG-16286 (#65).
- No behavior change confirmed: resolveThreadTsFromContext inputs/outputs are byte-identical; params were only hoisted into named locals. The extra slackContextTargetsMatch() call in the log builder is a pure predicate (verified — no side effects), so it's safe.
- No content/PII/secrets logged — only decision-context booleans + thread anchors.
- Tests: 5 new cases assert cause-1 (topLevel/threadId:null) vs cause-2 (targetsMatch=false) disambiguation + the uploadFile path; logVerbose mocked via importOriginal cleanly.
- logVerbose matches the send.ts DEBUG convention; no duplication.
Ship it.
convyusboy
deleted the
ridho/eng-16509-pss-slack-agent-tool-posted-message-landed-top-level-instead
branch
July 30, 2026 07:26
convyusboy
added a commit
that referenced
this pull request
Jul 30, 2026
Version-bump release carrying the 3 commits merged onto boon since boon.11: - #86: edge/WAF HTML 429 now classifies as transient timeout (not model rate_limit), so a Cloudflare-relayed 429 no longer surfaces a false 'all models rate-limited'; the client-side ride-out retry still absorbs it. - #88: DEBUG-level trace of the Slack thread-resolution decision on the agent message-send tool path (sendMessage/uploadFile); observability only, no behavior change, message content never logged. - #89: sentry-monitor classifies gateway-relayed upstream (Bedrock) 5xx vs gateway-origin 5xx via classify5xxSource(), tagging error_class + http_status on the model_call_ended capture so the Rohan alert can split/rate-gate them. Bumps the gateway + @openclaw/slack + @openclaw/msteams to 2026.6.11-boon.12 in lockstep (7 files: 3 package.json, 3 npm-shrinkwrap.json, CHANGELOG.md). Tagging v2026.6.11-boon.12 after merge triggers boon-release.yml to publish the 6 assets.
convyusboy
added a commit
that referenced
this pull request
Jul 31, 2026
…ease asset (ENG-15788) (#94) * release: 2026.6.11-boon.12 Version-bump release carrying the 3 commits merged onto boon since boon.11: - #86: edge/WAF HTML 429 now classifies as transient timeout (not model rate_limit), so a Cloudflare-relayed 429 no longer surfaces a false 'all models rate-limited'; the client-side ride-out retry still absorbs it. - #88: DEBUG-level trace of the Slack thread-resolution decision on the agent message-send tool path (sendMessage/uploadFile); observability only, no behavior change, message content never logged. - #89: sentry-monitor classifies gateway-relayed upstream (Bedrock) 5xx vs gateway-origin 5xx via classify5xxSource(), tagging error_class + http_status on the model_call_ended capture so the Rohan alert can split/rate-gate them. Bumps the gateway + @openclaw/slack + @openclaw/msteams to 2026.6.11-boon.12 in lockstep (7 files: 3 package.json, 3 npm-shrinkwrap.json, CHANGELOG.md). Tagging v2026.6.11-boon.12 after merge triggers boon-release.yml to publish the 6 assets. * feat(release): publish @openclaw/diagnostics-prometheus as a fork release asset (ENG-15788) The diagnostics-prometheus plugin's dist is excluded from the published gateway package (`!dist/extensions/diagnostics-prometheus/**`), so a fleet host has no way to run the Prometheus exporter unless the plugin is installed separately — and gandalf-manager's Alloy scrape (job boon-agent-openclaw, ENG-15788 step 2) has nothing to read until it is. There was no release tarball for it. - Pin extensions/diagnostics-prometheus/package.json + npm-shrinkwrap.json to 2026.6.11-boon.12 in lockstep with the gateway (same contract as slack/msteams — the pack step asserts TAG == v<version>). - Add a 'Pack diagnostics-prometheus plugin tarball + compute sha256' step to boon-release.yml mirroring the slack/msteams steps (runtime-build + manifest overlay pack), and wire the new asset + its .sha256 into the Publish step (both create and upload --clobber arms) so it ships on the same v*-boon.N tag. Asset contract: openclaw-diagnostics-prometheus-<version>.tgz + .tgz.sha256 Unlike slack/msteams this plugin does NOT use openKeyedStore (no trust-gate), so a bare install wouldn't crash-loop — but the npm-pack: trusted path is used for install-shape consistency across the fork's plugins. Version must advance in lockstep on every future release, same as slack/msteams. actionlint clean; YAML valid. Pack machinery validated by CI on the release run (no node_modules in this worktree to pack locally).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a DEBUG (
logVerbose) trace of the thread-resolution decision to the Slack agent message-send tool path (action-runtime.tssendMessage/uploadFile). The trace recordstopLevel,threadIdNull,explicitThreadTs,currentThreadTs,currentChannelId/currentMessagingTarget,replyToMode,hasReplied,sameChannelThreadRequired,targetsMatch, andresolved(TOP-LEVELwhen the thread anchor was suppressed). Message content is never logged.No behavior change —
resolveThreadTsFromContext's inputs/outputs are byte-identical; the params were only extracted into named locals so they can be logged.Why (ENG-16509)
On the PSS host, one agent-turn Slack message (the "weld & handling takeoff" summary) posted top-level instead of in the active thread, while its siblings from the same turn (the
.xlsxupload + the "Delivered…" note) threaded correctly.This is a distinct class from ENG-16286 (
invalid_thread_ts, fixed in #65):invalid_thread_ts, 0reply_broadcast, no "streaming … falling back", no top-level "delivered reply to channel" in the PSS logs.send.tsinvalid-thread degrade never fired.The threading context is built once per turn and shared across every tool call, so
currentThreadTswas set for the whole turn (siblings threaded). A single divergent send can therefore only go top-level via one of two silent, previously-unlogged branches inresolveThreadTsFromContext:topLevel:true/threadId:nullon that send, orslackContextTargetsMatch(to, context)returned false for that send's channel-target format.Existing logs can't disambiguate — the entire decision path emits nothing. This PR closes that observability gap so a verbose repro pins cause 1 vs 2, which then selects the real fix (agent/tool-schema guidance for cause 1; target-match normalization and/or extending the ENG-16286 thread-anchor recovery to the tool-send path for cause 2).
Testing
extensions/slack/src/action-runtime.test.ts: 68 passed (5 new — assert the log distinguishes cause 1 from cause 2, plus normal-thread anduploadFilecases).tsc -p extensions/slack/tsconfig.json --noEmit: clean.oxlinton both files: clean.Follow-ups (not in this PR)
debugfile log level.🤖 Generated with Claude Code
Summary by cubic
Add DEBUG logging for Slack tool sends to trace thread-resolution decisions and diagnose ENG-16509 where a tool-posted message landed top-level instead of in-thread. No behavior change.
logVerbose"thread-resolve" line fromsendMessageanduploadFile, capturing key inputs and the resolved anchor (usesTOP-LEVELwhen suppressed). Message content is never logged.topLevel:true/threadId:null) from channel-target mismatch, aligning with the Linear issue’s needs.resolveThreadTsFromContextbehavior is unchanged; parameters were surfaced only for logging.uploadFilecases.Written for commit 9eb9de2. Summary will update on new commits.