feat(babysit): open a revert pull request for a bad deploy #470
All Vouch review confidence checks passed
Residual risk 0.46 = Change Risk (0.75) × (1 − Review Confidence (0.39)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.75 · 640 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 43% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.387
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.075
Real PR Conversation Timeline
1 comments
"Review active on #470"
general
weight: 0.35
greptile-apps[bot]
Summary
A deploy that leaves the box unhealthy now gets a revert pull request as well as the revert issue. This is the piece of the rollback watch from #467 that was left as an issue only.
What changes
hands/lib/teeny_hands/babysit/rollback.py: after the revert issue, the babysitter builds one commit onmainwhose tree is the tree the box ran before the deploy (the deploy row'sfrom), on the branchteeny/revert-<n>-<sha>, pushes it and opens the pull request throughhands/gh(the guard, the secret scan, the gh ledger).commit-tree,update-ref) in the git directory of Teeny's own clone (state/self/brain.git), under theself-clonelock. The builder's working tree is never touched.origin/mainis still the deployed commit. Oncemainhas moved, putting the old tree back would drop what came after, so the issue stands alone.mainmoved, the deploy row has no previous commit, the deploy changed no file) is recorded once asdeploy_revert_pr_skipped. A push or an open that failed is tried again on the next run. A success isdeploy_revert_pr, once.deploy_badrow now keeps the commit the deploy came from (base).docs/mind.mdanddocs/hands.mdsay the same.What it does not do
The babysitter does not merge the revert. It touches the paths the bad deploy changed, which are held for 24 hours (
recently_rolled_back), so it waits for the operator like any other change to them. The box is already on last-good by then; deploys stay paused untilstate/spine-fallback.jsonis cleared.Tests
hands/tests/babysit/test_revert_pr.py(7 tests, against a local bare origin and the fake GitHub): the branch is one commit onmainwith the pre-deploy tree; opened once;mainmoved, no clone, and no previous commit each leave the issue only; a failed push is retried; the paths stay held.babysit.test_revert_pr,babysit.test_rollback,test_charterandtest_watcherspass on this branch (45 tests). The whole babysit directory (187 tests) passed on the branch these commits were cherry-picked from. The full hands suite was not run locally.<!-- greptile_comment -->
<!-- greptile_summary -->
<h2><a href="https://app.greptile.com/api/retrigger?id=115949307&sig=a2b85f29cbc5c52e893f9a5213bd09d1485f54c850c27f4360e283eebd4b7dc0"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img alt="Retrigger" src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2" align="right"></picture></a><a href="https://app.greptile.com/-/switch-tenant?tenant=teeny&next=%2Fteenydroid%2Fbrain%2Fpull%2F470&utm_source=greptile_review&utm_medium=github&utm_campaign=view_in_greptile"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img alt="View in Greptile" src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2" align="right"></picture></a>Confidence Score: 4/5</h2>
<!-- greptile-risk -->
Fix the retry path before merging so a temporary GitHub failure does not leave the revert unfinished.
<h2>Findings</h2>
1. <img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"> Revert retries get stuck <a href="https://github.com/teenydroid/brain/pull/470#discussion_r4659946899">▶</a>
<details><summary><h3>Summary</h3></summary>
The babysitter now opens a revert pull request for an unhealthy deploy when
mainstill points to that deploy.</details>
<!-- greptile_confidence_score:4 -->
<sub>Reviews (1) · Last reviewed commit: "docs: document automatic revert pull req..." · Reviewed by Greptile</sub>
<!-- /greptile_comment -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
New Features
When a deployment fails and the deployed commit is still on the main branch, rollback now opens a pull request to restore the previously deployed state.
The pull request is created once and held for operator review. If the main branch has moved on or required rollback information is unavailable, the existing rollback issue remains the only rollback artifact.
Temporary push or pull request failures can be retried.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->