Skip to content

fix(web): an Inbox reply says when it can't be saved on this device - #1163

Open
Jacksondr5 wants to merge 2 commits into
j5/mainfrom
j5code/inbox-draft-save-status
Open

Jacksondr5 wants to merge 2 commits into
j5/mainfrom
j5code/inbox-draft-save-status

Conversation

@Jacksondr5

@Jacksondr5 Jacksondr5 commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Problem

When localStorage is full (a few large screenshots will do it), an Inbox reply fails to save and says nothing. An image uploads and can be sent, but it's gone after a reload while the words come back. The words can fail to save too. Closes #1141.

What changed

Both states show in AnswerAttachmentList, which the Inbox page and the Adjudication Dock both render under the reply box, so each surface gets them.

  • Images. Upstream's composer already checks each image save against localStorage and lists the ones that didn't land in the draft's nonPersistedImageIds. The Inbox reply's image saves go through the same check, but nothing displayed the result. An image in that list now gets the composer's own warning badge and tooltip, with the same wording and look as ComposerAttachmentStrip: "Draft attachment could not be saved locally and may be lost on navigation."
  • Words. The words store (j5:inbox-answer-texts:v1) now passes upstream's createDeferredStorage a thin wrapper around localStorage. That wrapper catches the write that runs after the 300 ms debounce, so the signal is the failed write itself. That covers the flush on unload too, needs no read-back, and leaves upstream's createDeferredStorage unedited.
    • A failed write marks only the asks whose words differ from what storage last held. An ask saved before storage filled up isn't marked, because a reload would bring it back.
    • The reply shows "This reply isn't saved on this device. Send it or copy it before reloading."
    • The next successful write clears the note.
    • Upstream's composer has no wording for an unsaved prompt to match, so the note uses plain words.

All the changes are in J5 files (inboxAnswerDrafts.ts and AnswerAttachments.tsx).

Left out: drafts for a removed connection staying in storage, which is a separate cleanup.

Surfaces: the Inbox page and the Adjudication Dock, on web and desktop. Mobile isn't affected: it keeps its reply in its own store (#1139).

UI changes

Same fixture, viewport and theme on both sides. Storage was filled in the test page only. "Before" is j5/main, and "after" is 6b74b99. The later commit, 42ce6c3, only adds role="status" to the note.

Reply text with localStorage full. Before: nothing says the reply isn't saved. After: a note under the reply box.

Inbox reply box with full storage and no warning, before
Inbox reply box with full storage and the note "This reply isn't saved on this device. Send it or copy it before reloading.", after

Image attached with localStorage full. Before: a plain thumbnail. After: upstream's composer warning badge on the thumbnail, with the tooltip "Draft attachment could not be saved locally and may be lost on navigation."

Inbox reply image thumbnail with full storage and no badge, before
Inbox reply image thumbnail with full storage and the warning badge at its top left, after

Live testing

Verdict: pass. An independent GPT-6.2 Sol tester ran it as a Peer Agent in its own worktree, on isolated servers from setup-agent-live-test.ts, with real Claude Haiku 5.5 asks. Storage was filled and cleared in the test page only.

  1. Ask A's saved text stayed unmarked, and ask B's unsaved text showed the note, on the head only. After a reload, A's words came back and B's were gone, on both builds: the loss the note warns about.
  2. With storage full, B's image showed the badge, on the head only. It's inset 2 px from the thumbnail's top left, and the tooltip shows on hover.
  3. After freeing storage and typing one character, the note cleared and the draft was in localStorage.
  4. Adjudication Dock: a live Haiku Captain's ask in a one-seat Crew showed the note and the badge together.

Not exercised: desktop (Electron). It renders the same web component and storage.

Checklist

  • One concern: the description has no "also"
  • Tests cover the changed behavior (backend changes ship with focused tests)
  • UI changes: before/after screenshots above (no motion)
  • Live testing: the section above says what ran live and what did not
  • Upstream-owned files: each one is recorded in FORK.md (case text and file-table row) in this PR (none edited)
  • Upstream product: any change to what upstream's product does has a human decision linked above and a register entry in docs/j5/product/upstream.md (no change to upstream's product)
  • Surfaces: entry points, clients, providers, contracts, reverse states, connection modes (see AGENTS.md)
  • Docs: definitions under docs/j5/product/ and user docs rewritten where this changes them (no doc describes this)

Implemented by Claude Opus 5.5 in Claude Code (J5 Code).

🤖 Generated with Claude Code

When localStorage is full, an Inbox reply's images and words failed to save
silently: an image could be sent but was gone after a reload, and the words
could be lost too.

The answer's image tiles now show the composer's "may not persist" warning for
images in the draft's nonPersistedImageIds. The words store wraps its storage
so a failed write marks the asks whose words differ from what storage holds,
and the reply shows a short note until a later save succeeds.

Closes #1141

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
j5-code Ready Ready Preview Nov 22, 2026 6:36pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 4 billable files and costs up to $1.00.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 20 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 52 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 5439ac2 and 42ce6c3.

Files selected for processing: 4

  • apps/web/src/j5/a2a/AnswerAttachments.browser.test.tsx
  • apps/web/src/j5/a2a/AnswerAttachments.tsx
  • apps/web/src/j5/a2a/inboxAnswerDrafts.test.ts
  • apps/web/src/j5/a2a/inboxAnswerDrafts.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 effective changed lines (test files excluded in mixed PRs). labels Nov 22, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jacksondr5

Copy link
Copy Markdown
Owner Author

Review round 1, Claude Opus 5.5 and GPT-6.2 Sol. Opus approves; Sol requested changes on findings it rated medium.

  • Taken (Opus 1): the "isn't saved" note is now role="status", so screen readers announce it.
  • Declined (Sol 1, Opus 2: two tabs can hide a loss): each tab writes the whole map and the last writer wins. That's the behaviour fix(web): unsent Inbox replies survive leaving the page #1140 accepted, the same as upstream's composer drafts, and this PR doesn't change it.
  • Declined (Sol 2: a reply cleared in the same 300 ms window as a failed write can come back after a reload): it needs full storage, a clear and a growth inside one debounce window. The worst case is old text reappearing in a box the person emptied. Near-impossible and harmless.
  • Declined (Sol 3: the image badge's tooltip can't be reached by keyboard): the badge copies upstream's composer badge exactly (ComposerAttachmentStrip.tsx:242-258), screen-reader label included, so it follows upstream.
  • Declined (Sol 4: the words test hits a missing import on j5/main): Opus and Sol both ran the behaviour against j5/main's code. The quota error escapes the flush and the reply isn't saved, so the test guards the real regression.
  • No change (Opus 3, 4): a stale savedTexts after removeItem only happens in tests, and the extra parse is negligible.

This branch was successfully deployed

1 active deployment
Preview — 42ce6c34 Deployed Nov 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 effective changed lines (test files excluded in mixed PRs). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inbox reply: say when an attached image won't survive a reload

1 participant