TSYS Group COO 9b4502f55d fix: critical bugs in agent identity provisioning [#442]
Email domain bug (would have caused all provisioning to fail):
- Cloudron email default was tsys-cloudron.knel.net (the dashboard host)
  instead of turnsys.com (the actual identity domain). Fixed in 3 places.
- Added explicit cloudron_email field to all agents in agents.yaml.example.

Other fixes:
- STATE_DIR.mkdir() moved from module level to main() so --dry-run and
  --help work outside the container.
- IndexError guard: password_inputs[0] crashes if zero fields found.
- State file save moved to finally block so partial results survive
  provisioning failures.
- Exception in provision_agent no longer re-raised (was preventing state
  file write and summary reporting).
- BW item_exists no longer swallows network/session errors as 'not found'
  (was causing duplicate credential creation).
- Redundant -u flag in bw generate (-uluns → -ulns).
- Dockerfile: npx install with || true → npm install -g (silent failure
  would cause runtime 'bw: command not found').
- Added .dockerignore to prevent .env/agents.yaml/state from entering image.

💘 Generated with Crush

Assisted-by: Crush:glm-5.2
2026-08-13 11:21:38 -05:00

Agent Identity Provisioning

Playwright-based automation for provisioning AI agent identities across the TSYS Group stack: Cloudron enrollment (with 2FA), SSO login, API key generation, and Bitwarden credential storage.

Overview

Each AI agent (VP TechOps, VP SecOps, etc.) gets:

  1. A dedicated Cloudron user (identity root — SSO provisions everywhere)
  2. TOTP 2FA enrolled and stored in Bitwarden
  3. API keys generated in Gitea, Discourse, Redmine (stored in Bitwarden)
  4. All credentials owned by the agent, sourced via bw-run.sh (no ~/.creds/ files)

See ~/Q3/agent-identity-bootstrap.md for the full architecture.

Usage

# 1. Create the manifest from the example
cp agents.yaml.example agents.yaml
# Edit: add Cloudron invite links for each agent

# 2. Set BW credentials
export BW_CLIENTID="..."
export BW_CLIENTSECRET="..."

# 3. Build and run
docker compose up --build

# Or run a single agent
docker compose run --rm provision --agent vp-techops

Manifest format

See agents.yaml.example. Each agent defines:

  • Cloudron invite link
  • Display name
  • Priority (Q3 vs Q4)
  • System scopes (Redmine projects, Gitea orgs, Discourse categories)
S
Description
Playwright-based automation for provisioning AI agent identities (Cloudron enrollment, SSO login, API key generation, Bitwarden storage)
Readme
274 KiB
Languages
Python 88.4%
Shell 10%
Makefile 0.9%
Dockerfile 0.7%