# V2 offline failure diagnosis and v3 correction

Status: `READY_NETWORK_PROBE_RETRY` after v3 verification only. No network probe was executed.

Preserved v2 failure: exact v2 command exited `3` with `FAIL_TELEGRAM_TRANSPORT: enabled Telegram configuration unavailable`. V2 code, operations, seal, and failure context remain untouched.

## Hypotheses reproduced offline

1. **`--profile` did not bind `HERMES_HOME` before configuration imports.** Disproved as the primary cause. In an isolated process using the exact v2 interpreter/import path, `get_hermes_home()` resolved `/home/cube/.hermes/profiles/dualcoachtest`.
2. **The wrong gateway configuration object/path was queried.** Partially confirmed. The exact profile's `platforms.telegram` object was found and `enabled == true`, but `GatewayConfig.platforms[TELEGRAM].token` was empty because `load_gateway_config()` reads the token from process environment and does not itself load the profile `.env`.
3. **The exact command used the wrong installed import context.** Disproved. The venv's `hermes-agent` installation is editable and bound by `direct_url.json` to `/home/cube/projects/richard/hermes-agent`; source imports resolved correctly.
4. **Credential-source mismatch.** Confirmed root cause. The exact profile's private `.env` contains a non-empty `TELEGRAM_BOT_TOKEN`, while the isolated v2 process had no `TELEGRAM_BOT_TOKEN` in `os.environ`. V2 loaded config but never read `.env`, so its generic “enabled configuration unavailable” check conflated enabled config with absent in-process credentials.

V3 does not use ambient `HERMES_HOME`, cwd, `gateway.config`, or global environment mutation. It securely reads exactly `<passed-profile>/config.yaml` and `<passed-profile>/.env`, requires Telegram enabled, binds username from `platforms.telegram.extra.adaptive_nutrition.separate_bot.bot_username`, binds bot ID from the configured token prefix, and validates both against `Bot.get_me`. The token field is excluded from representations and all output.

## Corrected exact command

```bash
/home/cube/projects/richard/hermes-agent/.venv/bin/python /home/cube/projects/richard/traning\ coach/.omo/evidence/task26/task26-telegram-network-probe-v3-e788f5d5/network_probe_v3.py --profile /home/cube/.hermes/profiles/dualcoachtest --timeout 10
```

Run only while the gateway is inactive. Continue only for exit `0` and JSON status `READY_TELEGRAM_TRANSPORT`, full successor `e788f5d56aef04da3097007e2ab79614f2060607d4331162169733b1208d9377`, exact profile path, config SHA-256 `f93106b16643227e2ef9dec67a5bbd497e1d353e779da62287898a087071af87`, configured username `dual_coach_pilot_test_bot`, and `bot_id_match: true`.

The gate calls only `Bot.get_me` with 5-second HTTP connect/read/write/pool limits and a 10-second total bound. It never calls `getUpdates`, starts polling, prints a token, mutates environment, consumes updates, changes cursors, writes profile state, starts a service, or starts the lifecycle observer. Bad Gateway, timeout, missing/disabled Telegram, missing credential, or either identity mismatch fails closed with exit `3`.
