Skip to content

fix(app): native sends clear stale drafts; working and needs-input beat the draft pencil - #290

Closed
albrand wants to merge 4 commits into
oursfrom
fix/stale-draft-pencil
Closed

albrand wants to merge 4 commits into
oursfrom
fix/stale-draft-pencil

Conversation

@albrand

@albrand albrand commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Human comments

What was wrong

On native agent threads, the sidebar showed a draft pencil instead of the Working or Needs input glyph. The owner reported working threads "not showing the icon that displays they are in progress and working too, also not displaying when the thread needs questions answered".

There were two causes:

  • (a) Stale draft. The pencil comes from a localStorage composer draft (usePromptDraftStorage). Only submitting through the regular composer, or clearing it, removed that draft. A native thread's input goes through the native prompt bar or the terminal, so sends there, and converting a thread to a native terminal, left the old draft in place.
  • (b) Precedence. ThreadStatusGlyph let a saved draft win over active work and pending interaction, so even a correct draft hid Working and Needs input.

What changed

  • (a) NativeTerminalPromptBar.tsx: a native send snapshots the thread's stored composer draft at submit and, on success, clears it only if it still matches (clearIfCurrentMatches in usePromptDraftStorage.ts). A newer draft written meanwhile, for example in another tab, survives; a failed send clears nothing. native-terminal-mode-action.ts: converting a thread to a native terminal clears it too.
  • (b) ThreadStatusGlyph.tsx: Working and Needs input take precedence over the draft pencil. The pencil shows only for an idle thread with a draft. The thread-list plugin's activity model uses the same order.
  • No server, wire, protocol or storage-format changes.

How you verified

  • Full @bb/app suite: 7,071 passed, 20 skipped. App typecheck passed. The client-core and thread-list plugin checks passed. git diff --check clean.
  • Six mutants run on a detached clean worktree at 4411d6d, each applied alone and reverted. All 6 went RED:
    1. no draft clear on native send;
    2. no draft clear on native conversion;
    3. working-draft drawn as a pencil;
    4. Working only when there is no draft;
    5. Needs input only when there is no draft;
    6. draft clear() as a no-op.
  • Round 2 at cc1efac (ours db52b8c merged in with merge commit 1130e97, no conflicts): new tests in NativeTerminalPromptBar.test.tsx for delayed success with a replacement draft and a storage event, failed-send retention, and other-thread/other-project preservation. The replacement test is RED with an unconditional clear (mutant on a detached clean worktree) and GREEN with the guarded clear. Focused app tests 27/27, app typecheck exit 0, exact-head CI run 40029205559 success.
  • Interactive walk: NOT RUN yet. Browser input on a dev stack needs bb's certified isolated browser, so the phone and desktop walk (base vs head) runs on a Mac dev stack. It is queued after fix: keep native activity evidence across holder reattach #277 and TERM-REPAINT. This PR stays draft until that walk passes.

No issue: albrand/bb has GitHub issues disabled.

AGENT GENERATED

@albrand

albrand commented Oct 26, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #299, which carries this change rebased onto ours at da8be25 and is now merged as bfed6f4. #299's diff is byte-identical to this PR's. The branch is kept.

@albrand albrand closed this Oct 26, 2026
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