Repository navigation
fix: persistent overlay homes for pi/omp/hermes launchers (session history loss) - #230
Merged
Merged
Conversation
…story loss) The pi/omp/hermes launchers built their /bili/-rewritten config inside a mkdtemp temp home (PI_CODING_AGENT_DIR / HERMES_HOME) and rm -rf'd it when the client exited. Clients persist absolute session paths derived from that temp home into shared state (e.g. omp ~/.omp/agent/terminal-sessions/pts-* resume pointers), and any file the client created directly inside the temp home (agent.db, models.db, ...) was destroyed on exit — making omp session history invisible and leaking temp dirs when the process was killed. Replace temp homes with stable persistent overlays next to the real home (~/.omp/agent-bili, ~/.pi/agent-bili, ~/.hermes-bili): every launch refreshes entry symlinks (dropping dead ones, merging overlay-created entries that shadow real-home entries back into the real home) and rewrites the generated config atomically. The overlay is never deleted, so paths stayed resolvable across runs. opencode/claude/codex launchers are unaffected (env/temp-file only).
Contributor
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-230Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr230.tgz
npm install -g packageThis comment is automatically updated on each push. |
Review of the first overlay commit found three paths where overlay-created data could be silently destroyed instead of merged back into the real home: - a regular FILE shadowing a real-home entry was rm'd without merging (client atomic-write-over-symlink lost its newer content) - the dir merge was shallow: new files under subdirs that exist on both sides were skipped and then deleted - a type clash (real-home file vs overlay dir, or vice versa) aborted the merge silently while the caller still rm'd the shadow subtree mergeOverlayDir is replaced by a recursive mergeOverlayEntry that preserves both sides (mtime-newer-wins for files, losers kept as <name>.bili-conflict) and reports failure; the caller now removes the shadow only when the merge fully succeeded, otherwise it is kept in place with a warning. Also add a .bili-launch.pid marker that warns when two bili launches share one overlay (each launch rewrites the generated config with its own proxy origin). Regression tests for all three loss paths plus the pid marker.
…nt-overlay-home # Conflicts: # src/launcher.ts
…nt-overlay-home # Conflicts: # README.md
…ess.exit no longer masks it
Merged
This was referenced Oct 20, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #12 (omp session history invisible via
bili omp) plus the same bug class in the pi and hermes launchers.Root cause
bili omppointedPI_CODING_AGENT_DIRat amkdtemptemp home (entries symlinked to~/.omp/agent, rewrittenmodels.yml) andrm -rf'd it in afinallywhen the client exited. Two loss modes:~/.omp/agent/terminal-sessions/pts-1contained/tmp/bili-omp-*/sessions/.../*.jsonl— dangling after cleanup, so resume-last-session could not find the session.agent.db,models.db, ...) ceased to exist on exit.Also: killed processes skipped the
finally, leaking/tmp/bili-omp-*dirs (3 found; plus 4bili-pi-*, 2bili-hermes-*).pi (
PI_CODING_AGENT_DIR) and hermes (HERMES_HOME,terminal-sessions/<id>last-session pointers) have the identical bug class. opencode/claude/codex launchers are env/temp-file only — unaffected.Fix
Replace temp homes with stable persistent overlays next to the real home:
~/.omp/agent-bili,~/.pi/agent-bili,~/.hermes-bili. Every launch:models.yml/models.json/config.yaml) atomicallyThe real home's config files remain untouched.
Test plan
npm run typecheck✓npm test— 567/567 ✓ (new launcher tests: overlay path is<home>-biliand stable across launches; symlink refresh picks up new real-home entries; bili-created state inside the overlay survives; dead symlinks dropped; shadowed dirs merged into the real home)npm run build✓