fix: hire-an-agent fails — unbound user_pass, admin auth, silent repo creation failure, unauthenticated clone #184

Closed
opened 2026-04-03 12:22:19 +00:00 by dev-bot · 0 comments
Collaborator

Problem

disinto hire-an-agent has several bugs that prevent it from working end-to-end, both on first run and re-run.

Bug 1: user_pass: unbound variable when user already exists

When the agent user already exists (e.g. from a previous partial run), step 1 is skipped but user_pass is never set. Lines 2707 and 2714 reference ${user_pass} which crashes with set -u:

Step 1: Creating user 'dev-qwen' (if not exists)...
  User 'dev-qwen' already exists

Step 2: Creating 'dev-qwen/.profile' repo (if not exists)...
bin/disinto: line 2707: user_pass: unbound variable

The password is only generated in the creation branch. On re-run, it needs to either be persisted to .env (like FORGE_ADMIN_PASS) or reset via the admin CLI.

Bug 2: _FORGE_ADMIN_PASS not read from .env

The function uses _FORGE_ADMIN_PASS:-admin as the fallback admin password, but _FORGE_ADMIN_PASS is only set as a shell variable during setup_forge() in the same init session. When hire-an-agent is called standalone, the variable is unset and the fallback "admin" is wrong (the real password is in .env as FORGE_ADMIN_PASS).

Fix: read FORGE_ADMIN_PASS from .env at the top of the function, same pattern as setup_forge() does after #158.

Bug 3: .profile repo creation reports success but repo does not exist

Step 2 prints "Created repo 'dev-qwen/.profile'" but the repo is not actually created on Forgejo. The API call likely fails silently (same class of bug as #164 — wrong endpoint or swallowed errors). After the run, repos/search returns only johba/harb.

Bug 4: Clone fails because no auth credentials

Step 3 tries to clone http://localhost:3000/dev-qwen/.profile.git without authentication. Even if the repo existed, the clone would fail for private repos. The clone URL should include the token, e.g. http://dev-qwen:<token>@localhost:3000/dev-qwen/.profile.git.

Steps to reproduce

source .env
export _FORGE_ADMIN_PASS=$FORGE_ADMIN_PASS
bin/disinto hire-an-agent dev-qwen dev --local-model http://10.10.10.1:8081 --poll-interval 300
# First run: creates user, fails at repo creation/clone
# Second run: user exists, crashes at user_pass unbound

Files

  • bin/disintodisinto_hire_an_agent() / hire_an_agent() function, around lines 2680-2730
## Problem `disinto hire-an-agent` has several bugs that prevent it from working end-to-end, both on first run and re-run. ### Bug 1: `user_pass: unbound variable` when user already exists When the agent user already exists (e.g. from a previous partial run), step 1 is skipped but `user_pass` is never set. Lines 2707 and 2714 reference `${user_pass}` which crashes with `set -u`: ``` Step 1: Creating user 'dev-qwen' (if not exists)... User 'dev-qwen' already exists Step 2: Creating 'dev-qwen/.profile' repo (if not exists)... bin/disinto: line 2707: user_pass: unbound variable ``` The password is only generated in the creation branch. On re-run, it needs to either be persisted to `.env` (like `FORGE_ADMIN_PASS`) or reset via the admin CLI. ### Bug 2: `_FORGE_ADMIN_PASS` not read from `.env` The function uses `_FORGE_ADMIN_PASS:-admin` as the fallback admin password, but `_FORGE_ADMIN_PASS` is only set as a shell variable during `setup_forge()` in the same init session. When `hire-an-agent` is called standalone, the variable is unset and the fallback `"admin"` is wrong (the real password is in `.env` as `FORGE_ADMIN_PASS`). Fix: read `FORGE_ADMIN_PASS` from `.env` at the top of the function, same pattern as `setup_forge()` does after #158. ### Bug 3: `.profile` repo creation reports success but repo does not exist Step 2 prints "Created repo 'dev-qwen/.profile'" but the repo is not actually created on Forgejo. The API call likely fails silently (same class of bug as #164 — wrong endpoint or swallowed errors). After the run, `repos/search` returns only `johba/harb`. ### Bug 4: Clone fails because no auth credentials Step 3 tries to clone `http://localhost:3000/dev-qwen/.profile.git` without authentication. Even if the repo existed, the clone would fail for private repos. The clone URL should include the token, e.g. `http://dev-qwen:<token>@localhost:3000/dev-qwen/.profile.git`. ## Steps to reproduce ```bash source .env export _FORGE_ADMIN_PASS=$FORGE_ADMIN_PASS bin/disinto hire-an-agent dev-qwen dev --local-model http://10.10.10.1:8081 --poll-interval 300 # First run: creates user, fails at repo creation/clone # Second run: user exists, crashes at user_pass unbound ``` ## Files - `bin/disinto` — `disinto_hire_an_agent()` / `hire_an_agent()` function, around lines 2680-2730
dev-bot added the
backlog
label 2026-04-03 12:22:19 +00:00
dev-qwen self-assigned this 2026-04-03 12:24:04 +00:00
dev-qwen added
in-progress
and removed
backlog
labels 2026-04-03 12:24:05 +00:00
dev-qwen removed their assignment 2026-04-03 12:44:09 +00:00
dev-qwen removed the
in-progress
label 2026-04-03 12:44:10 +00:00
Sign in to join this conversation.
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: disinto-admin/disinto#184
No description provided.