Skip to content

feat(remote): Git lane graph on mobile, and queue rows that keep their attachments - #1597

Merged
huichen merged 8 commits into
mainfrom
pr/huichen
Nov 12, 2026
Merged

huichen merged 8 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

What this does

Brings the workspace's Git history into the mobile conversation: a new host read command returns the lane graph, and the phone draws it the way the TUI's /git panel does — one lane per column of work, one commit per row, merges opening a column, with the lanes painted as lines rather than spelled out in text. Making room for it meant folding the conversation bar's three trailing buttons into a single menu, which also brings that bar back to one row. Alongside it, a message held while a reply streams now carries the files it was sent with, in both clients.

Commits

  • feat(mobile): put the conversation's actions behind one menu, with a Git lane graph
  • fix(queue): show and keep the files a waiting message carries
  • docs(shot): give the mobile queue rows the files they really carry
  • feat(mobile): draw the Git lanes instead of writing them
  • fix(remote-host): report the Git graph root in the file system's spelling

Verification

Run in a detached worktree at the branch tip with the pinned toolchain (rustc 1.99.1) and ulimit -n 8192:

  • cargo fmt --all -- --check → clean
  • cargo clippy -p future-host -p future-remote-protocol --all-targets -- -D warnings → clean
  • cargo test -p future-remote-protocol → pass
  • cargo test -p future-host --lib → 2241 passed, 0 failed, 14 ignored (before the last two commits)
  • cargo test -p future-host --lib git_graph at the branch tip → 12 passed, 0 failed, including the Windows-path test that was red on the first CI attempt
  • desktop: npx tsc --noEmit clean, eslint src/features/agent src/features/remote-peer clean, vitest run 154 files / 2293 tests passed
  • mobile: tsc --noEmit clean at the branch tip (link-farm worktree); jest src/features/chat passes the new gitGraph, GitGraphPanel, ChatTopBar and ChatScreen suites, while useFileDownload and useSkillRecommendation fail identically at origin/main under Node 26 (ReferenceError: clearTimeout is not defined) — the local environment, not this branch. Mobile jest could not be re-run at the final tip because jest-expo is not present in this machine's installed node_modules.
  • scripts/screenshots/scenarios.json parses as JSON

User-visible changes

  • Mobile conversation bar: the files button and the token/amount breakdown moved into a sheet behind a single three-dot button; back, title and that button now share one row, and the new Git history entry lives in the same sheet. Before: three separate trailing buttons, title squeezed between them. Revert 885ce1b77.
  • Mobile Git graph panel: a new panel listing the workspace's commits with lanes and merge columns, read through a new host command. Lanes are drawn as lines in the list rather than written out per row, so a merge is visible at a glance. Requires an updated host — an older host answers the read with an unsupported-command error, so the panel shows empty until both sides are updated. Revert 885ce1b77 and 701de8a73.
  • Queued messages: a message waiting behind a streaming reply now shows one chip per attached file (desktop: local paths for this machine, host paths for a paired computer), and editing it re-sends those files with the corrected text. Before: an Attachments: N line, and an edit dropped the files. Revert 948c2253a.

Notes

The Git graph read is a host-side command addition (gitRef on get_git_commit, plus the graph listing), regenerated into both the TypeScript and Rust protocol sources; packages/remote-protocol/fixtures/protocol.json carries the new fixture.

The reported repository root is normalized to the file system's own spelling, so a Windows host no longer returns the extended-length \\?\C:\... form that the client could not match against its workspace paths.

…Git lane graph

The conversation bar spent two of its three trailing slots on things a reader
opens once a session — the session's files and its token/amount breakdown —
which left the title with whatever width was over. They are now rows in a
sheet behind a single three-dot button, on the same line as back.

With one menu there is room for what the bar had no way to offer at all: the
workspace's Git history. It is drawn the way the TUI's `/git` panel draws it —
a lane per column of work, a commit per row, merges opening a column and
branches closing back into the trunk — because a reader who has used the
terminal panel should recognise the picture, and because a flat changelog
cannot show where a line of work forked.

The graph is computed on the desktop (`host/src/remote_host/git_graph.rs`, a
port of `tui/src/workbench/git_panel.rs` so both surfaces draw one picture) and
sent as the gutter string, two characters per lane. The phone colours it:
`graphSpans` splits a row into coloured runs, giving a commit and its vertical
the lane's colour and a horizontal the commit's own — the TUI's two rules, so
one branch keeps one colour from its tip to the junction and one connection
does not read as a new branch at every elbow it crosses. Each row also carries
a two-point lane stripe at its left edge, which is what makes a page of commits
scannable while scrolling without reading any glyph.

Whether there is a history at all is answered by the same read that lists it
(`isRepo`), not by a probe command of its own, and it is asked every time the
menu opens: a workspace that is a plain directory never shows the row, and one
where the reader has just run `git init` grows it on the next look. A desktop
that does not advertise `git_graph_v1` is never asked.

The commit detail is `git show --stat --patch` with `--no-color`, coloured by
line role here — git's own ANSI would ride along in the text the reader selects
and copies. The commit key is validated as hex before git ever runs, so `HEAD`,
`--all` and paths cannot reach the command line.

Verified against the real UI: `.screenshots/m-chat-menu.png` (three rows),
`m-chat-menu-plain.png` (two, with no Git row), `m-chat-git-graph.png` (three
lane colours in the gutter) and `m-chat-git-commit.png` (the patch, additions
in green).
A message sent while a reply streams is held by the session, and the queue
already reports the files it was sent with. Neither client read them.

Desktop: rows carry their files (local paths on this machine; host paths on a
paired computer), the panel draws one chip per file instead of an
"Attachments: N" line, and an edit re-sends the files with the corrected
words instead of quietly dropping the pictures. A host path cannot be opened
here, so the remote composer fetches the file into the preview cache and mints
a fresh upload before it cancels the row — a failed fetch leaves the row
untouched rather than taking it and sending the words alone.

Mobile: dropping the last file of a text-less row used to cancel the row and
re-send an empty prompt, which the sender refuses, so the whole message
vanished with nothing said. Refused now, and pointed at the bin. An empty edit
says so instead of closing the editor over an unchanged row.
The send queue's attachment chips could not be captured at all: the fixture
handed the panel rows with text and nothing else, so every screenshot of the
panel showed the pre-attachment state.

`?queueFiles=1` gives the first two rows the files a real send reports — an
attachment-only photo first (the row that carried a picture with no words,
which used to draw no controls), then a message whose text and photo and
document travel together.

Two scenarios capture the result in both schemes, and assert what the picture
is supposed to show rather than trusting it: three chips named with their
sizes, the attachment-only row drawing a chip and a bin but no editor (an
empty save would be a removal), the mixed row drawing both controls, and every
chip being the element the pointer actually lands on.
@huichen
huichen enabled auto-merge (squash) November 12, 2026 15:28
The history's lanes arrived as the TUI's box-drawing grid and were painted as
characters, one glyph per cell. At phone size that reads as a column of broken
marks rather than as lines: the strokes were thin, they stopped and restarted at
every cell boundary, and a vertical never joined the row above it.

Decode the grid into geometry and draw it. `gitGraph.ts` now returns, per row,
the vertical threads (with the row edges they reach), the horizontal connections
as whole lane-to-lane runs, and the commit — in lane units, so the tests assert
the picture without knowing any sizes. `laneDrawing` turns that into pixels:
verticals run the row's full height so consecutive rows meet exactly, a turn is
one quadratic curve that consumes as much of the vertical as it bends through,
and a crossing opens a gap rather than drawing a junction the host never meant.

Two colour rules come from the TUI's `paint_graph` and are what make the picture
readable rather than merely coloured: a thread wears its own lane's colour, and a
connection wears the *commit's* colour, so one connection stays one colour as it
crosses lanes. A merge draws a ring and a plain commit a disc.

Two rendering bugs the tests caught: turns were declared as one value while the
decoder produced two (`up`/`down`), so every corner silently came out square; and
a commit alone in its lane emitted a zero-length thread, which a round cap paints
as a second dot on top of the real one.

Also drop the header from both pages, list and patch. They are one continuous
surface, and a bar over them cost a row of a phone screen to repeat what the page
already was. What is left is the way out, top-left: back to the list from a
patch, out from the list. Refresh moved to pull-down, and the commit's author and
date moved into the patch page's body, where the header used to say them.

The screenshot scenarios now assert strokes rather than monospace runs: 117
strokes in 8 lane colours with 6 curves, no box-drawing glyph on screen, and
content starting 108px from the top with no header above it.
…ling

`git rev-parse --show-toplevel` prints the path in Git's own spelling — forward
slashes on Windows — while `fs::canonicalize` reports the extended-length form
(`\\?\C:\...`). The listing's `path` went out in the first form while the test
expected the second, so the Windows job failed on the same directory twice:

    left:  "C:/Users/runneradmin/AppData/Local/Temp/.tmpqHGVZL"
    right: "\\\\?\\C:\\Users\\runneradmin\\AppData\\Local\\Temp\\.tmpqHGVZL"

The fix is in the production path, not in the assertion. A client renders this
string verbatim (as it does the session file listing's paths), so it is
normalised once at that boundary by `reported_root`: the directory's canonical
form with the Windows verbatim prefix removed, i.e. the same pair the stored
workspace paths and `remote_host::session_files` already use. `git` itself keeps
running in Git's own spelling, so a Windows path past MAX_PATH keeps the
extended-length form it needs; only the reply is rewritten, so a client is never
handed `\\?\C:\...`, and a repository reached through a symlinked spelling now
reports the one directory it is.

The test only observes that: it still proves the reply names the repository root
rather than the nested workspace it was asked about, and now also states the rule
the reply has to hold — the reported root never carries the extended-length
prefix. Both assertions are exercised off Windows, where a Windows-spelled path
can still arrive from a paired desktop.
@huichen
huichen merged commit ac08f53 into main Nov 12, 2026
59 of 62 checks passed
@huichen
huichen deleted the pr/huichen branch November 12, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant