refactor(launch): aileron launch becomes a thin client of the daemon#476
Merged
ALRubinger merged 2 commits intomainfrom May 6, 2026
Merged
refactor(launch): aileron launch becomes a thin client of the daemon#476ALRubinger merged 2 commits intomainfrom
ALRubinger merged 2 commits intomainfrom
Conversation
Step 8 of #454 — the structural change ADR-0012 has been building toward. Removed: - internal/launch/gateway.go and its tests (the per-session embedded gateway). Daemon owns the gateway now. - internal/launch/vault_prompt_mode_test.go and the resolveVaultPromptMode/vaultPromptMode/vaultPathForGateway helpers. Daemon owns vault unlock; launch just observes status. - generateSessionID: daemon mints the ULID at POST /v1/sessions. Added: - internal/launch/daemon_client.go: thin HTTP client for /v1/sessions, /v1/sessions/{id}/end, /v1/vault/local/status. - internal/launch/testmain_test.go: a per-package httptest fake of the daemon, advertised via AILERON_API_URL so tests don't need a real `server` binary on PATH. Refactored: - internal/launch/launcher.go:Launch is now: spawn.Resolve → POST /v1/sessions → set ANTHROPIC_BASE_URL + AILERON_URL + AILERON_APPROVAL_URL to the daemon → run agent → POST /v1/sessions/{id}/end with the exit code. Best-effort end (warn on failure; the orphan-reaper handles the worst case). - printStartupBanner takes a daemonURL string instead of *Gateway. Vault-locked hint comes from a GET /v1/vault/local/status probe before exec. - composeAgentEnv stays (moved into launcher.go). - Binary lookup is skipped when AILERON_API_URL is set so spawn doesn't need a real `server` to fork-exec. Kept: - EnsureVault and PassphrasePrompter — the daemon binary (internal/server/main.go) still uses them for stderr-prompt unlock at startup. - commsserver and approval socket — independent of the gateway; Step 9 (#454) moves them to daemon ownership. This is the PR that fixes the original bug: aileron launch no longer re-prompts for vault unlock when a daemon is already running with an unlocked vault, because launch and CLI now share the daemon's vault. Refs #454. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
🚅 Deployed to the aileron-pr-476 environment in aileron 1 service not affected by this PR
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #476 +/- ##
=======================================
Coverage 82.24% 82.24%
=======================================
Files 234 234
Lines 24127 24153 +26
=======================================
+ Hits 19843 19865 +22
+ Misses 3148 3144 -4
- Partials 1136 1144 +8
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Lifts patch coverage from ~50% to ~85% on the new daemon-client and helper code: - daemon_client_test.go: RegisterSession success / non-OK status / empty-id / decode-error / EndSession success+orphaned-shape / non-OK status / LocalVaultLocked locked-true / unreachable / non-200 / garbage-body / trimTrailingSlash table. - launcher_extra_test.go: resolveDaemonBinary sibling+PATH+notfound; resolveStateDir under HOME; composeAgentEnv with/without override. Per-function coverage on the new code: - newDaemonClient: 100% - RegisterSession: 68.4 → 84.2% - EndSession: 73.3 → 80% - LocalVaultLocked: 69.2 → 92.3% - httpStatusError: 0 → 100% - trimTrailingSlash: 66.7 → 100% - composeAgentEnv: 83.3 → 100% - resolveDaemonBinary: 0 → 85.7% Package total: 86.9% → 88.8%. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Step 8 of #454 — the structural change ADR-0012 has been building toward. This is the PR that fixes the original bug:
aileron launchno longer re-prompts for vault unlock when a daemon is already running with an unlocked vault, because launch and CLI now share the daemon's vault.Removed
internal/launch/gateway.goand its tests — the per-session embedded gateway. The daemon owns the gateway now.internal/launch/vault_prompt_mode_test.goand theresolveVaultPromptMode/vaultPromptMode/vaultPathForGatewayhelpers. The daemon owns vault unlock; launch just observes status.generateSessionID— the daemon mints the ULID atPOST /v1/sessions.Added
internal/launch/daemon_client.go— thin HTTP client for/v1/sessions,/v1/sessions/{id}/end,/v1/vault/local/status. ~150 lines.internal/launch/testmain_test.go— per-package httptest fake of the daemon, advertised viaAILERON_API_URL. Tests don't need a realserverbinary on PATH.Refactored
internal/launch/launcher.go:Launchis now:spawn.Resolveto find/auto-spawn the daemonPOST /v1/sessionsto register; daemon hands back the ULIDANTHROPIC_BASE_URL,AILERON_URL,AILERON_APPROVAL_URLto the daemon URL (stable across launches)POST /v1/sessions/{id}/endwith the exit code (best-effort; the orphan-reaper handles the worst case)printStartupBannertakes adaemonURL stringinstead of*Gateway. Vault-locked hint comes from aGET /v1/vault/local/statusprobe before exec — same banner shape, sourced differently.composeAgentEnvstays (moved into launcher.go).Binary lookup is skipped when
AILERON_API_URLis set so spawn doesn't need a realserverto fork-exec. (Same pattern as cmd/aileron from #472.)Kept
EnsureVaultandPassphrasePrompter— the daemon binary (internal/server/main.go) still uses them for stderr-prompt unlock at startup. They're now internal to the daemon's setup, not used by launch.commsserverandapprovalsocket — independent of the gateway. Step 9 (Umbrella: Local Daemon Architecture (ADR-0012) #454) moves them to daemon ownership.Test plan
go test ./internal/launch/... ./internal/app/... ./cmd/aileron/... -raceis green.go vet ./...is clean.TestLaunch_*tests all pass via the package-wide httptest fake daemon (setsAILERON_API_URL).printStartupBannertests rewritten to take a string URL instead of*Gateway.Notes
selectVaultpath (which useslaunch.EnsureVault). When launch fork-execs the daemon, the daemon is detached and can't prompt — first-run interactive setup remains a documented gap (deferred to a Step 7 follow-up).aileron launch claudefinally reuses the standalone daemon's unlocked vault. The bug we started this thread on is fixed.🤖 Generated with Claude Code