Skip to content

feat(web): default chat file links to one folder and mark home or root - #275

Merged
orbitingflea merged 1 commit into
mainfrom
feat/file-link-path-depth
Nov 24, 2026
Merged

orbitingflea merged 1 commit into
mainfrom
feat/file-link-path-depth

Conversation

@orbitingflea

@orbitingflea orbitingflea commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Behaviour change

Behaviour change: yes, web users see one folder on chat file links by default, and prefixes stop at ~/, /, or a drive root.

Why

The goal is to show one folder on chat file links by default and stop at ~/ or /. Before, the default was 1 and stopped at the project top.

What changed

  • Set File link folders default to 2. Saved values stay, and missing or invalid values read as 2.
  • Walk absolute and ./ paths in full, drop ., fold .., and take up to depth - 1 folders. Stop early at ~/, /, or a drive root without using a slot. Relative links without ./ show only folders they name.
  • Add optional homeDirectory to ServerConfig and read it per environment in a single-string atom.

Scope

  • Upstream edits add 1 line to apps/server/src/ws.ts, 2 to packages/contracts/src/server.ts for the optional field and doc comment, and change 1 fork hook line in apps/web/src/components/ChatMarkdown.tsx for the environment.
  • Other code sits in fork-only apps/web/src/fork/ and packages/contracts/src/fork/, plus one README.md line.

Tradeoffs

Lexical .. folding is display-only after a symbolic link. Saved 1 values stay because they cannot be told apart from a chosen 1.

Blast Radius

Only web chat file links and an optional ServerConfig field change. Old and new builds mix safely, and a revert undoes it.

Verification

Unit, contract, and browser tests pass. vp run check:changed passes. Desktop and phone-size screenshots were checked.

Full rule cases, tradeoffs, and verification
  • Settings and path walk. File link folders under Settings and Appearance accepts 1 to 5 path parts. Depth 1 still shows only the file name with no marker. Client settings save as one object, so a browser that saved any setting keeps its saved 1, and its reset button restores 2. Absolute and ./ links walk past the project top, so an absolute link to top-level README.md shows proj/README.md at depth 2, or ~/proj/README.md in home. Project-relative links like [readme](README.md) or docs/a.md can open a search match elsewhere, so they show only folders they name, with no ~/ or / above. Written README.md shows no folder, and docs/review-pipeline/glossary.md shows at most docs/review-pipeline/. /home/me/code/proj/docs/guide.md shows docs/guide.md. Server home draws ~/, as in ~/notes.md and ~/plans/todo.md. Unexpanded ~/... links resolve against homeDirectory, so with /srv/me, ~/../notes.md shows /srv/notes.md; with no home, they draw ~/. Root draws /, as in /README.md and /etc/hosts. A Windows drive root draws the drive, such as C:/. On any Windows server, even with no reported home, a Git Bash path like /c/Users/alex/notes.md reads as C:/Users/alex/notes.md, matching the server file reader, so it can draw ~/ or C:/. A home at / or a drive root draws that root, not ~/.
  • Fallback and exceptions. An older server without homeDirectory draws plain folders except for unexpanded ~/... links. The single-string atom keeps other server config updates from re-rendering chat messages. Repeated file names in one message, links to the home folder itself (~/), links ending in . or .., and POSIX names with \ get no prefix. Repeats match by file name, so a root copy like /notes.md next to /etc/notes.md also gets no prefix. Repeated names keep their trailing folder hint, and UNC paths keep server and share without a root marker. Prefixes stay CSS-drawn, so find in thread and copied text keep the label unchanged, and the chip's accessible name includes the folders.
  • Tradeoffs detail. Lexical .. folding can differ from disk after a symbolic link. Open and copy still use the link's path, so display alone differs. Saved 1 values stay because saved settings cannot tell a default 1 from a chosen 1. Home detection reads homeDirectory from the server instead of guessing from the thread folder, which misses homes outside /home/<user> or /Users/<user> and threads outside home.
  • Verification list. Unit tests pass for home, root, drive root, Windows home case, other users' homes, unknown home, unexpanded ~, workspace files, .., UNC paths, collisions, . and .. links, and a home at /. Contract tests pass for the default and saved values. A browser test passes for default prefixes review-pipeline/ and /etc/, depth 1 with no prefix, server-reported home ~/notes/, find in thread, triple-click, and accessible names. vp run check:changed passes, desktop and phone-size screenshots were checked, and the "Folders on file links" line in README.md is updated, noting that a browser that already saved its settings keeps its saved value and the reset button gives the new default.

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:L labels Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ The exact PR base did not have a successful artifact. Baseline uses the latest successful main measurement shown below.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 21.5 KiB 21.5 KiB 0 B (0.0%) 24.4 KiB ✅
Codex Live turn messages 1 1 0 (0.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.9 KiB 21.9 KiB 0 B (0.0%) 24.4 KiB ✅
Claude Live turn messages 1 1 0 (0.0%) 8 ✅

Other scenarios

All 64 scenario measurements match main.

All 64 scenario measurements
Provider Scenario Metric Main baseline This PR Impact PR ceiling
Codex short turn resume WebSocket decoded 10.5 KiB 10.5 KiB 0 B (0.0%) 12.7 KiB ✅
Codex short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn running, cold open HTTP decoded 281.7 KiB 281.7 KiB 0 B (0.0%) 302.7 KiB ✅
Codex long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Codex long turn running, history page HTTP decoded 92.4 KiB 92.4 KiB 0 B (0.0%) 107.4 KiB ✅
Codex long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Codex long turn finished, cold open HTTP decoded 381.5 KiB 381.5 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, socket cold open WebSocket decoded 381.6 KiB 381.6 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, work page HTTP decoded 186.2 KiB 186.2 KiB 0 B (0.0%) 200.2 KiB ✅
Codex long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Codex idle thread resume WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell snapshot HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Codex fleet shell subscribe WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Codex fleet shell resume check rows 0 0 0 0 ✅
Codex stale shell reload HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex stale shell reload rows 27 27 0 (0.0%) 27 ✅
Codex stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Codex stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex stale todo list cold open HTTP decoded 72.4 KiB 72.4 KiB 0 B (0.0%) 83.0 KiB ✅
Codex stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Codex stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅
Claude short turn resume WebSocket decoded 10.6 KiB 10.6 KiB 0 B (0.0%) 12.7 KiB ✅
Claude short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn running, cold open HTTP decoded 283.3 KiB 283.3 KiB 0 B (0.0%) 302.7 KiB ✅
Claude long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Claude long turn running, history page HTTP decoded 93.4 KiB 93.4 KiB 0 B (0.0%) 107.4 KiB ✅
Claude long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Claude long turn finished, cold open HTTP decoded 384.2 KiB 384.2 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, socket cold open WebSocket decoded 384.3 KiB 384.3 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, work page HTTP decoded 188.1 KiB 188.1 KiB 0 B (0.0%) 200.2 KiB ✅
Claude long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Claude idle thread resume WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell snapshot HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Claude fleet shell subscribe WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Claude fleet shell resume check rows 0 0 0 0 ✅
Claude stale shell reload HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude stale shell reload rows 27 27 0 (0.0%) 27 ✅
Claude stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Claude stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude stale todo list cold open HTTP decoded 73.4 KiB 73.4 KiB 0 B (0.0%) 83.0 KiB ✅
Claude stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Claude stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅

Baseline: b1551ba · PR result: a70e746 · Source CI: failure

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@orbitingflea
orbitingflea force-pushed the feat/file-link-path-depth branch from 34bd648 to 716ddc0 Compare November 24, 2026 08:55
File link folders now default to 2 (one folder + file name). The walk
goes up the full folded path and stops early at the thread machine's
home (`~/`), at POSIX root (`/`) or at a Windows drive root (`C:/`),
showing fewer folders than the setting there. The server reports its
home in a new optional ServerConfig.homeDirectory; the web client reads
it per environment through an atom holding only that string. Workspace
files no longer stop at the workspace root, but a link written relative
to the workspace (which may open a search match) shows only the folders
it names. Unexpanded `~/` links are read against the reported home, and
on a Windows server Git Bash `/c/...` paths are read as `C:/...`. Links
ending in `.`, `..` or a bare `~`, and any copy of a repeated file name,
get no prefix; a home at `/` or a drive root draws the root marker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant