Repository navigation
fix(web): stop Home's composer taking presses in its project list - #152
Merged
Merged
Conversation
Since #146, the project select in Home's composer sits in the TextareaControls row, which focuses the textarea on a press between its controls. Its list opens in the top layer, but in the DOM it is still in that row, so a press on an option counted as a press between the controls: the textarea took focus, the select's trigger lost it and the list closed before the click could pick the option. TextareaControls now leaves presses in a popover alone, as it does those on links, buttons, inputs and labels.
kalaspuff
approved these changes
Oct 20, 2026
This was referenced Oct 20, 2026
Closed
kalaspuff
pushed a commit
that referenced
this pull request
Oct 20, 2026
…ase (#157) Session pages missed pull requests opened from other branches, and showed the wrong changes once `main` moved. Three causes in fctl-agent's git state (#155), all fixed here, with the decisions from the issue. ## What was wrong 1. **Pull requests were looked up only for the checked-out branch** (`gh pr view <branch>`). The session behind #151 also opened #152, from a branch in a worktree, and its page never listed it. 2. **Changes were a diff against the moving tip of `origin/<base>`.** After a squash merge the diff was empty ("No changes yet." over "+0 −0 · 1 commit"). Once someone else's commits reached `main`, they showed among the session's changes, reversed. 3. **A merged branch was pushed again after a resume.** `git fetch --prune` removed the branch GitHub had deleted, `pushed` turned false, and the next turn's push brought the branch back on GitHub. ## What changed - **fctl-agent follows every pull request of its session** (`crates/fctl-agent/src/followed.rs`). It follows the pull requests of the branches it looks up, those whose URL `gh pr create` printed (`Refresh` reads the tool's result), and those the session lists when a sandbox starts (a new `SessionSpec.pull_requests`). Only repositories the session may use count. The list lives in the agent's `state.json`, so it survives restarts. fctl-agent looks each pull request up by URL when a turn ends, until it is merged, and reports them all in a new `GitState.pull_requests`. `fctl_domain::pulls::found` reads that list, so the control plane lists every pull request with its current state. - **Changes are what the branch changed since it left its base:** the diff from `git merge-base origin/<base> HEAD`, for both `--numstat` and `--name-status`. Uncommitted and untracked work counts as it is now, and the empty tree stays the fallback when there is no base, or no merge base. `GitState::files`'s doc now says so. Once the branch's pull request is merged, the diff starts from the base as it was just before the merge (the pull request's `baseRefOid`), so a merge commit, which puts the branch's commits on `main`, still shows the merged work. - **A branch whose pull request merged isn't pushed again.** If GitHub deleted the branch after it was pushed (its upstream is `[gone]`), or its pull request was open at the last lookup, fctl-agent looks the pull request up when a turn ends, before it pushes. If the pull request is merged, the commits stay in the sandbox and the transcript says `Didn't push <branch>: its pull request #N is merged`, once per new head. A new `unmerged` count holds the commits after the merged head. - **Changes say a merged branch is merged:** "#151 merged" in place of "not pushed yet", with "1 commit since, not pushed" when the agent committed again (`whereCommits` in `web/src/lib/git.ts`). - **The system prompt** now says fctl pushes the branch "until its pull request is merged", and tells agents to make another pull request's branch where the repository is checked out (`git switch -c`), not in a worktree or another clone. - Docs: `docs/architecture.md` (Repositories), `docs/cli.md`, `docs/getting-started.md`, and [ADR 0030](docs/adr/0030-sessions-follow-every-pull-request-their-agent-opens.md), which amends ADR 0027: a pull request that isn't merged is looked up each turn, wherever it came from. ## The decisions in the issue - *Worktrees and clones outside the checkout* ("use your recommended approach"): fctl lists their pull requests, from `gh pr create`'s output, and the system prompt asks agents to keep their branches in the checkout, where Changes follows them. Changes doesn't scan worktrees: their branches are neither shown nor pushed by fctl, and telling agents where to work is the simpler fix. - *New commits on a merged, deleted branch* ("It should likely be shown if possible"): I read this as "leave them unpushed and say so". fctl doesn't push them. The transcript says why, and Changes shows them as "N commits since, not pushed". If you meant pushing them to bring the branch back, that is a small change in `Run::publish`. - *Changes once merged* ("shown as merged … with the merged work"): Changes lists the merged work and says "#N merged". What fctl still can't see: a pull request opened without `gh pr create` printing its URL into the transcript (output sent elsewhere, or `gh api`) is found only while its branch is checked out, as before. ## Compatibility Every new field is optional. The control plane takes `GitState.pull_requests` and `unmerged` before agents send them; older agents leave them out and report as before. Older hosts drop `SessionSpec.pull_requests`, and then the agent follows only what it finds. `gh` versions without `headRefOid`/`baseRefOid` get asked again with the fields fctl-agent asked for before, so pull requests are still found, just without the merged-work diff base and the `unmerged` count. Old sessions in the web app read as before. There is no migration. Agents reach sandboxes with hosts' releases. ## Screenshots At 41b72fc, from `cargo xtask dev`; merging `main` (#156) changed nothing they show. Dev projects have no GitHub repository, so their sessions never get pull requests. For these screenshots, Playwright replaced the session's git state and pull requests in the browser with what each version of fctl-agent reports in the issue's case: #151 squash-merged and its branch deleted, the session resumed, and #152 opened from a worktree. The page itself is the real app: `main` on the left, this branch on the right. The session's sidebar, light theme: | Before | After | |---|---| |  |  | After, once the agent committed again on the merged branch (left), and in the dark theme (right): | Commits after the merge | Dark | |---|---| |  |  | The whole page, 1440 px wide: the header lists both pull requests, and the transcript's line counts the merged files. | Before | After | |---|---| |  |  | On a phone (390 px), the details sheet, where the line after "#151 merged" wraps:  ## How I verified it - The issue's reproductions are now tests in `crates/fctl-agent/src/workspace.rs`, with a stand-in `gh` that answers from the pull requests each test gives it. They assert the fixed behavior: after the squash merge and a resume, `files` lists `a.txt` and the branch shows merged; the next turn's end doesn't push, and the branch stays deleted on the fake GitHub; a new commit stays unpushed, the transcript says why once, and `unmerged` is 1; after `main` moved on, only `a.txt`, plus uncommitted and untracked work; the worktree's pull request is found, and its state follows when it merges, then lookups stop. More tests cover a branch the agent pushed without an upstream, a merge-commit merge, and an older `gh`. With main's diff and push code put back, three of them fail. - Unit tests: `fctl_domain::pulls` (reading URLs from `gh pr create` output, `found` with the list), `refresh.rs` (URLs from `gh pr create` results only), `followed.rs` (repositories the session may use, a branch's open or latest pull request, older `gh` output, what is due when), the supervisor (a printed URL is reported and survives a restart), the prompt, and `whereCommits` in the web app. - `cargo xtask check --quick` passes. - `cargo xtask dev --smoke` passes, and so does the same session through `cargo xtask serve` (the control plane on workerd), since `spec.rs` changed. Fixes #155 Session: https://app.fctl.sh/s/ses_01M5DGT18535H8SAX2DYXH3PQV --------- Co-authored-by: fctl-sh[bot] <343971779+fctl-sh[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
On Home, pressing a project in the composer's project list didn't pick it. The list closed, the task field took focus, and the project stayed the same. app.fctl.sh has had this bug since #146 was deployed. No release has it yet.
What was wrong
#146 moved the composer's controls into a row of their own,
TextareaControls. A press between the controls focuses the textarea, as a press in its margins does, but presses on links, buttons, inputs and labels are left alone. Home's projectSelectis in that row. Its list opens in the top layer, over the page, but in the DOM it is still inside the row. So a press on an option counted as a press between the controls. The textarea took focus, theSelect's trigger lost it, and theSelectclosed its list on that blur. Once the list starts closing it stops taking the pointer, so the click that followed missed the option.What changed
TextareaControlsalso leaves presses in a popover alone. ASelect's list is a popover.Verification
form.test.tsxputs aSelectinTextareaControls, opens it, then presses and clicks an option. Before the change, the press moved focus to the textarea. Now the trigger keeps focus and the click picks the option.cargo xtask devand two projects, Playwright (Chromium) pressed the project that wasn't selected. It used a mouse, taps at a Pixel 7's size, and taps at an iPhone 15's size, the last with Safari's focus rule added as in fix(web): close a dropdown when you tap it again on iPhone and iPad #151. WebKit on Linux refuses the dev stack's__Host-cookie over http, so these runs used Chromium. Onmain, the picker stayed on Playground and focus moved to the task field in all three. With this change, it picks Notes, closes the list and keeps focus on the picker.cargo xtask check --quickpasses.There are no screenshots: nothing looks different.
Session: https://app.fctl.sh/s/ses_01M5DCMP24RSTE8CGHSVH4A4A9