Repository navigation
fix(app)/test(evals): attachment upload in a new task moves into the thread while the upload is held (post-chain) - #4894
Conversation
…s mid-send Since #4838 an explicit send awaits the uncapped snapshot read (ensureFullSnapshot) so it can decide against complete history whether to interrupt delegated work. That read is owned by the surface's useQuery observer. Development builds run every mount effect twice (StrictMode simulates an unmount), so the hero's one-step Run task, which fires from a mount effect, always saw its reader drop and re-subscribe while the read was in flight; TanStack cancelled the read (CancelledError, revert) and the send treated it as a failure: the pending row vanished, the draft and attachments came back as ready chips, a CancelledError card appeared, and no upload started. When the reader is still present after the cancellation, read again instead of failing the send. Once nobody observes the thread anymore the cancellation stands, so history actions abandoned by navigation behave as before. Signed-off-by: Guillaume Loret <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Warden review summary — ClearNative findings: 0. Blocking policy matches before consolidation: 0. Full finding text remains in Warden's native checks and review threads. This comment retains only native IDs, severity, skill attribution, and safe locations. Analysis run Reported trigger coverage (not proof of complete repository or context coverage): diff-security-review (22419 ms), confidentiality-review (6761 ms), desktop-den-sync-review (21517 ms). Blockers
Advisories
Needs recheck
Observed review-thread metrics
Thread states are read-only collection snapshots. These metrics are neither lifetime totals nor exact resolution times, and this summary is not clearance authority. |
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (96a0a3af2815cc688b1067fd24939eed27284731). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
Pick up #4888 so ci-tests.yml's packaged Fast module step finds its test file. Signed-off-by: Guillaume Loret <[email protected]>
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (be8468322d41589acf749dda7cf9350763602682). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
|
Passed · 12/12 tests · 18/18 assertions · 8 images Commit |
Re-check of #4811: on current
dev,attachment-upload-loading-statetest 2 ("sending an image in new task immediately moves it into the thread while upload is pending") failed deterministically withTimed out waiting for one decoded thread preview and cleared composer while upload is held after 30000ms(runs 34563247847 @71d22ac10, 34611588521 @e53e2f7f7). Test 1 (existing chat) passed.Culprit: #4838
4462762b4— perf(chat): prioritize visible thread history and preserve scroll#4811's proof ran at
2d1209665=e4c5c3e3d+ #4797's stack, and its merge (c9d09b320) is an empty diff; so ~70devcommits betweene4c5c3e3dandc9d09b320were never covered by that proof. Bisect withdaytona-e2e.yml(suite=full,only=attachment-upload-loading-state) on throwaway branches (deleted afterwards):07ff1c55be4e316d414462762b4^user.reload()withSession snapshot owner changed…(the #4797 reload race, fixed later ondev)4462762b49e49a882f51a769f97b45546d05d44344ce279b1384c9c9d09b32071d22ac10The other app commits in
(07ff1c55b, 4462762b4)(#4837, #4829, #4782, #4836) do not touch the send/history path in a way that produces this state; #4861 and #4757 (the briefed suspects) postdate the first red and change nothing here. The suspected harness change #4810 only extendslocate()miss diagnostics.Root cause
Instrumented run on
devhead (throwaway branch, state dumped by the spec at the timeout):#4838 made
sendDraftawait openingHistory.ensureFullSnapshot()(the uncapped read, viaensureQueryData) before submitting, so a follow-up decides against complete history whether to interrupt delegated work. That read is owned by the surface'suseQueryobserver. The hero's one-step Run task creates the session and the surface auto-sends from a mount effect as soon as the opening preview lands. Development builds (what the evals and developers run;index.react.tsxwraps the app inStrictMode) run every mount effect twice — StrictMode simulates an unmount — so the send started the read in the first pass, the simulated unmount removed the only observer, TanStack cancelled the consumed-signal read (Query.removeObserver→retryer.cancel({ revert: true })), andensureQueryDatarejected withCancelledError.handleSendtreats that as a failed send: the pending row is removed, the draft and attachments are restored as "ready" chips, aCancelledErrorerror card shows, and no upload POST ever starts. The auto-send mark was already consumed, so the second effect pass sends nothing.The existing-chat test is immune because its snapshot is already cached (
ensureQueryDataresolves from cache). Not the #4797 owner-flipcancelQueries(that would berevert: undefined).What changed
apps/app/src/react-app/domains/session/surface/session-history.tsx—ensureFullSnapshot: whenensureQueryDatarejects with a TanStackCancelledErrorand the snapshot query still has an observer (the reader only re-subscribed), read again withfetchQuery. Once nobody observes the thread anymore (navigated away) the cancellation stands, so history actions abandoned by navigation behave exactly as before (history actions cannot run against a destination owner or after unmountstill passes). #4838's intent — sends see complete history — is kept; the spec's timing claim is unchanged.apps/app/tests/session-history.test.tsx— new testa send started from a mount effect survives StrictMode dropping and re-adding the reader mid-read: renders the realuseOpeningSessionHistoryunderStrictMode, startsensureFullSnapshot()from a mount effect, asserts the first uncapped read is aborted and that the send still resolves with complete history. Red without the fix (CancelledError revert: true, no re-issued read), green with it.Follow-up worth considering (not in this PR): the hero path
onCreateTaskWithPromptdoes notseedCreatedSessionSnapshotlikehandleCreateTaskInWorkspacedoes since #4757, so its first send always waits one uncapped round trip.Proof
Placement: Daytona, sandbox
source verified 96a0a3af2815cc688b1067fd24939eed27284731(--strict-ref,refMismatch:false).OPENWORK_EVAL_REF=96a0a3af2… pnpm evals:e2e attachment-upload-loading-state --daytona --strict-ref×2 sequential:"passed":2,"failed":0,"skipped":0,"verdict":"passed"(existing chat 246.9 s, new task 252.3 s)"passed":2,"failed":0,"skipped":0,"verdict":"passed"(existing chat 249.4 s, new task 258.4 s)pnpm --filter @openwork/app typecheck→ exit 0.bun test tests/session-history.test.tsx→ 23 pass / 0 fail (22 ondev+ the new one). Red→green verified by reverting only the product file:0 pass / 1 fail(Received length: 0— no re-issued read).bun test --isolate tests/→ the only reds are pre-existing on pristineorigin/dev@667b450fdwith identical output:session-snapshot-owner-flip.test.tsx(readEndpointshas an extra/opencode2),generated mention instructions > app preserves its label…,v2 provider catalog retains display names…. All other files pass on this branch when run as files.pnpm evals:e2e session-full-history-on-open --daytona --strict-ref: fails at spec line 100 (user.click({ role: "button", label: "Branch in new chat" })→Located element was visible=false) identically on this branch (96a0a3af2) and on pristineorigin/dev@667b450fd— a pre-existing red in the hover-only Branch step; the part that carries perf(chat): prioritize visible thread history and preserve scroll #4838's intent (latest-first opening, complete history loaded, lines 65–91) passes on both before that step.Verdict for this spec: Passed (2/2, twice). Bisect branches
bisect/aul-*deleted; all Daytona sandboxes from these runs were removed by the runner.