Skip to content

fix(airc daemon): scope tracks cwd, not always $HOME/.airc#201

Merged
joelteply merged 1 commit intocanaryfrom
fix/daemon-scope-cwd
Apr 28, 2026
Merged

fix(airc daemon): scope tracks cwd, not always $HOME/.airc#201
joelteply merged 1 commit intocanaryfrom
fix/daemon-scope-cwd

Conversation

@joelteply
Copy link
Copy Markdown
Contributor

Summary

Three-line fix to _daemon_scope. Mirrors detect_scope() so airc daemon install from a project dir captures THAT dir's .airc as the daemon's scope.

Bug PR #200 missed

Pre-fix: _daemon_scope returned ${AIRC_HOME:-$HOME/.airc}. User state from airc join in ~/continuum/ lives in ~/continuum/.airc/ (per detect_scope line 135). Mismatch → daemon monitor spawns into empty ~/.airc/, user appears offline.

Test

  • airc daemon install from ~/continuum/ → daemon AIRC_HOME = ~/continuum/.airc
  • airc daemon status reports RUNNING for the cwd-scoped monitor

🤖 Generated with Claude Code

….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'.
Copilot AI review requested due to automatic review settings April 28, 2026 05:58
@joelteply joelteply merged commit 34f354e into canary Apr 28, 2026
8 checks passed
@joelteply joelteply deleted the fix/daemon-scope-cwd branch April 28, 2026 05:59
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_scope to prefer AIRC_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 thread airc
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 thread airc
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 thread airc

# 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.
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