Skip to content

feat(room): sync-mas command + proper Docker app user#343

Merged
sfph merged 6 commits into
mainfrom
feat/room-sync-mas
Jun 10, 2026
Merged

feat(room): sync-mas command + proper Docker app user#343
sfph merged 6 commits into
mainfrom
feat/room-sync-mas

Conversation

@sfph

@sfph sfph commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds mycelium room sync-mas <name> CLI command and POST /rooms/{room_name}/sync-mas backend endpoint to register (or re-register) an existing room with the CFN mgmt plane. Idempotent: on 409 it falls back to fetching the existing MAS ID from the GET list rather than erroring.
  • Wires a fix_fn into _check_room_mas_ids in doctor.py so mycelium doctor --fix automatically registers all rooms missing a MAS ID.
  • Replaces the chown/chmod 755 /root hack in the Dockerfile with a proper mycelium app user (uid 1000), USER directive, and /home/mycelium home directory. Drops the hardcoded user: "1000:1000" from compose.yml since the image now declares it, and moves the bind-mount target from /root/.mycelium to /home/mycelium/.mycelium.

Test plan

  • mycelium room sync-mas <room> registers a room that was created before CFN was configured and prints its new MAS ID
  • mycelium room sync-mas <room> on a room already in CFN finds the existing MAS ID rather than erroring
  • mycelium doctor reports missing MAS IDs; mycelium doctor --fix resolves them
  • docker compose ... up mycelium-backend starts cleanly as the mycelium user with no PermissionError on logs or .mycelium
  • docker run --rm mycelium-backend:dev whoami returns mycelium

🤖 Generated with Claude Code

sfph and others added 5 commits June 9, 2026 19:04
Adds POST /rooms/{room_name}/sync-mas backend endpoint that registers an
existing room with the CFN mgmt plane. Handles the 409 case (name already
exists in CFN) by fetching the existing MAS ID from the GET list rather
than erroring, making the operation fully idempotent.

Adds `mycelium room sync-mas <name>` CLI command that calls the endpoint.

Wires a fix_fn into _check_room_mas_ids in doctor.py so that
`mycelium doctor --fix` automatically registers all rooms missing a MAS ID.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
hermes agents written by feat/hermes fail doctor's manifest validation
because the Literal type and AGENT_ADAPTERS set did not include 'hermes'.
Fixes the schema validation error seen in `mycelium doctor` output.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
compose.yml runs mycelium-backend as user 1000:1000 but the image was
built with /app/logs owned by root and /root mode 700, causing two
PermissionErrors on startup: one writing logs/app.log and one accessing
the /root/.mycelium bind-mount. Fix both in the Dockerfile.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace the chown/chmod hack with a proper non-root app user:
- Dockerfile: useradd mycelium (uid 1000), chown /app to that user,
  add USER mycelium directive so the image declares its own intent
- compose.yml: drop user: "1000:1000" (image now declares it) and
  move MYCELIUM_DATA_DIR + bind-mount target from /root/.mycelium
  to /home/mycelium/.mycelium

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sfph sfph requested a review from juliarvalenti as a code owner June 9, 2026 20:34
juliarvalenti
juliarvalenti previously approved these changes Jun 9, 2026
ruff format check failed on app/routes/rooms.py; OpenAPI snapshot was
stale after new routes were added without regenerating.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sfph sfph merged commit fe76e9d into main Jun 10, 2026
6 checks passed
@sfph sfph deleted the feat/room-sync-mas branch June 10, 2026 20:11
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.

2 participants