Skip to content

Make the factory tools explicit in coordinator mode: risk routing, PR watch for subagent PRs, release watch, version awareness #54

Closed

Description

@lx-0

Context

A long coordinator session (ytstack:coordinate, one v2 plan with ~250 rows, dozens of parallel lanes as subagents, ~40 PRs merged in one day) ran on a machine with ytstack 0.9.0 installed. Asked to apply the OpenAI "software factory" ideas, the coordinator first hand-built its own variants (a babysitter subagent, a home-made L/S/H review tiering, an ad-hoc release post-check) before noticing that 0.7–0.9 already ship them: risk routing (ytstack-risk, REVIEW.md, auto_merge, merge_by: risk), PR watch (0.8), ytstack-watch release, signals/incident, review-lessons (0.9). The capabilities exist; the usage is not explicit enough for an agent to pick them up unprompted.

Observed gaps

  1. coordinate does not point at the new tools. Its checklist names finish-lane and ytstack-watch, but not: run ytstack-risk floor/route before a merge, register every open PR with PR watch, run ytstack-watch release after a production release, route incidents through signals. A coordinator that merges itself (project rule: "the coordinator merges every PR once gates are met") never passes through finish-lane, so none of the risk routing applies.
  2. PR watch misses PRs opened by subagents. pr_watch=on and the worker are installed, yet ytstack-pr-watch status showed zero watches for the repository although ~40 PRs were opened there that day, all by subagents in .worktrees/<name>. Registration seems tied to the session that ran gh pr create; subagent PRs (and PRs reopened later) are not registered to the coordinating session. Coordinator mode needs "watch every open PR of this repo for me" (register --all-open or similar).
  3. No prompt when the risk gate is not configured. The repo has .ytstack/spec/ with 8 area files but no REVIEW.md, no auto_merge, no merge_by in PREFERENCES. Nothing told the agent that risk routing is therefore off; ytstack-upkeep / the SessionStart block could say "risk routing not configured: everything goes to a person".
  4. Version awareness after compaction. The compacted summary and earlier skill loads referenced the 0.7.0 cache path; the agent kept using 0.7.0 docs while 0.9.0 was installed. A SessionStart line "ytstack X.Y installed; new since your last load: …" (from CHANGELOG) would close that.
  5. Plans outside .ytstack/ are invisible to the frontier. The project's v2 plan lives in plans/*.md tables, so ytstack-frontier saw nothing and lanes were tracked by hand in LANES.md. adopt-brownfield/reconcile could detect a large external plan and offer the migration into milestones/slices (the project is doing that now by hand).

Suggested changes

  • coordinate: an explicit "Factory tools" step listing ytstack-risk route (per merge, also when the coordinator merges itself), PR watch registration of all open PRs, ytstack-watch release per production release, signals/incident, review-lessons after merges.
  • PR watch: coordinator registration for all open PRs of a repository, including subagent-opened ones.
  • Upkeep/SessionStart: warn when risk routing, PR watch or release config is absent although the project would use it; show "new in this version" once after an upgrade.
  • reconcile/adopt-brownfield: detect and offer migrating an external plan directory into milestone artifacts.

🤖 Generated with Claude Code

Activity

  1. lx-0 commented on Nov 14, 2026

    @lx-0
    MemberAuthor

    Addition: the setup guide has the same gap. README.md lists the tools well as a reference ("Coordinating many lanes" table, merge_by in "Dialing ceremony"), but QUICKSTART.md has no setup steps for them. A project that adopts ytstack (or upgrades from ≤0.6) gets no walkthrough for:

    • turning on risk routing: writing .ytstack/spec/REVIEW.md (lenses, own reviewers), auto_merge per area file, merge_by: risk, then verifying with ytstack-risk check / a dry route on a recent PR;
    • PR watch: ytstack-pr-watch enable + install-worker (incl. the asdf/mise shim caveat from 0.8.2), and how a coordinator registers PRs that subagents opened;
    • RUNTIME.md "Release" and "Signals" sections, so ytstack-watch release and signal-intake work;
    • ytstack-upkeep on a schedule.

    Suggestion: a "Setting up the factory tools" section in QUICKSTART (greenfield and brownfield/upgrade variants), plus an "upgrading from 0.x" checklist generated from the CHANGELOG. Field note for the README's "nothing has run against a real host yet": on 2026-11-14 a coordinator on a large repo dispatched two production releases with signed-image admission and per-release post-checks done by hand; those steps match what ytstack-watch release + RUNTIME "Release" are meant to automate, so it is a good first real-host candidate.

  2. lx-0 commented on Nov 14, 2026

    @lx-0
    MemberAuthor

    Field finding from the first real REVIEW.md setup (context-mcp #1715, ytstack 0.9.0): ytstack-risk route can never return unattended in a repo where agents may not write in the main checkout and a ruleset binds reviews to the head. The route reads the review round line from the plan file in the main checkout; committing that line on the PR branch moves the head, which invalidates both the round line (pinned to the old head) and any head-bound review the host requires (here a review-gate that counts only reviews on the current head). Every route therefore ends as person, fail-safe but defeating merge_by: risk. Suggestion: let route read the round from the host (the review itself: its commit_id, author and verdict line) instead of a file the PR must change, or keep round lines in a ref outside the PR branch (e.g. a notes ref).

  3. added a commit that references this issue on Nov 14, 2026
  4. lx-0 commented on Nov 14, 2026

    @lx-0
    MemberAuthor

    Field check with 0.9.1 on a long coordinator run: ytstack-pr-watch register --repo <repo> --all-open registered the 9 open PRs that subagents had opened (0 foreign), and the worker heartbeat was 77 s old. That closes the gap for this setup. One remaining wish: the coordinator only learns the registration result when it runs the command itself, so registering again after each subagent PR (or a hook on gh pr create inside subagents) would make it automatic.

    🤖 Generated with Claude Code

  5. lx-0 commented on Nov 14, 2026

    @lx-0
    MemberAuthor

    Clarification to my comment above: this coordinator session started before ytstack had the PR-watch hooks, so a missing auto-registration of subagent PRs here is the documented 'running sessions keep their hooks' case, not a defect. No hook change needed from this observation. The real test is the next coordinator session (started on 0.9.1): a subagent PR opened there should appear in ytstack-pr-watch status without --all-open. I will report that result here.

    🤖 Generated with Claude Code

  6. lx-0 commented on Nov 15, 2026

    @lx-0
    MemberAuthor

    Shipped in 0.9.1/0.9.2 (subagent PRs, session spelling) and 0.11.0 (M031, PR #66): coordinate Step 7 "Run the factory tools" incl. the risk route before every merge, one-step rotation with ytstack-pr-watch handover, ytstack-risk route --pr reads the round from the review on the host (the context-mcp #1715 case routes unattended), session-start notices for tools that are off and a version notice after a plugin update, QUICKSTART setup guide and upgrade checklist, bin/ytstack-plans with the external-plan question in reconcile/adopt-brownfield.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions