Skip to content

feat(debug): ClaudePasteDetection dev module for #90 prompt-submit timing - #278

Merged
Juliusolsson05 merged 3 commits into
mainfrom
feat/claude-paste-detection-devmodule
Jun 14, 2026
Merged

Juliusolsson05 merged 3 commits into
mainfrom
feat/claude-paste-detection-devmodule

Conversation

@Juliusolsson05

Copy link
Copy Markdown
Owner

What

A ClaudePasteDetection dev-debug module on the existing #101 Dev Debug Panel framework, built to diagnose #90 (Claude prompt submit unreliable — detection falls behind under load). Pure instrumentation — no changes to the submit path itself.

Two panes:

  1. Live detection — runs the actual submit-detection rules (/\[Pasted text #\d+/ placeholder + the spinner-activity regex) against the live runtime.screen / runtime.screenMarkdown each render, with the current streamPhase. Watch detection fire in real time.
  2. Submit timeline — reads back the per-paste journals already written to <userData>/paste-debug/<pasteId>.paste.jsonl and reconstructs each submit's lifecycle: issued→detected latency, detected→CR, outcome (submitted/stuck/error), composer length, strategy — plus p50/p95 latency + failure count. This is Claude prompt submit still inconsistent — detection logic falls behind under load #90's "see the actual latency distribution" ask, surfaced from data we already capture but never read.

How

  • readRecentPasteSessions() in pasteDebugJournal.ts + a dev-debug:read-paste-events IPC give the renderer-only module its main-process data (the journals were write-only at runtime).
  • A pure timeline.ts reducer (PasteDebugSession → SubmitLifecycle + stats) holds all the digest logic — no React/IPC, keyed on the real event vocabulary (keydown:enter, placeholder:appeared|timeout, write:submit-cr, submit:returned|throw).
  • The "stuck" signal is placeholder:timeout (the 10ms poller giving up) — exactly the failure mode Claude prompt submit still inconsistent — detection logic falls behind under load #90 chases.

Safety / scope

  • Gated by AGENT_CODE_DEV_DEBUG; the 1s poll only runs while the module is mounted (enabled), so zero cost when off.
  • Adds zero new typecheck errors (baseline 4 pre-existing remain).
  • No new persistent test files (repo convention); verified via typecheck + manual acceptance.

Test plan

  1. Run with AGENT_CODE_DEV_DEBUG=1; command palette → "Dev Debug Panel" → enable "Claude Paste / Submit Detection".
  2. Paste + submit into a Claude pane → live regex panes toggle as [Pasted text #N] appears; timeline gains a row with issued→det latency + submitted.
  3. Force a stuck submit under load → row shows stuck (red); failure count + p95 reflect it.

Refs #90, #101.

🤖 Generated with Claude Code

Juliusolsson05 and others added 3 commits June 14, 2026 16:54
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds readRecentPasteSessions() + dev-debug:read-paste-events so the
ClaudePasteDetection module can pull the per-paste journals already written
to disk. Read side of a previously write-only journal. (#90)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…timeline

Dev-debug module (#101 framework) for #90: live submit-detection regexes
against the screen + issued->detected latency timeline (p50/p95, stuck count)
reconstructed from the paste journals. Instrumentation only; no submit-path
changes. Gated by AGENT_CODE_DEV_DEBUG.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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