Repository navigation
Open
Labels
app/atlas-searchpkgs/atlas-search (Atlas search service + atlas-embed)pkgs/atlas-search (Atlas search service + atlas-embed)kind/bugSomething isn't working (prefixed form of the classic bug label)Something isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)Ordinary priority (the default)queue/parkedQueue task is parked (waiting on CI, time, or an event)Queue task is parked (waiting on CI, time, or an event)source/creatorFiled by the new-issue-creator jobFiled by the new-issue-creator jobsource/design-architectFiled by the repo design architect jobFiled by the repo design architect jobstatus/parkedDeliberately paused with a recorded resume conditionDeliberately paused with a recorded resume conditiontask/triageQueue packet kind: verify, reproduce, and route this itemQueue packet kind: verify, reproduce, and route this itemwork/assignedQueue worker lifecycle stateQueue worker lifecycle state
Description
Problem
In atlas-search (and its fleet-search port), every home-directory helper treats a missing HOME as the literal relative path ~, and an empty HOME as the empty path — so state/config/token paths resolve relative to the current working directory instead of failing or resolving to the user's home.
The helper shape, copied in at least six places:
std::env::var_os("HOME").map(PathBuf::from).unwrap_or_else(|| PathBuf::from("~"))pkgs/atlas-search/crates/atlas-search/src/server.rs:202—default_service_config_path()(theinit/serveservice config, which contains the client bearer tokens)pkgs/atlas-search/crates/atlas-search/src/fetch_model.rs:41—state_root()/model_dir()(fetch-model provisioning + lock)pkgs/atlas-search/crates/atlas-search/src/service.rs:50—home_dir()(client token config~/.config/atlas-search/client.json)pkgs/atlas-search/crates/atlas-search/src/main.rs:248—home_dir()(default_db_path(),resolve_model_dir(),resolve_ort_lib())pkgs/atlas-search/crates/atlas-core/src/turso.rs:210—home()(Turso token cache~/.cache/atlas-search/turso-token.json)pkgs/fleet/crates/fleet-search/src/client.rs:53—home_dir()(serving-host marker + the same client-token path, ported in fleet step 5)
Verified (this run, laptop, real debug binary, probe ~/git/fleet/probe-atlas-home)
In a scratch working directory:
env -u HOME atlas-search init→ exit 0, printswrote service config ~/.local/state/atlas-search/service.json, and actually creates./~/.local/state/atlas-search/service.jsonunder the CWD.HOME= atlas-search init→ exit 0, printswrote service config .local/state/atlas-search/service.json, and creates./.local/state/atlas-search/service.jsonunder the CWD.
Current main beaad887b0 contains the identical helpers at the lines above.
Why it matters
initreports success while writing the service config — which holds freshly generated client bearer tokens (0600) — into whatever directory the caller happened to be in (potentially a git checkout or shared dir), where a laterserve/client run with a normalHOMEwill never find it. The service silently appears unconfigured.- The same CWD-relative drift hits the model snapshot dir, the Turso token cache, and the fleet-search serving-host seat marker, so seat detection and token resolution can silently disagree with the service.
- Contrast inside this repo:
pkgs/id/src/commands/world.rs:999treats a missingHOMEas a hard error with context (no HOME for ~/.ssh/known_hosts; pass --ssh-host-key), and fleet-config was fixed for the empty-env half of this class in fleet-config: empty XDG env vars resolve to CWD-relative paths (a planted ./fleet/fleet.toml is loaded), and a relative FLEET_BROKER_SOCKET bypasses under-HOME resolution #5473. Atlas/fleet-search never got either half.
Acceptance criteria
- An empty
HOMEis treated as unset at every site above (atlas-search, atlas-core, fleet-search). - With
HOMEunset/empty, no atlas-search or fleet-search verb creates or reads a path under./~or./.local/./.config/./.cache: it either fails loudly namingHOME, or resolves the real home directory another way (e.g. passwd entry) — one consistent rule, shared where practical instead of six copies. - Regression tests pin both shapes (unset and empty) for at least the service-config path and the fleet-search serving-host marker.
- Normal behavior is unchanged when
HOMEis set:initwrites~/.local/state/atlas-search/service.json, and existing path-resolution tests stay green.
Metadata
Metadata
Assignees
Labels
app/atlas-searchpkgs/atlas-search (Atlas search service + atlas-embed)pkgs/atlas-search (Atlas search service + atlas-embed)kind/bugSomething isn't working (prefixed form of the classic bug label)Something isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)Ordinary priority (the default)queue/parkedQueue task is parked (waiting on CI, time, or an event)Queue task is parked (waiting on CI, time, or an event)source/creatorFiled by the new-issue-creator jobFiled by the new-issue-creator jobsource/design-architectFiled by the repo design architect jobFiled by the repo design architect jobstatus/parkedDeliberately paused with a recorded resume conditionDeliberately paused with a recorded resume conditiontask/triageQueue packet kind: verify, reproduce, and route this itemQueue packet kind: verify, reproduce, and route this itemwork/assignedQueue worker lifecycle stateQueue worker lifecycle state
Activity
developing-today commentedon Nov 4, 2026
CODE-1402
dezren39 commentedon Nov 4, 2026
🤖 Agent note · filed
./~or./.localpaths when HOME is unset/empty, regression tests pin both shapes, normal HOME-set behavior unchanged.dezren39 commentedon Nov 4, 2026
🤖 Agent note · picked up
7 remaining items
dezren39 commentedon Nov 4, 2026
🤖 Agent note · parked
dezren39 commentedon Nov 4, 2026
🤖 Agent note · parked
repo-queue claimprobe by the monitor claimed task 9732 for ~1 minute; no work was done and no code was touched. The task was immediately re-parked (not_before 2026-11-04T20:43Z) to resume its prior handed-off state for the opencode claimant, per lane code-l's handoff notes.dezren39 commentedon Nov 4, 2026
🤖 Agent note · cross-reference from new-issue-creator-code-b (run 2026-11-04T23:05Z)
One more site in this class inside atlas-core, not in the six listed in the body:
pkgs/atlas-search/crates/atlas-core/src/local.rs:74-82—expanduser()strips a~/prefix only whenHOMEis set; with HOME unset the literal~/...string passes through unchanged (a CWD-relative path when used), and withHOME=""it joins the rest onto an empty base (also CWD-relative). Same fix rule (empty treated as unset; fail loudly or resolve the real home) should cover it.Filed separately for the fleet-queue client, which has the root-anchored variant of this pattern and is not named here: #5673.
dezren39 commentedon Nov 5, 2026
🤖 Agent note · adopted as a design phase
dezren39 commentedon Nov 5, 2026
🤖 Agent note · correction to the adoption note above
source/design-architect, and the design doc isfiles/designs/code-home-resolution-contract.mdin thekeep-the-four-repos-healthygoal workspace. Everything else in the note above stands as written.dezren39 commentedon Nov 5, 2026
🤖 Agent note · state: handed off
pkgs/fleet/crates/fleet-search/src/client.rs:53), gathered this run on the laptop with the installedfleetbinary (scratch/tmp/probe-search-home, laptop primary @102bfa62ba):fleet search probequery --via-service→ token error names the literal relative path~/.config/atlas-search/client.json../~/.config/atlas-search/client.json({"token": "PROBE-PLANTED-TOKEN"}): the token was loaded and submitted to the live service —service at http://127.0.0.1:18760 rejected the job submit: HTTP 401 (unauthorized: invalid client token). A CWD-planted file became the client's bearer credential..config/atlas-search/client.json(plain CWD-relative); planted./.config/atlas-search/client.jsonwas likewise loaded and submitted (401)../~/.local/state/atlas-search/service.json, no routing flag: search went straight to standalone; the identical clean-CWD control attempted via-service first — the planted marker flips the Q3 seat routing.dezren39 commentedon Nov 5, 2026
Cross-link from #6238 (filed 2026-11-05, creator lane A): the same missing/empty-HOME pattern exists in one more copy not among this issue's six sites — the fleet-queue client's
home()(pkgs/fleet/crates/fleet-queue/src/client.rs:31-33) falls back to an empty string, resolving its token/socket/config/signal paths at the filesystem root (/.config/queue-broker/token,/tools/queue-broker-token, …). It is tracked separately in #6238 so this issue's scope stays as filed; the fix rule should be consistent across both.