From ea33e231ef3fe13941b2edcb4660b9e5c3beb42b Mon Sep 17 00:00:00 2001 From: Bastien Chanot Date: Fri, 26 Jun 2026 00:09:16 +0200 Subject: [PATCH] docs(memory): add BDR-009 + LRN-008 (dtach menu -> ~/.bashrc, VS Code non-login) - BDR-009: reverses BDR-007; menu moved to ~/.bashrc because VS Code Remote-SSH terminals are non-login; per-tab firing accepted over a once-per-connection sentinel. - LRN-008: VS Code Remote-SSH (Linux) terminals are non-login -> skip ~/.profile; hook ~/.bashrc for "run once at session start"; diagnose via VSCODE_IPC_HOOK_CLI + no login-bash ancestry + shopt -q login_shell. - journal: 2026-06-25 session entry. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01CN1KSmsuLG6TxSeN5m8xvM --- .claude/memory/decisions.md | 13 +++++++++++++ .claude/memory/journal.md | 9 +++++++++ .claude/memory/learnings.md | 11 +++++++++++ 3 files changed, 33 insertions(+) diff --git a/.claude/memory/decisions.md b/.claude/memory/decisions.md index 228092f..756af81 100644 --- a/.claude/memory/decisions.md +++ b/.claude/memory/decisions.md @@ -60,3 +60,16 @@ grant asserted in README per FSF convention, LICENSE holds plain GPLv3 text. Alt (permissive — allow CLOSED derivatives, weaker open guarantee); Unlicense (public domain, no copyleft). Repo private (CLAUDE.md Public=no) so license optional, but user wanted one set. Reversible: swap LICENSE + README line if "full opensource" meant permissive. Status: done in repo (uncommitted). + +## BDR-009 — dtach resume menu moved ~/.profile → ~/.bashrc (every interactive shell) +2026-06-25. Reversed BDR-007. Root cause: user works in VS Code Remote-SSH; its Linux integrated terminals are +NON-login interactive shells → read `~/.bashrc`, never `~/.profile` → login-scoped wiring (BDR-007) silently +never fired (LRN-008). Now source dtach-router from `bashrc-linux` via `case $- in *i*) … . dtach-router`; +fires in EVERY interactive shell (covers VS Code, plain SSH via `~/.profile`→`~/.bashrc`, tmux, new tabs). +install.sh `wire_dtach_profile()` → `unwire_dtach_profile()`: strips any stale `~/.profile` block (marker + +legacy) so plain SSH login (sources `~/.bashrc` via `~/.profile`) doesn't prompt twice. Trade-off ACCEPTED +(user chose "simplest"): menu shows in each new terminal tab when sessions exist, not once-per-connection — +the exact noise BDR-007 avoided, now tolerated for VS Code reliability. Alts rejected: (a) once-per-connection +sentinel keyed to `SSH_CONNECTION`/`VSCODE_IPC_HOOK_CLI` in `$XDG_RUNTIME_DIR` — more code, user declined; +(b) VS Code `terminal.integrated` `args:["-l"]` — not carried by dotfiles, same per-tab firing. Supersedes +BDR-007. Status: done in repo; live needs `./install.sh` re-run. diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index 483dfde..e6551bb 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -41,3 +41,12 @@ SOURCE `case $- in *i*) ... . dtach-router` via idempotent wire_dtach_profile() marker block, re-appends marker block). Added cc (create) / d (re-summon) aliases to bashrc-linux. shellcheck + bash -n CLEAN; migration simulated on real .profile copy. LRN-006 + BDR-007. README synced. Not committed; live ~/.profile not yet re-migrated. + +## 2026-06-25 — dtach menu: ~/.profile → ~/.bashrc (VS Code non-login fix) +User: dtach resume menu never fires at session start, even post-install. Root cause: user runs VS Code +Remote-SSH → its Linux terminals are NON-login → skip ~/.profile (where BDR-007 wired it). Proven by process +tree (VSCODE_IPC_HOOK_CLI, no sshd/login-bash) + provably-correct ~/.profile wiring + existing session yet zero +menu. Fix: source dtach-router from bashrc-linux (every interactive shell); install.sh wire_dtach_profile() → +unwire_dtach_profile() strips stale ~/.profile block (avoids double-prompt on plain SSH). User chose simplest +(per-tab) over once-per-connection sentinel. shellcheck install.sh CLEAN, bash -n OK, strip proven idempotent +on .profile copy. BDR-009 (supersedes BDR-007) + LRN-008. Live needs ./install.sh re-run. diff --git a/.claude/memory/learnings.md b/.claude/memory/learnings.md index a83bed6..94c9125 100644 --- a/.claude/memory/learnings.md +++ b/.claude/memory/learnings.md @@ -56,3 +56,14 @@ returned EMPTY while code-server + RDP stayed undocumented. A partial doc commit hides earlier feature drift. Fix: drift-detect against FEATURE commits (scan `git log` for feat/* touching source since the doc's last SUBSTANTIVE edit, OR cross-ref each entry-point / install-step in code vs doc text) — never trust doc timestamp alone. Surfaced by /doc clean this session. + +## LRN-008 — VS Code Remote-SSH terminals are non-login → skip ~/.profile +2026-06-25. VS Code Remote-SSH (Linux) integrated terminals = NON-login interactive bash → source `~/.bashrc`, +NEVER `~/.profile`. Any login-scoped startup wiring (`~/.profile`, `~/.bash_profile`) silently never runs there. +Diagnose via process tree: `VSCODE_IPC_HOOK_CLI` env + `.vscode-server/.../remote-cli` in PATH, no `sshd` / +no `bash -l` ancestry (the launching shell reparents to systemd); confirm with `shopt -q login_shell`. For +"run once at session start" that must work under VS Code, hook `~/.bashrc` (universal: sourced by login shells +via `~/.profile` AND directly by non-login interactive shells), NOT `~/.profile`. Extends/corrects LRN-006 +(its `~/.profile` fix is valid only for real login shells, not IDE remotes). Deductive tell that pinned it: +wiring proven correct + target resource (session) proven present, yet menu never fires at startup → the startup +file is not being sourced → non-login shell. See BDR-009.