Repository navigation
fix(chat): find the conversation of a Gajae Code or omp pane on a Windows PC - #264
Conversation
…dows PC Both lookups compared paths with a literal '/', and Gajae Code was looked for only among the processes herdr names, which on Windows is the pane's shell alone. Containment now goes through path.relative with the platform's own rules, so a Windows store is read and a path that leaves the store through '..' or a sibling name is refused everywhere. On Windows, Gajae Code is found among the pane shell's descendants (windows-processes.ts), and the screen-text match then picks the session. Closes #260
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughThe change adds platform-aware validation for OMP and GJC session paths. GJC transcript lookup can find a process beneath a Windows pane shell, match screen text, and retain a pane’s transcript while that process remains the same. ChangesWindows chat-lens transcript detection
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to The change supports Windows transcript paths and shell-based GJC detection without an established merge-blocking issue. Real-PC validation remains advisable, but its absence alone does not establish a regression. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Path validation becomes stricter, and no new external API is added. The remaining risk is bounded: cached process IDs can allow an earlier conversation to remain associated with a pane after its process changes. Exposure is limited by the existing pane lookup and user-local transcript store. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❓ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
Full details: Linked Issues checkExplanation The PR implements the requested ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
…ts answers are off screen On a Windows PC the text on screen is the only evidence of a pane's session, and a long list or tool output pushes every answer's tail off it: on a real PC the chat fell back for the whole of such an answer, and each poll started a PowerShell process-table query (about 0.8 s). The session the screen once showed is now kept per pane while the same gjc process runs under the pane's shell; the screen still wins when it shows another session, and a pane is never bound without it. The process table is read at most once in 5 s and shared by the polls in between.
Release v0.3.40: moves the Unreleased notes under 0.3.40 and bumps `package.json` and `herdr-plugin.toml`. What's in it: - Fixes from #249, #251, #252, #263, #264, #265, #267. - The iPhone CJK and text-symbol fix (#272). - Emoji cell widths matching herdr (#273). Every changelog entry already ends with its PR link. All these PRs are by @devswha, so no credits to add. No remote bundle change: `REMOTE_BUNDLE_VERSION` stays 9. The Windows PC part of #264 and #265 reaches a PC with the next remote bundle, as its changelog entry says.
Fixes #256. Raises `REMOTE_BUNDLE_VERSION` from 9 to 10, so that remote PCs (Windows PCs included) get the bridge-side fixes merged since `remote-v9`: #235, #243, #249, #251, #264, #265, #267, #278, #281 and the rest of `git log remote-v9..main -- server shared`. `server/machines.test.ts` named the `remote-v9` directory literally and failed on the new number; it now reads the constant. ## Order, from docs/remote-pcs.md 1. Merge this. 2. Push the `remote-v10` tag on `main`: the Remote PC bundles workflow builds, smoke-tests and publishes the five archives and `manifest.json`. 3. Only then release the app: an app that carries the new number finds no `remote-v10` manifest before step 2, and every connected PC's bridge counts as incompatible until it is updated. ## Checked `bun run typecheck`, `bun run test:unit` (734 pass). The bundle build and smoke run in this PR's Remote PC bundles checks.
…r /new or /resume (#285) Fixes #270. ## What was wrong On a Windows PC the chat finds a Gajae Code pane's session by an answer it can see on the screen, and keeps it for the pane while the same gjc process runs there (#264). Two cases kept the old conversation, both measured on a real PC (Windows 11, herdr 0.9.3, gjc 0.16.4) with a bundle built from `main`: - `/new`, then a one-word answer: the chat API kept answering the previous session's turns. A short answer never anchors, so nothing replaced the kept binding. - A later gjc in the pane that Windows gives the same process number would inherit the old session. A process query that timed out also read as "no gjc" and dropped a correct binding. ## What changes - gjc prints its own line when it switches session: `✔ New session started` after `/new`, `Resumed session` after `/resume`. A new such line on screen ends the kept binding; the chat then shows nothing until an answer of the new session binds it, rather than the wrong conversation. - A process is its number and its start time (`CreationDate` in the process table), so a reused number is another process. - A process table that could not be read leaves the binding as it was. ## Checked on the Windows PC (bundle from this branch, its own herdr session beside the default bridge) | Step | Chat API (`/api/pane/conversation`) | |---|---| | a long answer | the session (`gjc-transcript`) | | `/new` | `scrollback`, no turns (before: the previous session) | | a one-word answer | `scrollback`, no turns (before: the previous session) | | `/resume` back to the first session | that session again | The process table script was run on the PC and returns the start time for gjc. The bridge, its herdr session, the work folder and gjc's session files were removed afterwards. ## Tests `bun run typecheck`, `bun run test:unit`; `server/gjc-runtime.test.ts` and `server/shell-agent.test.ts` cover the switch line, a reused number, an unreadable table and the start time in the table. ## Not covered A new session whose answers are all short stays without a chat until one answer is long enough; that is the same rule as before this change, now without showing the wrong conversation meanwhile.
…nd when the Windows-only paths break (#293) ## Change Closes #271. Tests and CI only; nothing shipped changes. Three fixes were proven only by a one-off run on a real machine, and removing them kept every check green. Each now has a check that fails without it: | Fix | Check | Fails without the fix? | |---|---|---| | #265: the PTY sidecar's Node is looked up on the PATH the spawn inherits | `scripts/remote-bundle-smoke.ts` runs the bundle with every PATH entry that holds a `node` left out, and asserts `terminal_attach: true` | Yes: with a bare `Bun.which("node")` the smoke fails on that assertion (run locally) | | the same, end to end | the smoke now opens a live terminal: herdr's own attach on Linux and macOS (no `pane-geometry` with `fixed: true`), a mirror on Windows, and typing whose output comes back either way | - | | #265, over SSH | `scripts/ssh-integration.ts` asserts the remote terminal is attached, not mirrored (it accepted any `pty-data`, which a mirror also sends) | - | | #267, #269: a pasted block is shaped for an agent on a mirrored pane, on the `input` frame and from the input line | `server/submit.contract.test.ts`: `cat -v` on a mirrored pane shows `^[[200~…^[[201~` once herdr names an agent there, and bare lines before | Yes: with the `mirrorInput` call of the `input` path removed the test fails (run locally) | | #264: the Windows process table and the store-containment check with native paths | `server/windows-native.test.ts`, run on the Windows runner of the remote-bundle workflow: this PC's own process table (this process, its parent, its start time) and a session store on a real Windows file system | runs on Windows only; skipped elsewhere | The smoke sets `SHELL=/bin/sh` for the pane: a login shell with an empty HOME can stop to ask how to be set up (zsh did here). Not covered: a Node older than 18 first on PATH still counts as a usable sidecar (noted in the issue as related). ## Validation - Local: the smoke on Linux (attach, no Node on PATH), both mutations above, the contract test, `bun run typecheck`. - CI: this PR runs the remote-bundle workflow (Linux, macOS, Windows runners) and the integration job.
What was wrong
On a Windows PC added through Add PC, the chat lens showed no conversation for a Gajae Code pane or an omp pane and fell back to the screen text.
pane.process_infonamed it. On Windows herdr names only the pane's shell (fix(session): start Gajae Code from New session on a Windows PC #251), so the lookup gave up before the screen-text match. That match would have failed too: the store checks used${root}/and split on/, and Windows paths have backslashes.join(HOME, ".omp", "agent", "sessions") + "/", which a Windows path never does.What changed
storeRelative(root, file, paths)inserver/gjc-runtime.tsanswers "is this file inside this store" throughpath.relativewith the platform's own rules.gjcSessionFile,gjcDisplayCandidatesand the omp check use it.gjcTranscriptForPanelooks for the gjc process among the descendants of the pane'sshell_pid(gjcPidUnderShell, reusingserver/windows-processes.tsfrom fix(session): start Gajae Code from New session on a Windows PC #251). The screen-text match then picks the session.boundGjcTranscript): once the screen picked a session file, the pane answers with it while the same gjc process runs under its shell. The screen still wins when it shows another session; a different or missing gjc process drops the binding; a pane is never bound on cwd or recency.forgetTranscriptState()clears it.recentProcessTable): read at most once in 5 s, so a 2 s chat poll normally starts no PowerShell. A table that could not be read is not kept.ompSessionPathaccepts an absolute.jsonlpath inside the user's own store in the PC's native form...was accepted by the old prefix test (…/sessions/../../etc/x.jsonl) and is now refused. Sibling names (sessions-evil), another drive and a UNC share are refused.Real Windows PC (scenario S7)
Windows PC with herdr 0.9.3, gjc 0.16.4, PowerShell 5.1 as the pane shell; a separate herdr session, a bundle built from
origin/mainand one from this branch, the same live gjc pane,GET /api/pane/conversation(the route the chat lens polls).{"source":"scrollback","turns":[]}gjc-transcript, 2 turnsgjc-transcript, 4 turns, also while gjc was workinggjc-transcripton every poll (before the binding:scrollbackfor the 150 s watched)Facts the code depends on, observed there: the pane's
agentisgjc11 s after gjc starts and after each prompt (gjc reports itself to herdr on Windows too), and the pane cwd herdr reports equals the cwd in the session file's header byte for byte.Tests
gjcSessionFilereturnednullfor a Windows store path, the omp check refused a Windows path, and the old prefix test accepted a..escape. RED for the binding: the session was lost as soon as the screen match failed, and the table was read on every call.HERDR_TEST_MODE=unit bun test ./server/gjc-runtime.test.ts ./server/conversation.test.ts— 47 pass. Cases usepath.win32paths and a Windows-shaped process table; the binding cases cover kept while off screen, replaced by the screen, dropped on another pid, dropped when gjc is gone, cleared byforgetTranscriptState().bun test ./server/gjc.contract.test.ts— 5 pass (the real conversation route on Linux, unchanged behavior).bun run typecheck,bun run test:unit(688 pass),bun run build— green.Limits
/newor/resumeinside one gjc process the lens shows the old session until an answer of the new one is on screen./exit, so the route fell back before that code was reached.gjcTranscriptForPaneitself on Linux; the real-PC run above is its proof.The gjc sidebar mark already shows on Windows (it is the pane's
agent). codex's/procfallback is not part of this PR.Windows PCs get the fix only with the next remote bundle (#256).
Closes #260