fix(loops): record disabled_reason on auto-pause - #73420
Merged
Merged
Conversation
Contributor
|
Reviews (1): Last reviewed commit: "record disabled reason on loop auto-paus..." | Re-trigger Greptile |
|
🔀 Tried to auto-resolve conflicts with I won't retry until the branch or master moves. |
charlesvien
force-pushed
the
fix/loop-auto-pause-reason
branch
from
July 24, 2026 04:15
7b81a6a to
92cbea8
Compare
There was a problem hiding this comment.
Small, contained fix that records an existing disabled_reason field on two already-existing auto-pause paths; author owns the code with strong familiarity, tests cover both new and null cases, no unresolved concerns.
- Author wrote 100% of the modified lines and has 9 merged PRs in these paths (familiarity STRONG).
- 👍 on the PR from greptile-apps[bot], hex-security-app[bot].
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 19L, 1F substantive, 25L/2F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1b-small (25L, 2F, single-area, fix) |
| stamphog 2.0.0b3 | .stamphog/policy.yml @ c711851 · reviewed head 92cbea8 |
charlesvien
enabled auto-merge (squash)
July 24, 2026 04:18
charlesvien
disabled auto-merge
July 24, 2026 04:18
charlesvien
enabled auto-merge (squash)
July 24, 2026 04:18
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.
Problem
Loops auto-pause after 5 consecutive failed fires (including usage-gate blocks), but unlike the lifecycle pauses (owner deactivated, GitHub disconnected) the kill-switch leaves
disabled_reasonnull. A tripped loop reads asenabled=falsewith no recorded cause, so clients can't tell an auto-paused loop from one its owner paused, or say why it stopped.Changes
The kill-switch now records why it paused the loop:
disabled_reason="usage_limited"when the pause was tripped by the cloud usage gate infire_loop.disabled_reason="repeated_failures"when tripped by a failed run reaching the threshold inhandle_loop_run_terminal.Re-enabling already clears the field and resumes schedules via
facade/loops.py::update_loop, so recovery needs no changes. The field is already exposed byLoopSerializer; a companion desktop PR (PostHog/code#3779) renders the new values.How did you test this code?
Extended the existing auto-pause tests in
test_loop_runs.pyto assert the recorded reason on both pause paths, and the below-threshold tests to assert the field stays null (the regression caught: a pause that flipsenabledwithout recording a cause, or a reason written before the threshold). Rantest_loop_runs.py+test_loop_lifecycle.pylocally: 50 passed. Ruff lint and format clean.Automatic notifications
Docs update
N/A
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Authored with Claude Code (Fable 5). The session mapped the loops firing/kill-switch path and the existing lifecycle pause conventions, confirmed the usage gate and auto-pause already existed, and made the smallest change that lets clients render the pause cause: reuse the existing
disabled_reasonmechanism rather than adding a new status field or notification type. No repo skills were invoked.