Skip to content

feat(viewer): show the session id and project name on each viewer - #422

Merged
ElbertePlinio merged 7 commits into
mainfrom
feat/367-viewer-session-label
Oct 28, 2026
Merged

ElbertePlinio merged 7 commits into
mainfrom
feat/367-viewer-session-label

Conversation

@ElbertePlinio

Copy link
Copy Markdown
Member

With two sessions open, every viewer had the same generic title and its thumbnail sat in the same corner, so the user could not tell which window showed which agent.

Each viewer now shows its session id and project folder name, such as desk-1a2b3c · my-app. Sessions have no name of their own, so the project folder is the name. The window title is <label> · Pickforge viewer. The thumbnail draws the same label in a small pill at the top-left, above the attention banner when an agent asks for help. A long folder name ends with an ellipsis, so the id stays visible. Characters the viewer's embedded font cannot draw, such as CJK, become an ellipsis on the thumbnail; the title keeps the full name. The label is hidden in expanded and control modes, where the title is enough.

The host builds the label and strips control, format and bidi characters from the folder name. The native viewer gets it through a new optional --label argument and strips the same characters. The browser fallback viewer gets it in the URL fragment after the capability token, keeps it in sessionStorage with the token, and sets it as text only; the bridge, its token checks and the Content Security Policy are unchanged. The browser page title is now "Pickforge viewer", like the native one.

The README now says how watch picks a session without --session, how to choose one with --session <id>, and that a project can have one live browser session at a time.

Reviewed with sol-loop: 2 rounds with GPT-6.1 Sol (high). Sol verdict: approved.

Final review by Fable 5.1 (high), 2 rounds: approved. Round 1 found the attention banner covering the label, also found by Sol, and the font gap; both are fixed. Declined nits: a source check against innerHTML in the page test stays as a cheap guard for an untrusted folder name; a double ellipsis when a cut lands right after a replaced run, and a hidden banner on thumbnails under about 100 px tall (only with a non-default --thumbnail-width; the help request also expands the viewer).

Closes #367

Requirement Verified by Scenario and edge cases Result Evidence
Session id and name in the window title Rust and TS unit tests, QA Native and browser viewers; no label; hidden characters; 67-character and CJK folder names desk-… · alpha · Pickforge viewer; full CJK name in the title ~/.pickforge/investigations/367/titles.txt, titles-review.txt, browser-title.txt
Session id and name on the thumbnail Unit tests, QA screenshots Two thumbnails; long name; CJK name; attention banner while collapsed; browser fallback Label legible, cut with an ellipsis, id intact, above the banner 01-two-thumbnails.png, 02-long-name-thumbnail.png, 06-browser-thumbnail.png, 07-request-expands-a-cjk-name-on-b.png, 08-collapsed-a-label-above-banner.png
Two viewers expand, collapse and close on their own Live two-viewer test, QA Expand A, collapse A, close A with its Close button B's mode, window and process unchanged; both sessions still running native-viewer-live.test.ts; 03, 04, 05, geometry.txt, after-close.txt
Docs: one browser session per project, choosing the session for watch Review against target.ts and devtools-mcp.ts No --session with one, two or no sessions; --session from another project README matches the code README.md watch and session sections
Label cannot inject markup or hidden text Unit and security tests Control, format, bidi and separator characters; &, # in the fragment; text set with textContent Stripped or encoded; 165 security tests pass viewer-launch.test.ts, args.rs tests, test/security
Release note Pending docs/releases/UNRELEASED.md still holds the tagged 0.7.1 notes Tracked in #416 this PR

Release note for the next version: "Each viewer shows its session id and project folder name in the window title and on the thumbnail, so two open viewers are easy to tell apart. (#367)"

QA ran on private Xvfb host displays with WAYLAND_DISPLAY unset; the scripts and logs are in ~/.pickforge/investigations/367/.

Follow-ups: #421 draws banner and label text in scripts the embedded font lacks. #420 is a Chrome profile test flake seen in the full suite.

Checks: cargo fmt, clippy with -D warnings and cargo test -p pickforge-viewer (117 tests); bun run build, typecheck, lint; 18 viewer, browser session and security suites (336 tests) after the rebase on main; bun run test:coverage with the CI environment variables before the review fixes, with one unrelated failure (#420); PickCheck (no new or worsened functions).

The native viewer takes a --label with the session id and the project
folder name. It shows the label in the window title and as a pill on the
thumbnail, cut with an ellipsis when it is too wide. The browser fallback
gets the same title and thumbnail label from the URL fragment.

A live test runs two native viewers for two sessions and checks that
expanding, collapsing and closing one leaves the other unchanged.

Closes #367
@ElbertePlinio
ElbertePlinio merged commit e2b8e8e into main Oct 28, 2026
10 checks passed
@ElbertePlinio
ElbertePlinio deleted the feat/367-viewer-session-label branch October 28, 2026 22:58
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.

viewer: show which session each viewer is watching

1 participant