Skip to content

DRILL 2 (revert after): AlitaBot intentional runtime failure for SRE-agent validation#303

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

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

Conversation

@Szer

@Szer Szer commented Jul 27, 2026

Copy link
Copy Markdown
Owner

⚠️ DELIBERATE, OWNER-AUTHORIZED SRE VALIDATION DRILL — TAKES ALITABOT DOWN IN PRODUCTION — MUST BE REVERTED AS SOON AS THE DRILL COMPLETES ⚠️

The repo owner explicitly authorized taking AlitaBot down: its only chat is with them, and this is needed to validate the SRE agent's rollback path.

Why a second drill

Drill 1 (#298, since reverted via #302) threw during startup. That crashlooped the new ReplicaSet while the old pod kept serving — a P2, no outage. The SRE agent correctly did not roll back. That means the rollback path is still unvalidated.

This drill is different on purpose: the pod starts successfully and passes readiness, so Kubernetes retires the old ReplicaSet and the new (broken) one takes over. AlitaBot will be genuinely non-functional in production while looking "healthy" to Kubernetes — the realistic failure mode that should push the SRE agent toward a rollback.

What it does

Two failure points, both gated on not TestMode, both logging the literal token SRE_DRILL_RUNTIME_FAILURE at Error level via the existing Serilog logger:

  1. DrillRuntimeFailureLoop (src/AlitaBot/Program.fs) — a hosted BackgroundService, registered only when not TestMode, ticking every 15 seconds, throwing and logging Error on every tick. This is traffic-independent by design: AlitaBot is dormant (its only chat is the owner's staging chat) and can go days with zero inbound Telegram updates, so a failure that only fires on inbound traffic could produce zero errors during verify-deploy.sh's 2-minute Loki check window and silently do nothing. A 15s tick guarantees several Error log lines inside any 2-minute window with no traffic required.
  2. Telegram update handling (src/AlitaBot/Program.fs, the WebhookHost.mapWebhookEndpoints handler) — now throws before calling BotService.OnUpdate, so the bot is genuinely broken on answering real messages too, not merely noisy in the background. This is secondary — the loop above is what actually triggers detection.

Gate verification

botConfOptions.Value.TestMode:

  • Prod: re-verified live via a single read-only SELECT * FROM bot_setting WHERE key = 'TEST_MODE'value = 'false'.
  • tests/AlitaBot.Tests: ContainerTestBase.fs sets TEST_MODE=true both as the container env var (line 34) and as a seeded bot_setting row (line 87) — so the drill code never executes under the hermetic suite.

Scope

AlitaBot only (src/AlitaBot/Program.fs, single commit). No src/BotInfra/, no other bot, no migrations, no Helm/k8s, no workflows.

Validation

  • dotnet build -c Release: clean, 0 warnings, 0 errors.
  • dotnet test tests/AlitaBot.Tests -c Release: 125/125 passed (project run individually, not solution-level). No ALITA_REAL_TESTS/COUPON_REAL_TESTS set.

Revert

git revert 77dbbd8

🤖 Generated with Claude Code

https://claude.ai/code/session_01P41roCWN5Fec7m69sSaunU

…ent validation, take 2

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.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P41roCWN5Fec7m69sSaunU
@Szer
Szer merged commit 6100a4b into main Jul 27, 2026
4 checks passed
@Szer
Szer deleted the test/sre-drill-alita-runtime-failure branch July 27, 2026 10:55
Szer added a commit that referenced this pull request Jul 27, 2026
…r SRE-agent validation, take 2 (#303)" (#304)

This reverts commit 6100a4b.
Szer added a commit that referenced this pull request Jul 27, 2026
… for SRE-agent validation take 3 (#309)

DELIBERATE, OWNER-AUTHORIZED SRE-AGENT VALIDATION DRILL. The owner explicitly
authorized taking AlitaBot down again: its only chat is with them, and this
re-run specifically validates the six detection-pipeline fixes from #307.

Same failure SHAPE as drill 2 (#303, reverted in #304): a hosted
BackgroundService (PendingUsageFlushLoop) ticking every 15s via PeriodicTimer,
logging Error on every tick, traffic-independent so it fires within
verify-deploy.sh's Loki window even though AlitaBot is dormant; plus a
throwing Telegram update handler so real messages also fail. Both gated on
`not TestMode`.

The one thing that's DIFFERENT on purpose: drill 2's every log line contained
the literal token SRE_DRILL_RUNTIME_FAILURE plus "deliberate"/"drill"/"must be
reverted" — the monitor agent read those words in the log text itself and
filed nothing while AlitaBot was completely dead. This drill's runtime log
text and exception messages are deliberately disguised as an ordinary
application bug instead:
- PendingUsageFlushLoop raises via an unguarded `Seq.head` on an empty
  sequence (System.ArgumentException: "The input sequence was empty."),
  logged as "Usage flush tick failed while flushing pending LLM usage
  records" — reads like a forgot-to-check-empty-queue bug in a usage-flush
  tick, not a drill.
- The webhook handler dereferences a null string (System.NullReferenceException:
  "Object reference not set to an instance of an object."), caught by the
  existing generic "Unhandled error in update handler for {UpdateId}" log —
  a completely ordinary NRE.
No "drill"/"SRE_DRILL"/"intentional"/"revert" appears in any string literal,
log message, or exception text — only in the F# source comments above each
throw site, which state prominently and in capitals (for future readers of
the diff/commit, not for Loki) that this is deliberate and must be reverted.

Gate verified: prod bot_setting.TEST_MODE = 'false' (per #307's binding
context); tests/AlitaBot.Tests sets TEST_MODE=true via both the container env
var and a seeded bot_setting row (ContainerTestBase.fs lines 34, 87), so the
drill code never executes under the hermetic suite. AlitaBot-only
(src/AlitaBot/Program.fs), single commit, no BotInfra/other-bot/migration/
Helm/k8s/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