fix(airc daemon): scope tracks cwd, not always $HOME/.airc#201
Merged
fix(airc daemon): scope tracks cwd, not always $HOME/.airc#201
Conversation
….airc PR #200 follow-up. _daemon_scope was returning ${AIRC_HOME:-$HOME/.airc} unconditionally, but actual user state lives in $cwd/.airc per detect_scope(). So 'airc daemon install' from ~/continuum/ captured the wrong scope (~/.airc, empty), spawned a monitor that connected to nothing, user appeared offline despite 'RUNNING (PID xxx)' in status. Mirror detect_scope's logic exactly: AIRC_HOME if set, else cwd/.airc. Now 'airc daemon install' from a project dir captures THAT dir's .airc as the daemon's scope, launcher .bat sets AIRC_HOME=that, the spawned airc connect uses the right room state. Joel 2026-04-28 ~01:05Z caught this: 'lol obv if it worked you would have a monitor and be online. FAIL'.
There was a problem hiding this comment.
Pull request overview
Adjusts daemon scoping so airc daemon install uses the same cwd-based scope selection as the rest of airc, avoiding mismatches where the daemon monitors a different .airc directory than the user’s join state.
Changes:
- Updated
_daemon_scopeto preferAIRC_HOME, otherwise use$(pwd -P)/.airc. - Expanded inline documentation describing the scope mismatch that prompted the fix.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
4886
to
+4891
| _daemon_scope() { | ||
| echo "${AIRC_HOME:-$HOME/.airc}" | ||
| if [ -n "${AIRC_HOME:-}" ]; then | ||
| echo "$AIRC_HOME" | ||
| else | ||
| echo "$(pwd -P)/.airc" | ||
| fi |
Comment on lines
4886
to
+4891
| _daemon_scope() { | ||
| echo "${AIRC_HOME:-$HOME/.airc}" | ||
| if [ -n "${AIRC_HOME:-}" ]; then | ||
| echo "$AIRC_HOME" | ||
| else | ||
| echo "$(pwd -P)/.airc" | ||
| fi |
|
|
||
| # The scope the daemon will run under. If AIRC_HOME is set at install time, | ||
| # that's recorded in the unit/plist so future starts use the same scope. | ||
| # The scope the daemon will run under. Mirrors detect_scope() (line 135) |
joelteply
added a commit
that referenced
this pull request
Apr 28, 2026
…op) (#202) * fix(airc daemon): scope tracks cwd at install time, not always $HOME/.airc PR #200 follow-up. _daemon_scope was returning ${AIRC_HOME:-$HOME/.airc} unconditionally, but actual user state lives in $cwd/.airc per detect_scope(). So 'airc daemon install' from ~/continuum/ captured the wrong scope (~/.airc, empty), spawned a monitor that connected to nothing, user appeared offline despite 'RUNNING (PID xxx)' in status. Mirror detect_scope's logic exactly: AIRC_HOME if set, else cwd/.airc. Now 'airc daemon install' from a project dir captures THAT dir's .airc as the daemon's scope, launcher .bat sets AIRC_HOME=that, the spawned airc connect uses the right room state. Joel 2026-04-28 ~01:05Z caught this: 'lol obv if it worked you would have a monitor and be online. FAIL'. * fix(airc daemon): launcher cd's to cwd, skip AIRC_HOME (Windows fs view fix) Daemon installed via PR #200/#201 was still crashlooping (every 4s) because the launcher .bat set AIRC_HOME to a Windows-form path (C:\Users\green\continuum\.airc) which Git Bash's airc binary couldn't traverse cleanly downstream. Plus 'bash -lc' was reading login profile and re-exporting PATH which churned env. Restructured launcher .bat: 1. 'cd /d <cwd_win>' from cmd.exe so the bash subprocess inherits the project dir as pwd. detect_scope() then returns <cwd>/.airc the same way it does in the user's interactive shell. 2. Drop AIRC_HOME entirely — let detect_scope work normally. 3. 'bash -c' not 'bash -lc' — non-login skips profile, keeps the env we set in cmd uncorrupted. 4. Absolute Unix-form path to airc (cygpath -u) — bash -c doesn't read ~/.bashrc, so PATH may not include ~/.local/bin. 5. Errors log to daemon.err relative to cwd (already cd'd into it). Joel 2026-04-28 caught both the wrong-scope (PR #201) and now the crashloop. Verified locally: with this launcher shape, airc connect runs to completion + maintains the SSH tail to the host.
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.
Summary
Three-line fix to
_daemon_scope. Mirrorsdetect_scope()soairc daemon installfrom a project dir captures THAT dir's.aircas the daemon's scope.Bug PR #200 missed
Pre-fix:
_daemon_scopereturned${AIRC_HOME:-$HOME/.airc}. User state fromairc joinin~/continuum/lives in~/continuum/.airc/(perdetect_scopeline 135). Mismatch → daemon monitor spawns into empty~/.airc/, user appears offline.Test
airc daemon installfrom~/continuum/→ daemon AIRC_HOME =~/continuum/.airc✓airc daemon statusreports RUNNING for the cwd-scoped monitor🤖 Generated with Claude Code