Repository navigation
fix(discord): clear pending launch watchdog - #115100
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 28, 2026, 8:05 AM ET / 12:05 UTC. ClawSweeper reviewWhat this changesThe PR keeps the per-click Discord Activity pending-launch watchdog handle and clears it after the pending-launch write race settles, with a regression test for successful writes. Merge readiness✅ Ready for maintainer review Keep open. This is a focused Discord Activity resource-cleanup fix; the retained watchdog is cleared on both race outcomes, and the updated PR body now includes direct exact-head terminal evidence for the successful-write path. Priority: P3 Review scores
Verification
How this fits togetherA Discord Activity button records a pending launch before asking Discord to launch the Activity. That record is bounded by a 250 ms watchdog so a slow store operation cannot delay the interaction; the patch releases the timer once that bounded wait has resolved. flowchart LR
A[Discord Activity button click] --> B[Pending-launch store write]
B --> C[250 ms watchdog]
C --> D[Write-versus-timeout decision]
D --> E[Clear watchdog handle]
E --> F[Launch Discord Activity]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +7, Tests +63. Total +70 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep the timer cleanup and regression test as written, then land it through the normal required-check gate once the current head remains green. Do we have a high-confidence way to reproduce the issue? Yes. The current-base implementation leaves the 250 ms watchdog handle inaccessible after the write wins, and the PR supplies an exact-head production-module terminal observation showing the corrected lifecycle. Is this the best way to solve the issue? Yes. Clearing the timer in the owner of the race is the narrowest maintainable fix; it preserves the store's ownership, timeout budget, late-write handling, and Activity launch ordering. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 89b6d85cdd86. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
…ivity-write-timer
…ivity-write-timer
|
Merged via squash.
|
…etwork-none * origin/main: (24 commits) refactor(sessions): isolate legacy transcript fixtures (#115231) fix(discord): clear pending launch watchdog (#115100) fix(agents): stop quadratic subagent prompt rendering (#115263) fix(memory-core): recover dreaming cron reconciliation (#115174) fix(qa-lab): filter incompatible channel scenarios (#115087) fix(android): respect locale in compact labels test(i18n): prove iOS discovery catalog ownership chore(i18n): refresh gateway discovery catalogs fix(i18n): include shared discovery copy in macOS catalog fix(apple): localize gateway discovery status chore(i18n): drop release-owned changelog entry fix(macos): localize privacy permission prompts fix(voice-call): bracket IPv6 webhook hosts (#115135) test(ci): split control UI scope coverage fix(ui): detect composed accessibility copy fix(ci): run localization checks for UI changes test(ui): catch untranslated accessibility labels fix(ui): localize chat action labels fix(ui): localize chat status indicators fix(ui): sync document locale metadata ...
…-20260728 * origin/main: (21 commits) refactor(sessions): isolate legacy transcript fixtures (#115231) fix(discord): clear pending launch watchdog (#115100) fix(agents): stop quadratic subagent prompt rendering (#115263) fix(memory-core): recover dreaming cron reconciliation (#115174) fix(qa-lab): filter incompatible channel scenarios (#115087) fix(android): respect locale in compact labels test(i18n): prove iOS discovery catalog ownership chore(i18n): refresh gateway discovery catalogs fix(i18n): include shared discovery copy in macOS catalog fix(apple): localize gateway discovery status chore(i18n): drop release-owned changelog entry fix(macos): localize privacy permission prompts fix(voice-call): bracket IPv6 webhook hosts (#115135) test(ci): split control UI scope coverage fix(ui): detect composed accessibility copy fix(ci): run localization checks for UI changes test(ui): catch untranslated accessibility labels fix(ui): localize chat action labels fix(ui): localize chat status indicators fix(ui): sync document locale metadata ...
* origin/main: (199 commits) refactor(workboard): tidy Control UI card execution helpers (openclaw#115195) perf(agents): amortize history-limit eviction with hysteresis (openclaw#115273) (openclaw#115281) fix: schema-version refusal blames a downgrade that never happened and cannot identify the stale install (openclaw#115232) fix: restore Fish completion after global CLI options (openclaw#115222) refactor(agents): collapse the client-tool catalog branch (openclaw#115212) fix(macos): signed rebuild no longer stalls on app shutdown (openclaw#103957) fix(agents): prevent repeated Code Mode output across waits (openclaw#115213) refactor(ui): split Profile (identity) from Usage (statistics) (openclaw#115245) fix(channels): report a channel that cannot receive as unhealthy instead of connected (openclaw#115229) fix(cli): reject malformed infer model refs (openclaw#115225) feat(ui): finish the Lobsterdex at 42 with wild variants, squish fix, and blink variance (openclaw#115264) test(migrations): avoid mtime precision in checkpoint fixture (openclaw#115269) test(signal): verify archive limits without malformed tar (openclaw#115270) refactor(sessions): isolate legacy transcript fixtures (openclaw#115231) fix(discord): clear pending launch watchdog (openclaw#115100) fix(agents): stop quadratic subagent prompt rendering (openclaw#115263) fix(memory-core): recover dreaming cron reconciliation (openclaw#115174) fix(qa-lab): filter incompatible channel scenarios (openclaw#115087) fix(android): respect locale in compact labels test(i18n): prove iOS discovery catalog ownership ...
Co-authored-by: IWhatsskill <[email protected]>
[AI-assisted]
What Problem This Solves
A successful Discord Activity pending-launch write normally completes well inside its 250 ms safety budget, but the losing watchdog timer remained armed until the full deadline. Bursts of otherwise healthy button clicks therefore retained unnecessary timer resources and their closures after the store work was already complete.
Failure mode
The store promise won the race, the Activity launched, and the unreachable timeout promise stayed scheduled for the rest of its budget because its handle existed only inside the promise constructor.
Why This Change Was Made
The interaction retains the per-invocation watchdog handle and clears it in a finally block as soon as the write-versus-timeout race settles. The same cleanup runs after a real timeout, while the caught store promise remains alive so a late write can still finish safely.
Root Cause
The watchdog handle was scoped inside the timeout promise, so the owner awaiting Promise.race had no way to dispose of the losing timer.
Runtime ownership
DiscordActivityButton.run owns the bounded wait and its per-invocation native timer. DiscordActivityStore continues to own pending-launch identity, ambiguity, consumption, retirement, and TTL semantics; the HTTP handler continues to own explicit, pending, and newest-widget resolution.
User Impact
Healthy Discord Activity launches release their no-longer-needed watchdog immediately. The 250 ms acknowledgement budget, launch ordering, single diagnostic on failure, invalid-widget response, late background write behavior, and pending-launch HTTP resolution remain unchanged.
Evidence
Validated at exact head
1d0ff09793f08fa7c897ac3b244c366db4f20aef: a non-mocked production-module runtime observed the native 250 ms watchdog destroyed after 0.62 ms without executing; 41/41 focused Discord Activity tests also passed.Inspect exact-head proof ledger
Provenance
89b6d85cdd862d3315927abcc604c9e128e673141d0ff09793f08fa7c897ac3b244c366db4f20aefmainDirect behavior
Redacted exact-head terminal output
Automated verification
Discord Activity runtime contract
node scripts/run-vitest.mjs extensions/discord/src/activities/interaction.test.ts extensions/discord/src/activities/http.test.ts --run --reporter=verbose— 2 test files and 41 tests passed with 0 failures and 0 skips. Proves the button and HTTP paths remain correct across fast success, timeout, late settlement, rejection, invalid widget data, pending-launch consumption, overlap, account isolation, and lookup failure. Preserves the 250 ms acknowledgement budget, launch ordering, newest-widget fallback, keyed store semantics, and HTTP authorization and channel validation.Focused static verification
git diff --check origin/main...HEAD— completed with exit code 0 and no output. Proves the current Base-to-HEAD patch has no whitespace errors. Preserves the exact reviewed two-file manifest.Preserved boundaries
Proof gap
A credentialed live Discord interaction was not run because the proof environment does not use live Discord credentials. The non-mocked production button and store modules ran with unmodified native Node timers, and async_hooks observed the watchdog lifecycle without replacing the timer APIs. No external Discord delivery or persistent backend performance claim is made.
Artifacts