Repository navigation
Description
Agent Brief
Type: Task
Summary: Move the state-lock wrapper and the shared arguments of the three guarded babysit worker CLIs into guarded_mutation.py (part of restructuring pass #14823).
Current behavior:
plugins/source-control/skills/babysit-prs/scripts/guarded_mutation.py:1-6 is the shared opening of manage_feedback_ledger.py, refresh_pr_branch.py and request_review.py, and all three import it (manage_feedback_ledger.py:27, refresh_pr_branch.py:37, request_review.py:37). Each still repeats:
run, 5 lines that resolve--state-dir, takestate_lockand call the module'srun_locked:manage_feedback_ledger.py:196-200,refresh_pr_branch.py:151-155,request_review.py:270-274. Only the return annotation differs.- the
--prand--expected-head-shaarguments, 9 identical lines:manage_feedback_ledger.py:242-250,refresh_pr_branch.py:351-359,request_review.py:505-513. - the
--state-dir,--lease-tokenand--applyarguments, 12 lines where only the--applyhelp text differs:manage_feedback_ledger.py:277-288,refresh_pr_branch.py:360-371,request_review.py:514-525.
Desired behavior:
guarded_mutation.pygainsrun_under_state_lock(args, run_locked),add_head_pin_arguments(parser)andadd_worker_arguments(parser, apply_help). It already importsargparseandstate_lock(:37,:43-48) and gainsresolve_state_dir,state_path_forandMIN_HEAD_SHA_PREFIX_LENGTH.- Each CLI's
maincalls the two argument helpers where its blocks sit now, so every script keeps its argument order. The ledger's order isaction, the head-pin pair, its own four flags, the worker trio, then--fix-round-cap(manage_feedback_ledger.py:233-297). - Each CLI's
runis replaced byrun_under_state_lock(args, run_locked), and imports left unused are dropped. - Each CLI keeps
run_lockedandmainunder their names:tests/test_babysit_merge.py:2066,2389callrefresh_pr_branch.run_locked,tests/test_request_review_policy.py:90,120callrequest_review.run_lockedandrequest_review.main(), andtests/guard_contract.py:726locates refusals atmanage_feedback_ledger.py::main. - None of the four files is a hold path. None is in
FLOOR_CLASSES(babysit_risk.py:320-360) or is afloor-pathsrow ofdocs/conventions/pr-pipeline.yaml, and no floored module imports them, so the floor's import closure thattests/test_merge_holds_sync.py:498-521checks does not change.
Files:
plugins/source-control/skills/babysit-prs/scripts/guarded_mutation.pyplugins/source-control/skills/babysit-prs/scripts/manage_feedback_ledger.pyplugins/source-control/skills/babysit-prs/scripts/refresh_pr_branch.pyplugins/source-control/skills/babysit-prs/scripts/request_review.py- a new
patchfragment in.changes/source-control/:### Changed, "Internal restructuring, no behavior change."
Key interfaces:
- Each CLI's
--helpoutput, arguments, JSON output, exit codes and error text: unchanged. - No test calls
runon these modules or patchesstate_lock,resolve_state_dir,state_path_fororMIN_HEAD_SHA_PREFIX_LENGTHon them.
Acceptance criteria:
-
run_under_state_lock,add_head_pin_argumentsandadd_worker_argumentsexist inguarded_mutation.py, and the three CLIs use them in place of their copies. -
python3 <script> --helpprints the same bytes before and after the change, for each of the three CLIs. - Behavior is unchanged: the same outputs, exit codes and printed results for the same inputs.
- No file is added to or removed from
FLOOR_CLASSESinbabysit_risk.py. -
plugins/source-control/skills/babysit-prs/scripts/tests/test_floor_paths.pyandtest_merge_holds_sync.pypass unchanged. - The diff edits only the listed files and the lines of a test that assert on them when the change breaks that assertion.
- The pull request stays within 400 changed lines and 15 hand-edited files.
-
scripts/run-ruff.sh checkpasses on the changed files. - The pytest suites
test_guarded_mutation.py,test_manage_feedback_ledger.py,test_request_review_policy.py,test_review_trigger_race.py,test_babysit_merge.pyandtest_guards.pyinbabysit-prs/scripts/tests/pass. - ci-status is green.
Out of scope:
- The
maintails (the ledger'sFlakeCapReachedbranch,manage_feedback_ledger.py:322-324), the--state-dirarguments ofmanage_babysit_lease.pyandpr_queue_snapshot.py, other duplication, eval cases, fixtures, and skill and agent text.
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Work status
needs-triage
Priority
low
Activity
melodic-automation-lanes commentedon Nov 12, 2026
{"v":1,"actor_id":337595936,"title_sha256":"b3d6381677e256df2c416c72edbe7925d54077bbec7f9aa022b6314ee466a6f7","body_sha256":"5d0d7499b43ea1e6af45d88d0093ad68b8b268d09b40bf7f09359f96fc2690dc"}
github-actions commentedon Nov 12, 2026