Skip to content

fix(modules): watch getSessionsDir() so XDG sessions reach the sidebar - #303

Closed
kahme247 wants to merge 1 commit into
mainfrom
bug-hunt/modules-round2
Closed

kahme247 wants to merge 1 commit into
mainfrom
bug-hunt/modules-round2

Conversation

@kahme247

Copy link
Copy Markdown
Collaborator

Round-2 bug-hunt finding (Area 2, Modules and chats), verified by reproduction in a fresh clone at 0.6.0 (7d0ce59).

Bug (MEDIUM)

The session-file watcher derived its directory from getAgentDir() (~/.omp/agent/sessions), while every other session consumer uses getSessionsDir(), which honors the XDG layout (/omp/sessions when the omp config init-xdg opt-in exists). Under XDG the watcher watched a directory the lister never reads, so sessions started or changed outside omp-web (terminal omp, the TUI, a second instance) never pushed sessions-changed to the sidebar; when the legacy directory did not exist, the watcher retried the same wrong path every 5 s forever.

Reproduction: with a fake HOME + XDG pair, getSessionsDir() → XDG sessions dir while the old watcher path → legacy dir (mismatch); appending a line to the real XDG session file produced zero notifications, while the default-layout control produced one.

Fix

lib/session-watcher.ts now uses getSessionsDir() — a one-line change that also fixes the retry loop, since the watched directory then exists. Regression guard in new lib/session-watcher.test.mjs.

Verification

  • New test: 1 pass. tsc --noEmit clean, eslint clean on changed files. next build not run per house rules.

Not covered by open PRs #295–#300 (round-1 modules PR #297 covers project re-add, worktree collision, cwd-less sessions, dead last-session code — not the watcher path). No GitHub issue closed, so no Fixes trailer.

The session-file watcher derived its directory from getAgentDir()
(~/.omp/agent/sessions), while every other session consumer uses
getSessionsDir(), which honors the XDG layout
($XDG_DATA_HOME/omp/sessions when the opt-in exists). Under XDG the
watcher therefore watched a directory the lister never reads: external
session changes (terminal omp, TUI, second instance) never produced a
sessions-changed notification, and when the legacy directory did not
exist the watcher retried the same wrong path every 5s forever.

Verified by reproduction: with a fake HOME/XDG pair, getSessionsDir()
pointed at the XDG sessions dir while the old watcher path did not,
an appended XDG session line produced zero notifications, and the
default-layout control produced one. One-line fix plus a regression
guard.
@coderabbitai

coderabbitai Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 57 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5c9e12e6-e32c-4ea9-b690-add2065246f0
Commits

Reviewing files that changed from the base of the PR and between 7d0ce59 and 588ffbd.

Files selected for processing: 2
  • lib/session-watcher.test.mjs
  • lib/session-watcher.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@kilo-code-bot

kilo-code-bot Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Code Review Roast 🔥

Verdict: No Issues Found | Recommendation: Merge

Oh wait, this PR is actually clean. I need to sit down. I had my flamethrower warmed up and everything.

📊 Overall: Like finding a unicorn in production — I didn't think clean PRs existed anymore, but here we are.

Files Reviewed (2 files)
  • lib/session-watcher.ts
  • lib/session-watcher.test.mjs

Reviewed by free · Input: 39.7K · Output: 1K · Cached: 75.7K

@kahme247 kahme247 added the needs rebase Rebase onto current main; needs re-review label Nov 5, 2026
@kahme247

kahme247 commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

The Bun server/daemon architecture has landed on main, so this PR needs to be rebased and re-reviewed against the new architecture before it can be merged. Please rebase onto current main, resolve the conflicts, and request re-review once CI is green.

@andrebrait andrebrait left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you for fixing the XDG session-watcher mismatch. Maintainer triage at 588ffbdd561e63e11f840a3ffdf7864264c5645c: the production change correctly reuses getSessionsDir() instead of deriving a different directory from getAgentDir(). This remains useful on current main.

The added lib/session-watcher.test.mjs:5-13 only asserts source spelling, so it would pass if the watcher never delivered an event. Please replace that with a behavioral test using an isolated XDG sessions root: create/change a session there and observe the subscriber notification. That protects the reported regression without pinning an implementation.

Recommendation: prioritize this small correctness fix, with a behavioral regression check. Static review of the complete diff; no branch test suite or live filesystem-watcher probe was run here. This is triage, not merge approval.

nanogram added a commit to nanogram/ompweb that referenced this pull request Nov 8, 2026
Port the selected upstream changes onto main 51d3c19 while retaining its
Bun server, shared host ownership, durable outbox, and default transcript.
Correct integration and Windows compatibility defects exposed by runtime
verification; do not import failing-check PRs or deferred folder uploads.

Reviewed source heads:
ompweb-dev#296 7df8767
ompweb-dev#296
ompweb-dev#297 20af76d
ompweb-dev#297
ompweb-dev#298 cdae97a
ompweb-dev#298
ompweb-dev#303 588ffbd
ompweb-dev#303
ompweb-dev#309 ec97f9e
ompweb-dev#309
ompweb-dev#320 7bf8948
ompweb-dev#320
ompweb-dev#321 550d302
ompweb-dev#321
ompweb-dev#334 46dabb4
ompweb-dev#334
ompweb-dev#335 8edc916
ompweb-dev#335
ompweb-dev#338 72fc0a3
ompweb-dev#338
ompweb-dev#340 ea67136
ompweb-dev#340
ompweb-dev#343 645044d
ompweb-dev#343
ompweb-dev#349 ed5e053
ompweb-dev#349
ompweb-dev#374 38f93f3
ompweb-dev#374
ompweb-dev#407 20600a7
ompweb-dev#407
ompweb-dev#410 3c210ff
ompweb-dev#410
ompweb-dev#411 a99f8bb
ompweb-dev#411
ompweb-dev#414 34a33d7
ompweb-dev#414
ompweb-dev#416 55b7ef8
ompweb-dev#416
ompweb-dev#419 d89aa5a
ompweb-dev#419

Co-authored-by: kahme247 <61059522+kahme247@users.noreply.github.com>
Co-authored-by: Tanger <49036591+GTanger@users.noreply.github.com>
Co-authored-by: lutfi-zain <147457356+lutfi-zain@users.noreply.github.com>
Co-authored-by: OrwellVII <56531592+OrwellVII@users.noreply.github.com>
Co-authored-by: pengshuai <pengshuai4@lenovo.com>
Co-authored-by: todouu <pslzj@outlook.com>
Co-authored-by: tianzishen <tianzishen@local>
Co-authored-by: killcerr <kill_cerr@outlook.com>
Co-authored-by: tianzishen <tianzishen@sensetime.com>
Co-authored-by: RoyaLemonade <37620553+RoyaLemonade@users.noreply.github.com>
@andrebrait

Copy link
Copy Markdown
Collaborator

Hi @kahme247, thank you for your contribution, and apologies for the long wait on this PR. We really appreciate the time and effort you have put into it.

We are working through a major refactor of ompweb, including switching to our own build of omp. We are close to finishing that work; once the refactor is complete, we will turn our attention back to the pending PRs, including this one.

Thank you for your patience and for helping improve ompweb!

@kahme247

Copy link
Copy Markdown
Collaborator Author

Hi, thanks for this PR. It currently conflicts with main and can't be merged as-is — please rebase it onto current main and resolve the conflicts. Once it's rebased I'll re-run the checks.

This is a one-line fix and maintainer-prioritized — after the rebase it just needs the source-spelling test replaced with a behavioral test.

@kahme247

Copy link
Copy Markdown
Collaborator Author

Closing this as superseded by maintainer rework #551, which rebases this fix onto current main and replaces the source-spelling test with a behavioral test (native watcher follows the XDG sessions dir so external changes reach the sidebar; the test times out without the fix and passes with it).

@kahme247 kahme247 closed this Nov 23, 2026
1zun4 pushed a commit to 1zun4/ompweb that referenced this pull request Nov 23, 2026
1zun4 pushed a commit to 1zun4/ompweb that referenced this pull request Nov 23, 2026
…11-23

fix(modules): watch getSessionsDir() so XDG sessions reach the sidebar (rework of ompweb-dev#303)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Rebase onto current main; needs re-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants