Skip to content

test(discord): remove thread cache reset - #124278

Merged
steipete merged 1 commit into
mainfrom
test/remove-discord-thread-cache-reset
Aug 15, 2026
Merged

steipete merged 1 commit into
mainfrom
test/remove-discord-thread-cache-reset

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Discord thread-starter tests exported a production cache-reset function solely to erase module state between cases. That made the production barrel and cache owner carry a test-only API, while the tests depended on an implementation detail rather than the cache's real thread-ID identity.

Why This Change Was Made

Each test resolution now uses a unique synthetic thread ID, which isolates cases through the production cache key. The test-only reset implementation and barrel export can therefore be deleted without changing cache behavior or weakening the existing starter-content assertions.

User Impact

None. This is an internal test cleanup; Discord thread-starter behavior and cache policy are unchanged.

Evidence

  • node scripts/run-vitest.mjs extensions/discord/src/monitor/threading.starter.test.ts — 11 passed.
  • node scripts/check-changed.mjs -- extensions/discord/src/monitor/threading.cache.ts extensions/discord/src/monitor/threading.ts extensions/discord/src/monitor/threading.starter.test.ts — passed through the documented local fallback because no remote provider was ready.
  • git diff --check — passed.
  • Structured autoreview — clean, no accepted/actionable findings.
  • Production delta: -5 lines. Test delta: -2 lines. No docs, changelog, schema, protocol, migration, or operator-state change.

@clawsweeper

clawsweeper Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review August 15, 2026 20:46
@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord size: XS maintainer Maintainer-authored PR labels Aug 15, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Aug 15, 2026
@clawsweeper

clawsweeper Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 4:51 PM ET / 20:51 UTC.

ClawSweeper review

What this changes

The PR removes the Discord thread-starter cache reset test API and gives each resolver test a unique synthetic thread ID.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open. Current main still exposes and uses the test-only cache reset; this focused cleanup removes that seam while preserving isolation through the resolver’s real thread-ID cache key.

Priority: P3
Reviewed head: a68771ae4337cd797a25cb9b6a1c5627ff19e5df

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-aligned cleanup that removes a test-only production seam without changing cache behavior.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored internal test cleanup does not change observable Discord behavior; focused test and CI evidence in the PR body are the relevant proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored internal test cleanup does not change observable Discord behavior; focused test and CI evidence in the PR body are the relevant proof.
Evidence reviewed 5 items Current main still has the seam: Current main exports a cache-clearing function solely consumed by the colocated starter test, so the PR is not already implemented or obsolete.
Runtime cache identity: The resolver keys cached starters solely by the thread channel ID, and the message-context caller passes the real thread channel into that resolver.
PR uses the production isolation boundary: The proposed test helper produces a distinct thread ID for every resolution, avoiding cache cross-talk without adding a production-only reset API.
Findings None None.
Security None None.

How this fits together

Discord thread-starter resolution retrieves and caches the message that started a Discord thread before the message-context builder decides whether to include it in model context. The changed test now isolates calls using the same per-thread identity the runtime cache uses.

flowchart LR
  A[Incoming Discord thread] --> B[Message context builder]
  B --> C[Thread starter resolver]
  C --> D[Thread ID cache]
  C --> E[Starter text and identity]
  E --> F[Model context]
Loading

Before merge

  • Complete next step (P2) - This maintainer-owned focused PR needs normal review only; no discrete repair should be dispatched.
Agent review details

Security

None.

PR surface

Source -5, Tests -2. Total -7 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 0 5 -5
Tests 1 8 10 -2
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 8 15 -7

Review metrics

Metric Value Why it matters
Production versus test LOC production -5, tests -2 The change removes a production-only test seam and slightly simplifies the existing test without altering runtime cache policy.

Stored data model

Persistent data-model change detected: persistent cache schema: extensions/discord/src/monitor/threading.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Merge the deletion of the test-only barrel/cache reset and retain isolation through unique thread IDs, which exercise the cache’s actual runtime key.

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

Not applicable: the PR removes a test-only API rather than fixing a reported user-facing failure; source confirms the replacement isolation follows the real cache key.

Is this the best way to solve the issue?

Yes: unique thread IDs isolate test cases at the cache’s production boundary, unlike a barrel-exported reset that production callers do not need.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 37763e4d7ef8.

Labels

Label changes:

  • add P3: This is a small internal test-maintenance cleanup with no user-visible behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored internal test cleanup does not change observable Discord behavior; focused test and CI evidence in the PR body are the relevant proof.

Label justifications:

  • P3: This is a small internal test-maintenance cleanup with no user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored internal test cleanup does not change observable Discord behavior; focused test and CI evidence in the PR body are the relevant proof.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Introduced the thread-starter resolver, cache, test, and reset seam together. (role: feature introducer; confidence: high; commits: f7b809933d69; files: extensions/discord/src/monitor/threading.cache.ts, extensions/discord/src/monitor/threading.starter.ts, extensions/discord/src/monitor/threading.starter.test.ts)
  • steipete: Recent history shows extensive work across this Discord threading area, and current main contains an analogous test-reset cleanup authored by this contributor. (role: recent area contributor; confidence: medium; commits: 37763e4d7ef8; files: extensions/discord/src/monitor/threading.cache.ts, extensions/discord/src/monitor/threading.starter.test.ts)

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.

@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for a68771ae4337cd797a25cb9b6a1c5627ff19e5df:

Production delta: -5 lines. Tests: -2 lines. The cache reset and barrel export existed only for tests; cases now isolate through the production thread-ID cache key. No behavior, docs, changelog, schema, protocol, migration, or operator-state change.

@steipete
steipete merged commit f69226b into main Aug 15, 2026
159 of 168 checks passed
@steipete
steipete deleted the test/remove-discord-thread-cache-reset branch August 15, 2026 20:59
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

channel: discord Channel integration: discord maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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