DRILL 3 (revert after): AlitaBot runtime failure, disguised log text, for SRE-agent validation take 3#309
Merged
Conversation
… for SRE-agent validation take 3 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. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P41roCWN5Fec7m69sSaunU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The repo owner explicitly authorized taking AlitaBot down again: its only chat is with them, and this specific re-run is approved to validate the six detection-pipeline fixes from #307.
Why a third drill
Drill 2 (#303, reverted in #304) had the right mechanics — a runtime
BackgroundServiceticking every 15s plus a throwing update handler, gated onnot TestMode, startup/readiness succeeding so the new ReplicaSet takes over. It worked. But every emitted log line contained the literal tokenSRE_DRILL_RUNTIME_FAILUREand the words "deliberate ... drill ... must be reverted". The monitor agent read that text in the log payload itself and classified the resulting error burst as expected/attributed — filing nothing, while AlitaBot was completely dead. Six defects in the detection pipeline (verify-deploy.sh's blind window, the dormant carve-out overreaching to error series, change-correlation suppressing error-rate findings, missing per-group SourceContext in evidence, and the runtime DORMANT_NOTE contradicting the fixed rule) were found and fixed in #307.This drill re-tests those fixes. The whole point is that the monitor agent must not be able to shortcut by reading the word "drill" in the logs — so this time the runtime log text and exception messages are deliberately disguised as an ordinary application bug.
What it does
Same failure SHAPE as drill 2, gated on
not botConfOptions.Value.TestMode:PendingUsageFlushLoop(src/AlitaBot/Program.fs) — a hostedBackgroundService, registered only whennot TestMode, ticking every 15 seconds viaPeriodicTimer, throwing and loggingErroron every tick. Traffic-independent by design, same rationale as drill 2: AlitaBot is dormant and can go days with zero inbound Telegram updates, so a 15s tick guarantees several Error log lines insideverify-deploy.sh's Loki check window with no traffic required.src/AlitaBot/Program.fs, theWebhookHost.mapWebhookEndpointshandler) — throws before callingBotService.OnUpdate, so the bot is genuinely broken on answering real messages too (secondary; the loop above is what actually gets detected on a dormant bot).The disguise — what changed from drill 2 and why it's plausible
PendingUsageFlushLoopraises via an unguardedSeq.headon an empty sequence —System.ArgumentException: "The input sequence was empty. (Parameter 'source')"— logged as"Usage flush tick failed while flushing pending LLM usage records". This is a completely ordinary "forgot to check for the empty case before taking the head of a queue" bug shape in a periodic flush tick — nothing about it screams synthetic.string—System.NullReferenceException: "Object reference not set to an instance of an object."— caught by the existing, unmodified generic log line"Unhandled error in update handler for {UpdateId}". This is the single most common runtime exception in .NET; there is nothing to distinguish it from a real bug in the log stream.PendingUsageFlushLoop), nor any log message, nor either exception's message/type contains "drill", "SRE_DRILL", "intentional", or "revert" anywhere. Those words appear only in F# source comments above each throw site — never emitted at runtime, never shipped to Loki.Traceability (outside the logs)
Per the brief, this PR title, this body, the commit message, and the F# comments directly above each throw all state prominently and in capitals that this is a deliberate, owner-authorized drill that must be reverted immediately. Only the emitted log/exception text is disguised.
Gate verification
botConfOptions.Value.TestMode:bot_setting.TEST_MODE = 'false'(re-confirmed per the binding context in the brief; consistent with drill 2's live verification, unchanged since).tests/AlitaBot.Tests:ContainerTestBase.fssetsTEST_MODE=trueboth as the container env var (line 34) and as a seededbot_settingrow (line 87) — so the drill code never executes under the hermetic suite.Scope
AlitaBot only (
src/AlitaBot/Program.fs), single commit, 69 insertions, 0 deletions. Nosrc/BotInfra/, no other bot, no migrations, no Helm/k8s, no workflows.Validation
dotnet build -c Release(both the AlitaBot project and the full solution): clean, 0 warnings, 0 errors.dotnet test tests/AlitaBot.Tests -c Release(run individually, not solution-level): 125/125 passed, first attempt, no flake hit.dotnet testrun.ALITA_REAL_TESTS/COUPON_REAL_TESTSwere not set (confirmed viaenv | grepbefore the run).//comment line; zero occurrences on any non-comment added line (string literal, log call, or exception constructor).Revert
🤖 Generated with Claude Code
https://claude.ai/code/session_01P41roCWN5Fec7m69sSaunU