fix: seed Slack thread context after reset#97100
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 28, 2026, 2:31 AM ET / 06:31 UTC. Summary PR surface: Source +186, Tests +538, Docs 0, Generated 0, Other +3. Total +727 across 21 files. Reproducibility: yes. Current main is source-reproducible by creating an existing Slack thread row that is stale under the reset policy, then preparing a reply in that thread: Slack's timestamp gate skips history while session initialization would roll the row to a fresh session. Review metrics: 2 noteworthy metrics.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the narrow reset-aware Slack reseeding fix after maintainer acceptance, while leaving broader rollover continuity to the separate family-history or carryover work. Do we have a high-confidence way to reproduce the issue? Yes. Current main is source-reproducible by creating an existing Slack thread row that is stale under the reset policy, then preparing a reply in that thread: Slack's timestamp gate skips history while session initialization would roll the row to a fresh session. Is this the best way to solve the issue? Yes. The latest head is the best narrow fix for this bug: it aligns Slack's initial thread-history gate with the same reset freshness semantics as session initialization, preserves the direct-monitor/fresh/zero-history cases, and avoids replaying archived transcripts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 119dc4bd821e. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +186, Tests +538, Docs 0, Generated 0, Other +3. Total +727 across 21 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
Mantis Slack Desktop Smoke QASummary: Mantis ran Slack QA scenario 'slack-thread-reset-history' inside a Crabbox Linux VNC desktop, opened Slack Web in the visible browser, and captured screenshot/video evidence.
Slack desktop/VNC browser Slack motion preview Motion-trimmed clips: Full videos: |
|
Non-maintainer review note after checking the Mantis artifact: the posted Slack smoke failure does not appear to reach the PR's Slack reset scenario. The run fails during remote hydration before the gateway/QA path starts, with The artifact report shows |
00f41c7 to
50e70ec
Compare
Live Slack proof for stale thread reseedingI reran a live Slack proof against the current PR head Proof shape: real Slack thread/API + PR prepare-path proof. This did not require a model turn; it verifies the exact pre-agent context path that decides whether a stale Slack thread session should reseed prior thread history. Slack evidence:
OpenClaw setup:
Checks:
Result: PASS. The prepared agent context included the real prior Slack thread context after the stale reset condition, while excluding the current message from the reseeded thread history and preserving it as the current user input. Scope note: this is intentionally narrower than a full Socket Mode gateway/model reply proof. It exercises real Slack history plus the changed OpenClaw prepare/context path, which is the regression surface for #97073. Screenshot note: the attached screenshot is visual context for the Slack thread used in this run. The assertion list above is the actual proof signal for ClawSweeper/review.
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |



What Problem This Solves
Fixes #97073.
Slack replies in an existing thread after a session reset could start a new OpenClaw session without re-seeding Slack thread context. The Slack prepare path treated any existing thread session row as an existing turn, while session initialization could later roll that same row to a new
sessionIdunder the reset policy. Withchannels.slack.thread.initialHistoryLimit=10andthread.inheritParent=true, that meant the model could receive the new reply and route metadata, but not the prior Slack replies that the operator expected on the first turn of the reset session.Why This Change Was Made
This change makes Slack prepare ask the session-store runtime whether the existing thread row should be considered fresh under the effective reset policy before deciding to suppress initial thread context. If the row exists but is stale, Slack prepare forces the initial Slack thread-history fetch and keeps the current fresh-existing-thread skip intact.
The session freshness helper centralizes the reset-policy comparison for plugin callers and preserves OpenClaw's provider-owned implicit-reset behavior, so provider-backed sessions are not unexpectedly treated as stale unless reset policy is explicitly configured.
User Impact
After a Slack thread session rolls past a daily or idle reset boundary, the next reply in that same Slack thread now starts the new OpenClaw session with the configured initial thread context. Fresh existing Slack threads still avoid repeated history injection, and
initialHistoryLimit=0still disables the Slack history fetch.Evidence
pnpm format -- src/plugin-sdk/session-store-runtime.ts src/plugin-sdk/session-store-runtime.test.ts extensions/slack/src/monitor/message-handler/prepare.test.tsnode --max-old-space-size=8192 --import tsx scripts/generate-plugin-sdk-api-baseline.ts --writepnpm format:check -- src/plugin-sdk/session-store-runtime.ts src/plugin-sdk/session-store-runtime.test.ts extensions/slack/src/monitor/config.runtime.ts extensions/slack/src/monitor/message-handler/prepare-thread-context.ts extensions/slack/src/monitor/message-handler/prepare.ts extensions/slack/src/monitor/message-handler/prepare.test.ts scripts/lib/plugin-sdk-doc-metadata.tsnode --max-old-space-size=8192 --import tsx scripts/generate-plugin-sdk-api-baseline.ts --checknode --max-old-space-size=8192 scripts/plugin-sdk-surface-report.mjs --checknode scripts/check-plugin-sdk-subpath-exports.mjsnode scripts/run-vitest.mjs src/plugin-sdk/session-store-runtime.test.ts extensions/slack/src/monitor/message-handler/prepare.test.ts extensions/slack/src/monitor/message-handler/prepare-thread-context.test.ts src/plugin-sdk/api-baseline.test.ts src/plugins/contracts/plugin-sdk-subpaths.test.tspnpm buildgit diff --checkcodex review --base origin/mainclean after the provider-owned session fix.agents/skills/autoreview/scripts/autoreview --mode localcleanNot run: full
pnpm checkand full test suite; this was validated with focused Slack/session-store/API-surface coverage plus build.AI Assistance
Implemented with Codex assistance. I reviewed the generated changes, ran the validation above, and addressed the initial review finding about provider-owned implicit-reset semantics before opening this draft PR.
Screenshots: not applicable; this is Slack/session-context runtime behavior.