Skip to content

feat(debugger): dismiss-logbox tool + redbox-safe LogBox suppression#204

Draft
pFornagiel wants to merge 1 commit into
mainfrom
@pFornagiel/logbox-dismiss-tool
Draft

feat(debugger): dismiss-logbox tool + redbox-safe LogBox suppression#204
pFornagiel wants to merge 1 commit into
mainfrom
@pFornagiel/logbox-dismiss-tool

Conversation

@pFornagiel

Copy link
Copy Markdown
Contributor

Summary

ARG-187 — hide the React Native LogBox banner reliably across the whole RN session without ever dismissing an open fullscreen redbox.

  • Layer 1 — fix a latent bug in DISABLE_LOGBOX_SCRIPT: removed the LBData.clear() call, which routes through setSelectedLog(-1) and would dismiss an open fullscreen redbox. The banner is gated by _isDisabled alone, so clearing the data store was never necessary.
  • Layer 2 — new dismiss-logbox MCP tool. Resolves the existing JsRuntimeDebugger:port:device_id service (auto-connects if needed) and re-evaluates the disable script. alwaysLoad: true so the agent can call it before any other debugger tool. Mirrors debugger-evaluate's URN/services shape.
  • Layer 3 — re-inject the disable script on every new JS execution context. Added executionContextCreated to the typed CDPClientEvents map and emitted it in handleMessage. The blueprint subscribes with a debounced two-stage re-eval (1500 ms + 3500 ms) so cmd-R / shake reload / fast-refresh full reload / DevSettings.reload / Page.reload all recover the disabled state without the agent needing to re-call.
  • Layer 4 — skill prompts updated so the agent learns about the tool atomically with its existence: argent-device-interact, argent-react-native-app-workflow (new §1.4 + quick-ref row), and argent-metro-debugger (tool-table row + prereqs paragraph).

The fullscreen redbox shown for fatal/uncaught errors is preserved end-to-end.

Note for reviewers

.claude/rules/argent.md is gitignored in this repo. The plan's <tapping_rule> LogBox callout edit lives only in my local working tree and is not in this PR. Apply it manually to your local .claude/rules/argent.md or skip it — the three shipping skill files cover the same guidance.

Test plan

Automated (pnpm --filter @argent/tool-server test):

  • 11 new tests pass; full suite still green (72 files / 653 tests).
  • disable-logbox-script.test.ts — asserts the script calls ignoreAllLogs(true), never .clear(), and remains an IIFE.
  • dismiss-logbox.test.ts — id, alwaysLoad, default port 8081, required device_id, URN resolution.
  • cdp-execution-context-event.test.ts — typed executionContextCreated event fires + generic event still fires (no regression).
  • tsc --noEmit clean.

Manual verification (Bluesky / iPhone 17 Pro / iOS 26.2 / Metro :8082):

  • V0 premiseDevSettings.reload wipes a globalThis marker and flips LBData.isDisabled() from truefalse. Confirms the JS-context-reset condition Layer 3's listener recovers from.
  • Layer 1 fix — fixed disable script (no .clear()) leaves an open fullscreen redbox visible; explicit LBData.clear() dismisses it (proves the bug existed and the fix addresses it).
  • Banner suppressionaddLog({level:'error',…}) produces the bottom banner with an enabled LogBox; fixed disable script hides it; subsequent addLog while disabled produces no banner.

Not directly observed via MCP (would require Node-side CDP subscription / MCP server rebuild):

  • Runtime.executionContextCreated actually firing in this RN runtime — covered by the unit test against a mock WS loop, premise verified via state-reset proxy, ship-as-designed per the plan's "if it doesn't fire on this RN version, Layer 3 is a no-op but does no harm."
  • dismiss-logbox end-to-end through the MCP transport — the underlying cdp.evaluate(DISABLE_LOGBOX_SCRIPT) path was exercised directly via debugger-evaluate.

🤖 Generated with Claude Code

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant