Skip to content

fix(web): keep a start form's files in it while the session starts - #231

Merged
kalaspuff merged 2 commits into
mainfrom
fctl/176-when-starting-an-agent-from-the-composer
Oct 23, 2026
Merged

kalaspuff merged 2 commits into
mainfrom
fctl/176-when-starting-an-agent-from-the-composer

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Attaching a file to a task and pressing Start took the file out of the form as soon as its upload was done. It vanished while the form said "Starting", until the session page opened, although the session got it all along. Now the form keeps showing its files until the session page replaces it.

What changed

  • A start form keeps its files while it starts (Home and a project's Sessions tab). useAttachments' take gets a stay option: the start hands the files to the new session, and the form goes on showing them. The session composer still empties as it sends, since its message shows the files in the transcript at once. The form frees the files' previews when it goes away; before, the start freed them as soon as the session existed.
  • While it starts, the files can't be removed and the paperclip is disabled. Pastes and drops were already ignored then, and the pickers disabled, since files removed or added at that point don't change what the session gets. DraftTray takes readOnly and AttachButton takes disabled. IconButton now looks disabled when it is, like Select (none was disabled before).
  • If the start fails, the files are the form's again, with their remove buttons, and Start sends them again without uploading them again. On Home, uploads of kept files are dropped once a session starts with them, as before.

A bug this found on the way

take removed the files it took by object identity. A file sent while it was still uploading gets a new object when its upload finishes, so take missed it: the file stayed in the composer and, because its upload had been handed over, uploaded again. In the session composer, a file sent with a message mid-upload stayed behind, ready to go out with the next message (two uploads of one file, in the browser). take now goes by the files' keys, and puts them back as uploaded if sending fails.

Screenshots

At 608f8ce (with main merged in, so the forms have #229's Schedule button), with an image attached (a drawing made for this) and the request that starts the session held in the browser, so that the form stays on "Starting".

Home, dark theme, 1440 px wide:

Before After
Before: Home's form while it starts, without the image, and shorter After: Home's form while it starts, with the image

A project's Sessions tab, light theme, 1440 px wide:

Before After
Before: the project's form while it starts, without the image After: the project's form while it starts, with the image

A phone, 390 px wide, dark theme. Touch screens always show a file's remove button; while the form starts, the file now stays without it:

At rest Starting, before Starting, after
At rest: the image with its remove button Before: while starting, without the image After: while starting, the image without its remove button

At rest, the forms look as they did on main (pixel for pixel, apart from the moving scene behind Home's header).

How I verified it

  • Unit tests. attachments.test.tsx covers:

    • files that stay as a session starts, also when it starts mid-upload (one upload);
    • files that can be sent again after a failed start;
    • kept uploads and previews let go once a session starts;
    • a message's files that leave the composer when sent mid-upload, upload once and come back uploaded;
    • the read-only tray.

    start.test.tsx checks that a start asks for stay and frees no previews. The five new attachment tests fail with main's attachments.tsx. cargo xtask check web passes.

  • In the browser, with cargo xtask dev and Playwright, holding requests to slow them down:

    • Home and the project page: while the form starts, the image stays, without its remove button, and the paperclip is disabled. The session opens with the image in its first message, after one upload.
    • A start that fails (503): the toast shows and the image is back with its remove button. Start again opens the session without a second upload. Back on Home, the draft is gone.
    • Start pressed mid-upload: one upload (main: two).
    • The session composer, a message sent mid-upload: the composer empties once the upload is done, after one upload, and the message shows the image. On main, the file stayed in the composer and uploaded again.

Merging main

#229 merged while this was open, and changed the lines around <AttachButton …> in web/src/routes/home.tsx and web/src/routes/project.tsx. 608f8ce merges main in, keeping #229's lines and adding disabled={starting} to the paperclip. I ran the browser checks above again on the merged code, with the same results.

Session: https://app.fctl.sh/s/ses_01M5MFKE7Q1K3E7855Q7CS1R9V

Starting a session took the attached files out of the form as soon as
their uploads were done, so they vanished until the session page opened.
The form now shows them until it goes away, without the buttons that
remove them, and stops taking files from the paperclip as it does from
pastes and drops. If the start fails, they are the form's again.

Taking files that were still uploading compared them by identity, which
missed those whose upload finished meanwhile: they stayed in the
composer and uploaded again. They now go by their keys.
@fctl-sh
fctl-sh Bot requested a review from kalaspuff as a code owner October 23, 2026 13:52
…g-an-agent-from-the-composer

# Conflicts:
#	web/src/routes/home.tsx
#	web/src/routes/project.tsx
@kalaspuff
kalaspuff merged commit 785fd43 into main Oct 23, 2026
11 checks passed
@kalaspuff
kalaspuff deleted the fctl/176-when-starting-an-agent-from-the-composer branch October 23, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant