Skip to content

fix: recover arr logins after an aborted install (v1.2.1) - #7

Merged
LavX merged 3 commits into
mainfrom
fix/v1.2.1-login-recovery
Oct 19, 2026
Merged

LavX merged 3 commits into
mainfrom
fix/v1.2.1-login-recovery

Conversation

@LavX

@LavX LavX commented Oct 19, 2026

Copy link
Copy Markdown
Owner

What

Fixes the login failure reported in #6 and releases v1.2.1.

  • arrstack update now seeds a missing Sonarr/Radarr/Prowlarr admin user from admin.txt after the health gate. This repairs installs that aborted at docker compose pull and were started manually, where the containers are healthy but no admin user exists.
  • seedArrAdmin only writes when the instance has no username/password. It no longer resets credentials the user changed in the UI.
  • arrstack doctor reports an incomplete install when state.json has no install_completed_at, with the arrstack install --resume fix.
  • Docs cover the failure signature and recovery, and correct the update step list.
  • Adds unit tests for arr auth seeding, the new skip rule, update recovery, and admin.txt parsing.

Why

Issue #6: an aborted install writes admin.txt before Docker, then never reaches the wiring steps. Manually running docker compose up -d starts healthy containers with no login user.

How it was tested

  • bun test: 330 pass.
  • bun run typecheck: clean.
  • Live check against fresh lscr.io/linuxserver Sonarr 4.0.19, Radarr, and Prowlarr containers: seeding returned seeded, curl -X POST /login returned 302 with an auth cookie, wrong password redirected to loginFailed=true, and a second seed returned exists.
  • ghcr.io/recyclarr/recyclarr:8 resolves; :latest does not.

Checklist

  • bun test passes
  • tsc --noEmit passes
  • No em dashes added
  • No AI attribution
  • No TUI change
  • Docs updated
  • New code has tests

LavX added 2 commits October 19, 2026 09:45
An install that fails at docker compose pull or the health gate stops
before the wiring steps. The containers can be started by hand and answer
health checks, but no Sonarr/Radarr/Prowlarr user was ever created, so the
password in admin.txt is rejected. `arrstack update` now seeds a missing
arr admin user from admin.txt, and never overwrites credentials the user
changed in the UI.

`arrstack doctor` flags state.json without install_completed_at so the
incomplete install, not the password, is visible as the cause. Docs get
the failure signature and the `arrstack install --resume` recovery path.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T07:51:10.915360Z 6b8405f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

The unreachable-API tests relied on connection-refused errors being
non-retryable. On GitHub's runners the error matched withRetry's retry
predicate, so each test burned the full 15.5s backoff and tripped the
5s test timeout. Mock fetch instead: failure and 403 paths are now
deterministic and cannot hit a real arrstack install.
@LavX
LavX merged commit 0f1662f into main Oct 19, 2026
2 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6b8405fdbd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/usecase/update.ts
// admin user, so the password in admin.txt cannot log in. Seed any arr that
// has no user yet. Best-effort: never fail an update over this.
const seedStart = d.now();
await reseedArrAdmins(installDir, state, d.seedArrAdmin, logAndEcho);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restrict login recovery to interrupted installs

On every update of a completed installation, this unconditionally runs the recovery path, and seedArrAdmin interprets blank username/password fields as an aborted install. A user who intentionally configured an arr service for external or disabled authentication and cleared those fields will therefore have the next update overwrite that configuration with forms authentication and the credentials from admin.txt. Gate this recovery on the existing !state.install_completed_at signal (or otherwise distinguish an interrupted install) so updates preserve intentional authentication settings.

Useful? React with 👍 / 👎.

Comment thread src/state/store.ts
Comment on lines +65 to +66
const username = text.match(/^username:\s*(.+)$/m)?.[1]?.trim();
const password = text.match(/^password:\s*(.+)$/m)?.[1]?.trim();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep credential parsing on the current line

When admin.txt contains an empty password field, which is one of the incomplete-file cases this helper promises to reject, \s* consumes the newline and (.+) captures the following generated: line as the password. The update recovery path can then seed the arr account with that unintended value while the file still shows no usable password. Match only horizontal whitespace after the colon so an empty field returns null.

Useful? React with 👍 / 👎.

Comment thread docs/guide/09-updating.md
2. Re-renders `docker-compose.yml` and `Caddyfile` from the current binary's templates, so installer fixes reach an existing install.
3. Runs `docker compose pull` against the generated `docker-compose.yml` so every enabled service fetches its latest image.
4. Runs `docker compose up -d`, which recreates only the containers whose images changed.
5. Health-checks every enabled service and seeds a missing Sonarr, Radarr, or Prowlarr admin user from `admin.txt`. This repairs arr logins left behind by an install that aborted before its wiring steps.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Limit the documented health checks to HTTP services

This now promises that update health-checks every enabled service, but runHealthChecks explicitly filters to services whose catalog health type is http. Enabled services such as Caddy and Recyclarr are therefore not checked, so an update may report completion even when one of them is unavailable while users are told it was verified. Either add checks for the remaining service health types or document the HTTP-only scope.

Useful? React with 👍 / 👎.

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.

1 participant