fix(onboarding): probe claude-session via filesystem, not a worker-image container (closes #37) #40

Merged
lz merged 6 commits from fix/onboarding into main 2026-06-21 14:29:36 +02:00
Owner

Summary

Fixes #37 — onboarding blocking on the credentials step when the worker image is missing or tagged differently than the worker_image setting.

The needs-claude-session phase was gated by probeClaudeSession, which spun up an ephemeral container from the configured worker image just to test -f two files on the claude-session volume. If that image wasn't present locally under the exact configured tag, docker.createContainer threw no such image: …, the error was swallowed into an opaque probe error: … hint, and the phase stuck at needs-claude-session forever — even though the real problem had nothing to do with credentials.

Nexus already bind-mounts the whole claude-session volume at /shared-config (SHARED_CONFIG_DIR=/shared-config/dot-claude), so the probe can read the two files directly off its own filesystem. This decouples claude-session bootstrap from the worker image entirely.

Changes

  • nexus/src/lib/server/workers/session-probe.ts — rewrite to fs.stat ${SHARED_CONFIG_DIR}/.credentials.json and ${SHARED_CONFIG_DIR}/../account.json. New signature probeClaudeSession(config); removed the worker-image container, the docker/db params, the in-memory cache + TTL_MS, the opts.force flag, and the invalidateProbe export. Behavior-preserving (existence-only). Distinct hints for volume not mounted vs files missing.
  • nexus/src/routes/api/state/+server.ts & .../claude-session/recheck/+server.ts — updated the two call sites; dropped now-unused imports.
  • nexus/src/lib/server/workers/session-probe.test.ts — new unit test (the probe was previously untestable without real Docker): both-present → ok; each file missing → bootstrap hint; volume root absent → not-mounted hint.

Design spec + implementation plan are included under docs/superpowers/specs/ and docs/superpowers/plans/.

Follow-up (not in this PR): #38 tracks pull-on-demand of the worker image at spawn time with SSE progress in the create UI — the only place the worker image still needs to be present.

Test Plan

  • pnpm test — 536/536 pass (includes 4 new session-probe tests)
  • pnpm typecheck — clean
  • pnpm lint — only 2 pre-existing scripts/gen-migrations.mjs errors (untouched by this change)
  • Manual: with the worker image absent/mistagged locally, unlock the vault and confirm onboarding advances past the credentials step (no longer blocks)
## Summary Fixes #37 — onboarding blocking on the credentials step when the worker image is missing or tagged differently than the `worker_image` setting. The `needs-claude-session` phase was gated by `probeClaudeSession`, which spun up an **ephemeral container from the configured worker image** just to `test -f` two files on the `claude-session` volume. If that image wasn't present locally under the exact configured tag, `docker.createContainer` threw `no such image: …`, the error was swallowed into an opaque `probe error: …` hint, and the phase stuck at `needs-claude-session` forever — even though the real problem had nothing to do with credentials. Nexus already bind-mounts the whole `claude-session` volume at `/shared-config` (`SHARED_CONFIG_DIR=/shared-config/dot-claude`), so the probe can read the two files directly off its own filesystem. This **decouples claude-session bootstrap from the worker image entirely**. ### Changes - `nexus/src/lib/server/workers/session-probe.ts` — rewrite to `fs.stat` `${SHARED_CONFIG_DIR}/.credentials.json` and `${SHARED_CONFIG_DIR}/../account.json`. New signature `probeClaudeSession(config)`; removed the worker-image container, the `docker`/`db` params, the in-memory cache + `TTL_MS`, the `opts.force` flag, and the `invalidateProbe` export. Behavior-preserving (existence-only). Distinct hints for *volume not mounted* vs *files missing*. - `nexus/src/routes/api/state/+server.ts` & `.../claude-session/recheck/+server.ts` — updated the two call sites; dropped now-unused imports. - `nexus/src/lib/server/workers/session-probe.test.ts` — **new** unit test (the probe was previously untestable without real Docker): both-present → ok; each file missing → bootstrap hint; volume root absent → not-mounted hint. Design spec + implementation plan are included under `docs/superpowers/specs/` and `docs/superpowers/plans/`. Follow-up (not in this PR): #38 tracks pull-on-demand of the worker image at spawn time with SSE progress in the create UI — the only place the worker image still needs to be present. ## Test Plan - [x] `pnpm test` — 536/536 pass (includes 4 new `session-probe` tests) - [x] `pnpm typecheck` — clean - [x] `pnpm lint` — only 2 pre-existing `scripts/gen-migrations.mjs` errors (untouched by this change) - [ ] Manual: with the worker image absent/mistagged locally, unlock the vault and confirm onboarding advances past the credentials step (no longer blocks)
lz added 4 commits 2026-06-21 13:47:56 +02:00
refactor(onboarding): drop vestigial checkedAt from claude-session Probe
Some checks failed
ci / nexus (pull_request) Failing after 2m14s
ci / images (./nexus, agent-nexus) (pull_request) Has been skipped
ci / images (./worker, agent-nexus-worker, base) (pull_request) Has been skipped
ci / images (PLAYWRIGHT_CLI_VERSION=0.1.13, ./worker, agent-nexus-worker, -playwright0.1.13, playwright) (pull_request) Has been skipped
13ccadf3b0
fix(lint): apply node globals to .mjs files so eslint stops flagging scripts
Some checks failed
ci / nexus (pull_request) Failing after 2m38s
ci / images (./nexus, agent-nexus) (pull_request) Has been skipped
ci / images (./worker, agent-nexus-worker, base) (pull_request) Has been skipped
ci / images (PLAYWRIGHT_CLI_VERSION=0.1.13, ./worker, agent-nexus-worker, -playwright0.1.13, playwright) (pull_request) Has been skipped
927a40cd98
fix(ci): generate migration registry before typecheck (svelte-kit sync doesn't)
Some checks failed
ci / nexus (pull_request) Successful in 4m49s
ci / images (./nexus, agent-nexus) (pull_request) Failing after 3m20s
ci / images (./worker, agent-nexus-worker, base) (pull_request) Successful in 3m56s
ci / images (PLAYWRIGHT_CLI_VERSION=0.1.13, ./worker, agent-nexus-worker, -playwright0.1.13, playwright) (pull_request) Successful in 7m50s
7ee77b5125
lz merged commit c45e401dd9 into main 2026-06-21 14:29:36 +02:00
lz deleted branch fix/onboarding 2026-06-21 14:29:38 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lz/agent-nexus!40
No description provided.