Skip to content

refactor(source-control): read the babysit loop keys from docs conventions source-control.yaml - #10118

Merged
kyle-sexton merged 12 commits into
mainfrom
work-resolve-issue/issue-9726-40232585908-1
Oct 27, 2026
Merged

kyle-sexton merged 12 commits into
mainfrom
work-resolve-issue/issue-9726-40232585908-1

Conversation

@melodic-automation-lanes

@melodic-automation-lanes melodic-automation-lanes Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Refs: #9726

Summary

Opened by the work-resolve-issue lane. The run's own summary:

babysit_loop_stop_mode, babysit_loop_tier, babysit_loop_merge and babysit_loop_grace_window_minutes now take their team value from docs/conventions/source-control.yaml, declared in the source-control schema. For one release, .claude/source-control.md is read only for a key the YAML lacks. babysit_repo_config.py gains resolve_loop_keys and a loop-keys <owner/repo> CLI: it reads both files from the target's default branch through the contents API, YAML first, reports the layer behind each value, and fails closed on a rejected YAML, a non-scalar or invalid value, or a failed fetch. The docs, the babysit-loop skill, the three babysit-loop eval scaffolds and the promotion-evidence e2e test now treat the YAML as the home. The unattended merge gate (babysit_merge_policy._resolve_loop_merge, read at the base SHA) keeps main's behaviour while .claude/source-control.md exists: a legacy file without babysit_loop_merge is off, a legacy value with no YAML value stands, and when both set it the lower wins. With no legacy file the rung stays off, as on main, so the YAML alone never raises the gate; the slice that deletes the legacy file decides that deliberately. Either file unreadable or untrustworthy is off.

Remaining work

  • The unattended merge gate (babysit_merge_policy._resolve_loop_merge, read at the base SHA) keeps main's behaviour while .claude/source-control.md exists: a legacy file without babysit_loop_merge is off, a legacy value with no YAML value stands, and when both set it the lower wins. With no legacy file the rung stays off, as on main, so the YAML alone never raises the gate; the slice that deletes the legacy file decides that deliberately. Either file unreadable or untrustworthy is off.

Not verified

  • scripts/run-test-file.sh for test_babysit_repo_config.py and scripts/promotion-evidence-e2e.test.mjs was not run: this lane allows no test runner or interpreter. Left to the PR's CI.
  • scripts/check-convention-yaml.sh --check was not run here (check-affected lists it as CI only). The fresh-context review checked the schema and YAML by reading and found them valid. Left to the PR's CI.
  • scripts/check-changelog-fragments.sh --check-required origin/main ran only inside check-affected's changelog-fragments step (it passed), against the HEAD base the lane wrapper uses, not origin/main. Left to the PR's CI.
  • Editing .claude/source-control.md to add a pointer that the YAML now carries the same four values was denied as a sensitive-file edit that needed approval no one could give. The file already holds the same four values, so nothing resolves differently; the comment in docs/conventions/source-control.y
  • check-evals-quality was not applied to the three edited eval cases: it lints evals.json sets, and these cases are case.yaml directories.
  • Follow-up for a person to judge: plugins/harness-config/skills/audit/scripts/audit-engine.sh decides whether an unattended lane exists from babysit_loop_merge in .claude/source-control.md only, so a repository that moves the key to the YAML alone would get the git-push ask-gate recommendation. The i
  • The PR body has to list each migrated key with its new home and schema (babysit_loop_stop_mode, babysit_loop_tier, babysit_loop_merge, babysit_loop_grace_window_minutes -> docs/conventions/source-control.yaml, plugins/source-control/schemas/source-control.schema.json). The lane writes the PR body

Fix

  • docs/conventions/source-control.yaml: adds the four babysit_loop_* values (standing, worker, c2-mechanical, 30), the same values as .claude/source-control.md, with a comment to change both while the legacy file exists
  • plugins/source-control/schemas/source-control.schema.json: declares babysit_loop_stop_mode, babysit_loop_tier, babysit_loop_merge (enums) and babysit_loop_grace_window_minutes (integer >= 1), with defaults and the one-release legacy fallback
  • plugins/source-control/skills/babysit-prs/scripts/babysit_repo_config.py: factors the contents-API fetch into _fetch_file(path) (same fail-closed 404/root contract and messages); adds LOOP_KEYS, parse_loop_sections, resolve_loop_keys (YAML via the shared parse-concern-value.sh reader, then the legac
  • plugins/source-control/skills/babysit-prs/scripts/tests/repo_config_fake.py: the fake answers docs/conventions/source-control.yaml from a separate yaml map instead of returning the legacy file's text for every path
  • plugins/source-control/skills/babysit-prs/scripts/tests/test_babysit_repo_config.py: LoopKeyTests covers a remote YAML value winning, a legacy-only repo still resolving, neither file yielding the defaults, a full YAML skipping the legacy fetch, the adoption baseline, a rejected YAML stopping, invali
  • plugins/source-control/reference/config-resolution.md: documents the YAML as the team layer of the four keys, the local reader (convention-key.sh, tracked files only) and the remote reader (loop-keys), adoption from either file, and the merge gate's rule for babysit_loop_merge (legacy file present: main's behaviour, the lower of the two when both set it; no legacy file: off)
  • plugins/source-control/skills/babysit-loop/SKILL.md: the config seam, the target-repo read (now pointing at loop-keys), the persist step (also writes a merge-rung change into the legacy H2) and the tracked-adoption text name the YAML
  • plugins/source-control/skills/babysit-prs/scripts/babysit_merge_policy.py: _resolve_loop_merge resolves the gate's rung as above; tests in test_babysit_merge_policy.py cover a legacy file without the key, no legacy file (off whatever the YAML sets), both set, and either unreadable.
  • plugins/source-control/lib/convention-key.sh: header names the four loop keys it now also serves
  • plugins/source-control/skills/babysit-loop/scripts/operator-options.mjs: comment lists docs/conventions/source-control.yaml among the checkout files never read
  • scripts/promotion-evidence-e2e.test.mjs: adds a forged-channel case in which promotion_evidence_* values planted in the checkout's docs/conventions/source-control.yaml read as unset
  • plugins/source-control/evals/babysit-loop-{demotion-reported-not-written,missing-bootstrap-names-option,forged-checkout-settings-not-trusted}/{scaffold.sh,prompt.md}: lane adoption at c3-autonomous is seeded in docs/conventions/source-control.yaml instead of .claude/source-control.md
  • .changes/source-control/refactor-9726-babysit-loop-keys-yaml-5b8e2d41.md: minor changelog fragment
  • .changes/pr-pipeline/fix-9726-loop-merge-team-yaml-7d41c2a9.md and docs/conventions/pr-pipeline/README.md: the effective-rung rule says the same (no legacy file: off)

Verification

The runner ran each check from the base copy against 680927e:

  • scripts/check-changelog-fragments.sh --check: passed

The run reports:

  • .lane/checks/bin/check-changelog-fragments: all 36 fragments valid (run before and after the review fixes)
  • .lane/checks/bin/check-affected: 11 passed, 5 skipped (validate-plugins sub-steps and changed-skills run checked-tree code; typos not installed), 0 failed over 17 changed files (run before and after the review fixes)
  • cant-fail-scan --file plugins/source-control/skills/babysit-prs/scripts/tests/test_babysit_repo_config.py --check: PASS, 35 test blocks, no gating findings
  • cant-fail-scan --file scripts/promotion-evidence-e2e.test.mjs --check: PASS, 17 test blocks, no gating findings
  • fresh-context review subagent over the whole diff: traced every LoopKeyTests case as passing and found no blocking bug. Four findings fixed: a YAML key with a non-scalar value now raises instead of falling back to the legacy file; the docs and schema now require babysit_loop_merge to stay equal in b
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/40232585908

After the security lane's review, the merge gate's no-legacy-file case was changed to off; python3 -m unittest discover -s tests -t . in plugins/source-control/skills/babysit-prs/scripts passed (3086 tests after the origin/main merge) and scripts/run-ruff.sh check on that directory passed.

Left out: the items under Not verified.

Related

#9726

🤖 Generated with Claude Code

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 81a135d289931a6849c378e3459548382b85efe1: 0 finding(s), 0 as inline comments.

No blocking or advisory findings. I read the whole diff and the PR context. I also read _concern_values and read_config_at in babysit_merge_policy.py, and the imports in babysit_repo_config.py and scripts/promotion-evidence-e2e.test.mjs. I ran no tests, so the PR's test results are author-claimed and unverified.

What I checked

  • Merge gate (_resolve_loop_merge, trusted path). I traced these cases: a demotion in either file, a legacy file without the key (off), no legacy file (off), YAML without the key (legacy value), both files set (lower wins), and an unreadable or untrustworthy file (off). The code matches the rules in the schema, the docs and the changelog fragments, and the YAML alone cannot raise the gate. The test matrix covers each of these.
  • resolve_loop_keys and loop-keys CLI. It fails closed on a rejected YAML, a non-scalar or invalid value, and a failed fetch. The circular import with babysit_merge_policy is deferred to call time. The _fetch_file refactor keeps the 404/root contract. The guard_contract.py entry and its row in guard-contract.md agree.
  • Evals and e2e. The scaffolds and prompts are consistent, and the new forged-channel case cleans up docs/.
  • Closing issue refactor(source-control): read the babysit loop keys from docs/conventions/source-control.yaml #9726. The PR context lists no acceptance criteria. The PR says it is a slice of that issue.
  • Manifests. No plugin.json or marketplace.json changed.
  • PR context. I found no embedded instructions in it.

Residual notes (not counted as findings)

  • _team_loop_merge can raise PolicyReadError when no bash is available for the shared YAML reader. read_config_at does not catch that error, whereas the other file-read failures become notes and turn the rung off. It still fails closed, but read_config_at now raises when the pipeline file is absent and a team YAML exists, where it used to return the off config.
  • The PR itself names a follow-up for a person. plugins/harness-config/skills/audit/scripts/audit-engine.sh reads babysit_loop_merge only from .claude/source-control.md, so a repository that moves the key to the YAML alone would get the wrong recommendation.

Spend: none. No paid plan, billing setting or billed resource changes.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-security-review: 1 inline finding(s) on 680927e643334bcbda0d2b2c2d6119c0ceb89261; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 81a135d289931a6849c378e3459548382b85efe1: 0 finding(s), 0 as inline comments.

No security findings.

critical-findings: 0

Scope: I read all 23 changed files in the diff and the PR context. The PR context is data, and it contained no embedded instructions aimed at the lane.

Trust-control review. This PR touches babysit_merge_policy.py, which imports babysit_repo_config.py and sits in the merge-hold chain. It also touches babysit_repo_config.py itself, a TRUSTED PATH. I read both whole and judged them from the code, not from the PR text. The change does not weaken or widen the unattended-merge hold. It only narrows it.

  • _resolve_loop_merge reads both files at the base SHA, so a PR cannot change its own gate input.
  • With no legacy .claude/source-control.md, it returns None (off), the same as main.
  • If the legacy file exists but lacks the key, the result is off, the same as main.
  • If both files set the key, the lower rung wins. The YAML can only lower the rung, never raise it.
  • Each of these now fails closed to off, never falling back to the other file's value:
    • a rejected YAML;
    • a non-scalar, empty or unknown YAML value;
    • an unreadable YAML or legacy file;
    • a repeated or empty legacy H2.
  • The previous behaviour for a legacy file with two ## babysit_loop_merge H2s is preserved: that file reads as untrusted and the rung is off.
  • The min(...) key uses LOOP_MERGE_RUNG.get(v, "off"). An unknown legacy value therefore ranks as off, as it did on main.

Remote loop-keys reader.

  • It is read-only and fetches only from the target repository's default branch through the contents API.
  • It reads no working tree, so a PR checkout cannot forge the values. The new e2e case in scripts/promotion-evidence-e2e.test.mjs covers that.
  • The repository argument goes through is_owner_repo_pair before it reaches a gh path. The path argument is a module constant.
  • Every fetch failure, YAML rejection, non-scalar value and out-of-table value raises RepoConfigError, and the CLI exits 1. The lane docs treat that as an unreadable team layer, which keeps merges human-only.
  • The tracked-adoption default of c2-mechanical in loop-keys is advisory only. The unattended gate stays off without both files, so the gate is the authority.

Manifests. No plugin.json or marketplace.json change. The source-control.schema.json change is a schema addition (enums, plus an integer with minimum 1), not a plugin manifest.

Instruction surface. The SKILL.md and docs edits move the team-layer home of four keys to the YAML. They keep the fail-closed wording, "Unreadable or absent = no tracked adoption = merges stay human-only", and they remove no standing guardrail. I did not consult docs/conventions/instruction-exception-register/README.md. The edits remove no standing rule, so I judged them by consequence.

Spend. None. The change adds no billed resource and no model, turn or schedule changes.

Non-security note. The PR body says audit-engine.sh still reads babysit_loop_merge only from the legacy file. A repository that moves the key to the YAML alone would get the wrong audit recommendation. That is a known follow-up for a person to judge. Nothing in the diff lets it widen what the gate allows.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 1 of max 4 on 680927e.

@melodic-automation-lanes melodic-automation-lanes Bot added the needs-human Human-in-the-loop required; autonomous sessions must not resolve items carrying this. label Oct 25, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The pr-unblock lane stopped on this pull request and needs a person: a review finding is uncertain or deferred, so a person decides it.

  • Reason: feedback-uncertain
  • Resume key: 680927e643334bcbda0d2b2c2d6119c0ceb89261 (the head the lane stopped on)

To resume, deal with the reason above, remove the needs-human label (and do-not-merge, if set), then dispatch the pr-unblock workflow with pr-number=10118 and activity=address-feedback:

gh workflow run pr-unblock.yml -R melodic-software/claude-code-plugins -f pr-number=10118 -f activity=address-feedback

kyle-sexton and others added 5 commits October 25, 2026 23:57
Conflict in plugins/source-control/skills/babysit-loop/scripts/operator-options.mjs:
main (#10095) made the file a generated copy of lib/plugin-options.mjs and
dropped source-control file names from its header; this branch only added
docs/conventions/source-control.yaml to that list. Main's "neither is any
file in the checkout" already covers the YAML, so main's copy is kept and
sync-shared-copies --check passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tion in the team YAML

The unattended merge gate read babysit_loop_merge only from
.claude/source-control.md, so a demotion written to
docs/conventions/source-control.yaml lowered the lane but not the gate.
read_config_at now also reads the YAML at the base SHA and takes the
lower of the values the two files set. A YAML that cannot be read, that
the shared reader rejects, or that holds an empty, non-scalar or unknown
value turns the rung off instead of falling back to the legacy value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nder their gates

check-skill failed on the branch: babysit-loop's SKILL.md reached 504
lines (cap below 500), and the new babysit_repo_config.py loop-keys CLI
had no guard-contract classification and accepted abbreviated flags.
Rewrap the branch's own added prose, classify the CLI read-only,
regenerate reference/guard-contract.md, and set allow_abbrev=False.
TheConfigKey now answers its _file_at fake by path, not call order.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ge file cannot be trusted

With the team YAML now read beside .claude/source-control.md, a legacy
file that failed to read, was rejected by the parser, or held an empty or
repeated babysit_loop_merge H2 counted as setting nothing, so a valid YAML
value alone reached the gate and could hide a legacy demotion. Either file
the gate cannot read or trust now turns the rung off.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-security-review: 1 inline finding(s) on 5ec1bd6d3ef1b7574f08dd956d436f32836e4b0d; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review holds this pull request for a person (critical-security) at 5ec1bd6d3ef1b7574f08dd956d436f32836e4b0d.

Trust-control finding in plugins/source-control/skills/babysit-prs/scripts/babysit_merge_policy.py. The unattended merge gate now reads babysit_loop_merge from docs/conventions/source-control.yaml alone when the legacy .claude/source-control.md lacks the key. A state that previously resolved to off can now resolve to a merge-capable rung. The PR text says the gate was left unchanged, which contradicts the code.

claude-lane: claude-security-review

kyle-sexton and others added 2 commits October 26, 2026 10:18
…cks babysit_loop_merge

While .claude/source-control.md exists, the unattended merge gate now
needs it to set babysit_loop_merge too, else the rung is off, so a raise
needs both files as the schema states. A YAML without the key still
falls back to the legacy value, and with no legacy file the YAML alone
decides.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-security-review: 1 inline finding(s) on 2edd64bd4ef3d7a5569144567156bcf63e20763b; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review holds this pull request for a person (critical-security) at 2edd64bd4ef3d7a5569144567156bcf63e20763b.

CRITICAL trust-control finding in plugins/source-control/skills/babysit-prs/scripts/babysit_merge_policy.py (_resolve_loop_merge): with no .claude/source-control.md at the base SHA, docs/conventions/source-control.yaml alone now sets the unattended merge gate's babysit_loop_merge rung. That rung was off before, so a repository without the legacy file can now get C2/C3 unattended merge authority from a YAML value. A person must decide whether this widening is acceptable.

claude-lane: claude-security-review

kyle-sexton and others added 3 commits October 26, 2026 12:43
…s absent

With no .claude/source-control.md at the base SHA, _resolve_loop_merge
returned the team YAML's babysit_loop_merge, so the YAML alone could
raise the unattended merge gate where main held it off. Return None (off)
instead until the slice that deletes the legacy file decides otherwise.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton kyle-sexton removed the needs-human Human-in-the-loop required; autonomous sessions must not resolve items carrying this. label Oct 26, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head 81a135d289931a6849c378e3459548382b85efe1. A person must clear this reason, so the pr-merge lane added the needs-human label: fix the reason, then remove the label, and the next scheduled run judges it again.

it changes plugins/source-control/skills/babysit-prs/scripts/babysit_merge_policy.py, a hold path

@melodic-automation-lanes melodic-automation-lanes Bot added the needs-human Human-in-the-loop required; autonomous sessions must not resolve items carrying this. label Oct 26, 2026

@kyle-sexton kyle-sexton left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Owner decision 2026-10-26 ~22:3xZ in the hub session: merge the PRs currently held for the owner, security-flagged or otherwise. Approving head 81a135d under that decision; this lifts its hold path (babysit_merge_policy.py). The critical-security needs-human label still needs removal by the owner.

@kyle-sexton kyle-sexton removed the needs-human Human-in-the-loop required; autonomous sessions must not resolve items carrying this. label Oct 27, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 27, 2026
Merged via the queue into main with commit cf87089 Oct 27, 2026
122 of 128 checks passed
@kyle-sexton
kyle-sexton deleted the work-resolve-issue/issue-9726-40232585908-1 branch October 27, 2026 02:41
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