Skip to content

DRILL (revert after): AlitaBot intentional startup failure for SRE-agent validation#298

Merged
Szer merged 1 commit into
mainfrom
test/sre-drill-alita-startup-failure
Jul 27, 2026
Merged

DRILL (revert after): AlitaBot intentional startup failure for SRE-agent validation#298
Szer merged 1 commit into
mainfrom
test/sre-drill-alita-startup-failure

Conversation

@Szer

@Szer Szer commented Jul 27, 2026

Copy link
Copy Markdown
Owner

THIS IS A DELIBERATE, OWNER-AUTHORIZED SRE VALIDATION DRILL — REVERT AS SOON AS THE DRILL COMPLETES

This PR intentionally breaks AlitaBot's production startup so the SRE agent (_sre-agent.yml) can be validated against a real deploy failure. Do not treat this as a normal change. After merge+observe, revert this single commit immediately (git revert <sha> — see below).

What this does

Adds a gated failwith in src/AlitaBot/Program.fs, right after builder.Build() (application startup, DI already resolved, before the host starts serving requests). The message contains the literal token SRE_DRILL_INTENTIONAL_STARTUP_FAILURE so it's trivially greppable in Loki.

  • Fails in application startup only — never touches migrations. Flyway runs and completes normally; the failure is a runtime throw in the app process after it starts.
  • Gated on not TestMode:
    • Verified live via mcp__alita-db__execute_sql: prod bot_setting.TEST_MODE = 'false'.
    • tests/AlitaBot.Tests sets TEST_MODE=true both as a container env var (ContainerTestBase.fs) and as a seeded bot_setting row (SeedDatabase), so the guard is false under test and the throw never fires there.
    • This means the drill reliably fires in prod and reliably no-ops under the hermetic test suite.
  • Single, trivially revertible commit touching exactly one file (src/AlitaBot/Program.fs, +19/-0 lines).
  • AlitaBot-only — does not touch src/BotInfra/, VahterBanBot, CouponHubBot, migrations, Helm, k8s, or workflows.
  • Compiles cleanly under TreatWarningsAsErrors — this is a runtime failure, not a compile error.

Verification

  • dotnet build -c Release (full solution): 0 Warnings, 0 Errors.
  • dotnet test (tests/AlitaBot.Tests, the hermetic PR gate, boots the real containerized app image with TEST_MODE=true): 125 Passed, 0 Failed, 0 Skipped. The guard confirmed inert under test as designed.

Revert command (run after the drill)

git revert <this-PR's-merge-or-squash-commit-sha>

🤖 Generated with Claude Code

https://claude.ai/code/session_01P41roCWN5Fec7m69sSaunU

…ent validation

Deliberate, owner-authorized production drill: throws
SRE_DRILL_INTENTIONAL_STARTUP_FAILURE during AlitaBot application startup
(after DI/host build, before serving) so the new ReplicaSet crashloops
while the previous pod keeps serving. Exercises the
_bot-deploy.yml -> verify-deploy.sh -> _sre-agent.yml path against a real
deploy failure. Gated on `not TestMode` — verified live that prod
bot_setting.TEST_MODE = 'false' and tests/AlitaBot.Tests sets TEST_MODE=true
(env var + seeded bot_setting row), so this fires in prod and never under
test. AlitaBot-only; no migration/config/Helm/workflow changes.

REVERT IMMEDIATELY AFTER THE DRILL via `git revert` of this commit.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P41roCWN5Fec7m69sSaunU
@Szer
Szer merged commit 6ab3c61 into main Jul 27, 2026
4 checks passed
@Szer
Szer deleted the test/sre-drill-alita-startup-failure branch July 27, 2026 09:48
Szer added a commit that referenced this pull request Jul 27, 2026
Szer added a commit that referenced this pull request Jul 27, 2026
…ent validation, take 2 (#303)

Deliberate, owner-authorized production drill, second in the series (see #298/#302 for
take 1 — a STARTUP failure that correctly did not trigger a rollback, since the old pod
kept serving). This one is different on purpose: startup and /healthz succeed normally, so
Kubernetes retires the old ReplicaSet and this broken one takes over — AlitaBot looks
healthy to Kubernetes while being functionally dead, which should push the SRE agent
toward a rollback this time.

Two failure points, both logging SRE_DRILL_RUNTIME_FAILURE at Error via the existing
Serilog logger, both gated on `not TestMode`:
- DrillRuntimeFailureLoop: a hosted BackgroundService ticking every 15s, throwing and
  logging Error on every tick — traffic-independent, so it fires within
  verify-deploy.sh's 2-minute Loki error-log window even though AlitaBot is dormant and
  can go days without an inbound Telegram update.
- The webhook update handler now throws before calling BotService.OnUpdate, so real
  Telegram updates fail too (secondary; the loop above is what actually gets detected).

Gate verified live: prod bot_setting.TEST_MODE = 'false'; tests/AlitaBot.Tests sets
TEST_MODE=true via both the container env var and a seeded bot_setting row
(ContainerTestBase.fs). AlitaBot-only; no migration/config/Helm/workflow changes.

REVERT IMMEDIATELY AFTER THE DRILL via `git revert` of this commit.


Claude-Session: https://claude.ai/code/session_01P41roCWN5Fec7m69sSaunU

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

1 participant