Repository navigation
fix(web): stopped or expired questions return their attached files to the composer - #38005
Merged
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No review items were assigned this round; this pass watched PR #38005. Macroscope's high finding (apps/web/src/questionAttachments.ts:191) was right: the web composer draft store serializes images only from persistedAttachments, which only a mounted ChatComposer refreshes. Images moved into the thread draft while its composer was unmounted (the question resolves from another device or while another thread is shown) were therefore lost on reload once the question draft was cleared. Commit 9b53245 copies the persistedAttachments records of the images that moved from the question drafts into the thread draft with syncPersistedAttachments before the question drafts are cleared, skipping ids the thread draft already persists. The existing cancelled/expired test now adds a persisted image; it fails without the change (persistedAttachments []) and passes with it. Macroscope then approved at 9b53245. CodeRabbit's single line comment (mobile test should assert the recovered draft rather than the mocked append call) is rated Trivial and was left as is. All 8 required checks passed on 9b53245 with nothing failing or pending; the watch has been removed.
Fixes #36581
Reproduction on main
Commit: origin/main cd9c39f. Main's only Replay question ('question', acp_elicitation) is enum-only and its composer is not editable, so I temporarily added the free-text Replay recording from the closed PR #36582 (text_question_transcript.ndjson plus a 'text-question' entry in dev-replay-agent.ts, not committed). Then I ran a scratch e2e scenario against the real server and web client: create a project, start a thread on model text-question (it waits on the free-text question 'What should this replay know before it continues?'), open the thread, type 'Use my notes' in the composer, attach notes.txt through the file input (the chip appears above the answer), click 'Stop generation'. Result: the timeline shows 'Run interrupted · Stopped by user', the question closes, and the thread composer contains 'Use my notes' but no notes.txt chip. The scenario's final assertion getByText('notes.txt') failed with match count 0. Captures: before https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/68b2276540fd546c/issue-36581-before-stop.png, after https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/a6873ca84a4377de/issue-36581-after-stop.png. Unit level: I added a notes.txt file to the existing cancelled/expired case in apps/web/src/questionAttachments.test.ts; both statuses fail on main with expected files [notes.txt], received [], while the text and thread-context assertions pass.
Evidence
In the real web client (Chromium, 1280×800, light theme), create a fresh project and free-text Replay question, type Use my notes, attach notes.txt, then click Stop generation. Both runs used identical synthetic data and the same temporary Replay fixture.
Proven: base loses the attachment while retaining the text; head preserves both.
scenarios:proveexited 0.Scenario source · Temporary Replay fixture setup · Runner proof
Not shown:
Tests
apps/web:
vp test run src/questionAttachments.test.tspassed 6/6 with the change; with the source change stashed the 2 cancelled/expired cases fail on persistedAttachments.vp run check:changedpassed format, lint, knip, typecheck (3 packages), tests (2 files) and react compiler. On the PR, all 8 required checks passed on 9b53245.Not in this change
Who did the work
Run by the t3code factory in T3 Code.