Skip to content

fix(chat): resolve GJC conversations using foreground cwd - #333

Merged
devswha merged 4 commits into
devswha:mainfrom
Kinetic27:fix/gjc-foreground-cwd
Oct 2, 2026
Merged

devswha merged 4 commits into
devswha:mainfrom
Kinetic27:fix/gjc-foreground-cwd

Conversation

@Kinetic27

Copy link
Copy Markdown
Contributor

Why

A GJC process can run in a different directory from its pane's shell (for example, the pane stays in the home directory while GJC runs in /tmp). The conversation resolver passes only pane.cwd to GJC's session lookup, which rejects the actual transcript because its cwd does not match. Chat then falls back to “Conversation unavailable — show terminal output”, even though the session file is readable.

Change

  • Resolve GJC transcripts using a non-empty pane.foreground_cwd; use the pane cwd when foreground cwd is unavailable.
  • Keep the existing process, descriptor and terminal-breadcrumb ownership checks intact. Do not guess from the newest session in a directory.
  • Add a real-herdr regression with a GJC stand-in that changes its process cwd while its pane stays in the original directory. A second transcript in the pane cwd must not be selected.
  • The shared resolver also covers conversation images and tool output. No API, UI, localization or configuration changes are needed.

Validation

  • The new regression fails before the fix with ConversationUnavailable: no_session_path and passes after it.
  • bun test --timeout 15000 server/gjc.contract.test.ts server/gjc-runtime.test.ts server/conversation.test.ts: 59 passed, 0 failed.
  • bun run typecheck, bun run build and git diff --check: passed. The build retains the existing large-chunk warning.
  • bun run test:unit: 1,033 passed, 2 skipped, 1 failed. The voice SSE test expects audio.webm but receives clip.webm; the same failure was reproduced in the unmodified original checkout.
  • Verified all six running GJC panes through the copied resolver, including both previously failing cwd-mismatch panes. Verified both affected panes through the preview HTTP conversation endpoint, returning gjc-transcript with actual turns.
  • The user confirmed the fix works in the browser on a separate preview server; the production server was not replaced.

Notes

The full integration suite was not run; focused real-herdr GJC tests and live HTTP checks cover the changed path. This PR does not change the remote bundle version.

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (1)
CONTRIBUTING.md — configured

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: e09d7537-6469-4f83-b354-c7f23957be1b

📥 Commits

Reviewing files that changed from the base of the PR and between 2c837b4 and ab536a1.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • server/gjc.contract.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Transcript resolution now uses the active process’s foreground working directory when available, preventing it from selecting a transcript associated with a different session.

Walkthrough

GJC transcript resolution uses the pane’s nonempty foreground cwd, or falls back to its cwd. A contract test checks transcript selection when those directories differ.

Changes

GJC transcript cwd resolution

Layer / File(s) Summary
Foreground cwd resolution and contract test
server/conversation.ts, server/gjc.contract.test.ts, CHANGELOG.md
Transcript resolution uses the foreground cwd when it is nonempty, otherwise the pane cwd. The contract test checks that lookup selects the foreground transcript and returns its answer. The changelog records this behavior.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: devswha

Merge Risk: ⚪ Minimal · up to ab536

No actionable merge-blocking risk was identified in the reviewed changes.

Architecture Summary

Architecture risk: 🔵 Low · up to ab536

The change affects 2 systems.

Changed systems: server, CHANGELOG.md

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — server (service) was modified; 2 changed files map to changed impact.
  • observed — CHANGELOG.md (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in server/conversation.ts: gjc transcript resolution now passes the nonempty foreground_cwd as the session cwd, falling back to cwd; previously it always passed cwd.
  • observed — Modified behavior in CHANGELOG.md: Adds an Unreleased Fixed entry documenting GJC conversation resolution using the foreground process directory when it differs from the pane directory, and links PR #333.
  • observed — Modified behavior in server/gjc.contract.test.ts: The test adds imports for session snapshots, the Herdr socket path, and pane conversation lookup.
  • observed — Modified behavior in server/gjc.contract.test.ts: The stand-in now changes to GJC_TEST_CWD when set. The pane helper accepts a cwd argument (defaulting to the test home) and passes it to the stand-in; previously it always ran from the pane’s inherited cwd.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: resolving GJC conversations using the foreground working directory.
Description check ✅ Passed The description includes the required Change and Validation sections. It explains the problem, resulting behavior, regression coverage, validation results, known unrelated test failure, and omitted fu…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Comment @coderabbitai help to get the list of available commands.

@devswha devswha left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed foreground cwd selection and conversation binding, including the Linux contract case. Related unit tests pass. Added the changelog and corrected the existing contract assertion so the fixture path in a shell prompt does not look like typed gjc input; an actual gjc command is still detected. Fast checks, Integration and browser, Native Windows install, all remote bundles and SSH pass on the current main integration.

@devswha
devswha merged commit ad9692b into devswha:main Oct 2, 2026
12 checks passed
devswha added a commit that referenced this pull request Oct 3, 2026
Bumps package.json and herdr-plugin.toml to 0.3.44, moves the Unreleased
notes under [0.3.44] - 2026-10-03, adds the compare link, and removes a
merge marker line left in CHANGELOG.md by #351's conflict resolution.
### Added
- Native Windows x64 installation through `install.ps1`, with the same
herdr plugin startup
and updates. Windows needs Bun and Git, without Node or WSL, and keeps
using the terminal
screen mirror. ([#330](#330)
by @JJLiebig)
- Settings can choose Chat, Terminal, or Auto as the default view for
panes. Changing it resets
remembered pane views on this device. Shell panes still open in
Terminal.
([#325](#325) by
@Haeminway1)
- Choose the terminal input line or direct typing on desktop as well as
touch screens, and
customize or unbind the app's Mod+Shift shortcuts with conflict checks
and reset.
  ([#334](#334))

### Changed
- In the sidebar's By workspace view, a workspace with one pane keeps
its numbered header and
can be folded, renamed and reordered from that header, just like a
workspace with several panes.
  ([#332](#332) by @beomq)
- The top usage panel shows larger percentages, remaining-capacity
colors and compact reset
countdowns with their local time. Expired reset times stay hidden until
fresh usage arrives.
([#336](#336) by
@Haeminway1)
- Pane titles that contain a directory show its last folder, and
matching workspace and folder
names appear once in the sidebar and command palette, including Windows
paths.
([#337](#337) by
@Haeminway1)
- In the sidebar's By workspace view, a pane row no longer repeats the
workspace its header names.
Its second line shows the folder only when neither the title nor the
workspace already says it.
  ([#358](#358))

### Fixed
- GJC conversations are resolved from the foreground process directory
when it differs from
the pane directory.
([#333](#333) by @Kinetic27)
- Direct terminal input preserves rapid IME commits when punctuation
arrives before composition
timers run, with a bounded xterm 5.5 backport and Korean final-consonant
regression checks.
Native Android/Gboard checks also fixed stale editor text after
Backspace breaking the next
Hangul word. Secret entry now refuses a held or unready attachment and
failed PTY writes.
  ([#334](#334))
- New session in the browser demo opens the new session instead of
leaving a blank page.
  ([#355](#355))
- Terminal input keeps multi-character IME commits and emoji while
disconnected, waits for the
attachment before sending keys, and reports input failures. Unsent input
lines survive pane,
lens and mode changes; late acknowledgements preserve replacement edits.
Composition keeps
its Enter and Send button, and terminal key-bar taps wait until it
finishes.
  ([#334](#334))
- The background tasks list stays below the app header on a short
screen, such as a phone held
  sideways, and scrolls inside the room above the message box.
  ([#354](#354))
- The mobile message box sits closer to the home indicator while
retaining its base spacing.
([#335](#335) by
@Haeminway1)
- Adding or reconnecting a remote PC says when herdr is not running or
not answering there,
  instead of only `Bridge verification failed (500)`.
  ([#353](#353))
- Shift+Enter in the live terminal sends the same newline chord as
Alt+Enter, instead of plain
Enter that submits an agent's message. Pending IME text is sent before
the newline chord.
([#339](#339) by
@WOULDU-pres)
- On Windows, and from an install path with a space or a non-ASCII
character, the app page loads
instead of the "not built yet" notice. The Windows installer replaces a
copy from a release
  without Windows support, and says so when a release cannot run there.
  ([#356](#356))
- On an iPhone home screen app, a text field that keeps its focus with
the keyboard down no
  longer leaves a status-bar band under the message box.
([#349](#349) by
@Haeminway1)
- After `/new` in an OmO pane, the chat stops showing the conversation
before it: OmO writes the
new session's file only with its first message, and until then the chat
shows what a fresh OmO
shows. ([#351](#351) by
@WOULDU-pres)
- On a Windows PC, an omo pane shows omo's mark instead of Claude's, and
its chat finds the
conversation: process words with `bun.exe`, backslashes and a drive
letter read as omo, and the
  session folder is named as omo's engine names a Windows folder.
([#342](#342) by
@Haeminway1)
- The chat lens finds an omo pane's conversation when its process keeps
its sessions outside
`~/.omo/agent` (`OMO_CODING_AGENT_DIR`, `SENPI_CODING_AGENT_DIR` or
`PI_CODING_AGENT_DIR`).
([#350](#350) by
@Haeminway1) passes. After the merge: .
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.

2 participants