Skip to content

Fix #31: bot_username populated, Powerful preset = Opus, document Vite tunnel quirk#36

Merged
obaid merged 1 commit into
mainfrom
fix/issue-31-minor-observations
May 22, 2026
Merged

Fix #31: bot_username populated, Powerful preset = Opus, document Vite tunnel quirk#36
obaid merged 1 commit into
mainfrom
fix/issue-31-minor-observations

Conversation

@obaid
Copy link
Copy Markdown
Contributor

@obaid obaid commented May 22, 2026

Summary

Three minor observations from the 5.19 E2E bundled into one PR per the ticket grouping.

Fixes #31.

a) bot_username is now populated after Telegram connect

TelegramConnectionController::store wrote the token + status but never called Telegram's getMe endpoint, leaving bot_username null on every row. The UI couldn't display "Connected as @scout_e2e_bot".

Now the controller calls https://api.telegram.org/bot{token}/getMe with a 10s timeout and stores the username from the response. Failures (network down, Telegram outage, invalid token) are caught, logged at warning, and the connect flow still succeeds — the row gets created with bot_username=null rather than the user seeing an error.

b) Powerful tier primary model is now Opus

The agent wizard's "Powerful" tier card reads:

🧠 Powerful — Best reasoning and creativity. Ideal for research, sales outreach, and strategy. ~$50/mo in AI costs

…but ModelTier::Powerful->primaryModel() returned claude-sonnet-4-6, with Opus only listed in the fallback chain. Sonnet is roughly $3/Mtok input vs Opus's $15/Mtok — the cost estimate and the copy implied Opus, but the actual config used Sonnet primary.

Fixed:

  • primaryModel() returns claude-opus-4-6
  • fallbackModels() returns ['claude-sonnet-4-6'] (was ['claude-opus-4-6', 'claude-sonnet-4-6'] — Opus listed in fallback when it was already primary candidate, and Sonnet listed redundantly)

c) Vite + herd share reload quirk documented in CONTRIBUTING.md

Two real failure modes when running composer run dev alongside herd share:

  1. First navigation to a fresh route can render blank because Vite's tunnel sometimes drops the first dynamic-import after long idle. Hard-reload fixes it.
  2. After a network blip both tunnels desync — the page HTML still references the old Vite tunnel hash. Symptom: pages stop rendering, Vite tunnel returns 404. Fix: npm run build once + rm public/hot so Herd serves static built assets directly.

These cost ~30 min of debugging time during the E2E session; documenting them so the next dev hits a cheaper learning curve.

Tests

6 new tests across two files. Plus inline Http::fake for the Telegram bot_username flow:

  • tests/Feature/Enums/ModelTierTest.php (4): Powerful tier primary = Opus, fallback chain has no duplicate, Efficient remains Haiku+Sonnet, Subscription is GPT-5.5 with ChatGPT auth.
  • tests/Feature/Agents/TelegramConnectionTest.php (2 new): bot_username populated from successful getMe, and the connect flow degrades gracefully when getMe fails (500 from Telegram).

Full suite:

php artisan test --compact tests/Feature tests/Unit
Tests:    106 skipped, 685 passed (2223 assertions)
Duration: 25.58s

Pint: clean.

Live E2E status

⚠️ Live E2E not run on this branch — plane wifi. Manual verification on stable internet:

  1. Create a fresh team + agent → choose "Powerful" tier in step 9 of the wizard
  2. php artisan tinker --execute='echo App\Models\Agent::latest()->first()->model_primary;' (or check via the UI's "Model" badge) → expect Opus, not Sonnet
  3. Connect Telegram to the agent → wait for the apply
  4. php artisan tinker --execute='echo App\Models\AgentTelegramConnection::latest()->first()->bot_username;' → expect the bot's @username, not null

Test plan

  • CI green
  • Live E2E on stable internet: Powerful tier produces Opus-primary agents
  • Live E2E on stable internet: Telegram connect populates bot_username

…e tunnel quirk

Three minor observations from the 5.19 E2E bundled into one PR per the
ticket grouping.

(a) AgentTelegramConnection.bot_username was null after a successful
    connection because TelegramConnectionController::store wrote
    bot_token but never called Telegram's getMe to capture username.
    Now resolves it via a 10s HTTP timeout, logs+swallows failures so
    a Telegram outage doesn't break the connect flow, and stores the
    @username for UI display ("Connected as @scout_e2e_bot").

(b) ModelTier::Powerful->primaryModel() returned 'claude-sonnet-4-6'
    despite the UX copy describing the tier as Opus ("Best reasoning
    and creativity", "~$50/mo"). Fixed to return Opus primary;
    fallback chain also de-duplicated to ['claude-sonnet-4-6'] (was
    ['claude-opus-4-6','claude-sonnet-4-6'] which was wrong on both
    sides — Opus was already primary candidate but listed in fallback
    and Sonnet was listed once redundantly).

(c) Documented the Vite + herd share tunnel quirk in CONTRIBUTING.md
    so the next developer running the E2E doesn't burn 30 min
    figuring out why their first navigation renders blank.

Tests: 6 new tests cover both the success and graceful-failure paths
of the bot_username lookup, and the Powerful / Efficient /
Subscription tier primary+fallback chains. Full suite: 685 passed,
106 skipped.

Fixes #31
@obaid obaid merged commit a6da83b into main May 22, 2026
1 of 2 checks passed
@obaid obaid deleted the fix/issue-31-minor-observations branch May 22, 2026 18:18
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.

Minor observations from 5.19 E2E: bot_username null, 'Powerful' preset → Sonnet, Vite tunnel first-load empties

1 participant