Skip to content

feat: coordinator stays on the path: stale-checkout hooks, loop hints, no PR closes, rotation (#82, #83) - #94

Merged
lx-0 merged 15 commits into
mainfrom
feat/82-83-coordinator-path
Nov 15, 2026
Merged

lx-0 merged 15 commits into
mainfrom
feat/82-83-coordinator-path

Conversation

@lx-0

@lx-0 lx-0 commented Nov 15, 2026

Copy link
Copy Markdown
Member

What changes

#82 -- a stale checkout and a reminder said forever

  • yt_behind_origin (lib): on the default branch behind origin/<default> (local refs only, never a fetch), SessionStart and Stop read pointer and Next action from git show origin/<default>:.ytstack/STATE.md and say "N commit(s) behind" with git merge --ff-only. The disk STATE lint waits while behind.
  • hooks/stop: the task reminder is said once per (session, pointer) (stop-said under the session home), never in a coordinate session, and a pointer whose last_updated is older than YT_POINTER_STALE_DAYS (3) days is new STATE lint W10 instead of a stop message. The behind message is said once per origin head, also in coordinate mode.
  • hooks/session-start: the Next action excerpt is no longer cut for the 10,000-char cap. The cap order after feat: coordinate mode: standing instructions and enforced operating path (#72-#76) #87 was standing->3, Next action cut, factory, minimal-code, closing, Next action regained, standing pointer. Now: standing->3, factory, minimal-code, closing, standing pointer, and last the using-ytstack body is cut at a line end with a pointer to its file. YT_BIN yields when the body was cut.
  • A manual handoff older than the newest automatic one is listed as "Older manual handoff", after the automatic one.

#83 -- the coordinator loop (coordinate mode only, hints, never denies)

  • hooks/pre-tool-use-agent (matcher now Agent|Task|SendMessage|Bash): an Agent dispatch that is no lookup and has no isolation -> isolation: "worktree"; Bash gh pr merge -> ytstack-finish-lane merge --at <reviewed head>; Bash gh pr close -> a cap waits (--status parked), CI reruns with gh run rerun.
  • hooks/pre-compact counts compactions beside the coordinate marker; SessionStart after a compaction says Compaction N of this coordinator: ytstack:coordinate Step 12, rotate now; from the second compaction Stop says it too, once per compaction.
  • hooks/post-tool-use-bash: gh run list --branch <default> (or -b) whose output shows a failed run (tab form, JSON conclusion, terminal X) -> one note to run ytstack:lesson, once per distinct failure set.
  • ytstack-frontier: new held status parked (PR waits open for a cap or a person); upkeep lists it as held, ytstack-status counts it in review.
  • ytstack-finish-lane gates --max-open: counts open PRs that are ready for review (drafts not counted); more than 100 open fails as unreadable.
  • coordinate 0.7.0: HARD-GATE sentence (never close, reopen-to-retrigger or delete the branch of a lane PR; a cap waits as parked; CI reruns with gh run rerun); Step 5 starts every round of the loop with ytstack-frontier check and acts on each stale: line (exit 2) before any new dispatch; Step 6 cap counts ready PRs, waiting lane is parked; Step 12 names the compaction line. Step 7 untouched.
  • finish-lane 0.7.0 (on top of feat: spec delta in briefs and finish-lane, plan-first briefs, reconcile task-plan skeletons (#75, #76) #88's 0.6.0): the same HARD-GATE sentence and the cap rule only.
  • Operating checklist (+2 lines): loop check, merge/close rule.

Coverage: all hints are Claude Code only; Codex runs only the PR watch on Bash and has no ytstack hook on its subagent tools, Kimi has no session id for the marker. The skill text carries the rules there (spec host-adapters, hooks-and-state, coordinator-format).

Decisions

DECISIONS 2026-11-15 "Hooks read a stale checkout from origin, say a reminder once per session and pointer, and keep a coordinator on its path with hints, not denies (issues #82, #83)": no fetch in hooks; once per pointer plus lint W10; Next action before the directive body in the budget; advisory hints, not denies (a close may be the person's wish); parked as a new held status.

Verification

  • bash tests/run-all.sh (macOS bash 3.2): ALL SUITES PASSED
  • bash tests/run-all.sh --linux from a git archive export: ALL SUITES PASSED
  • python3 bin/ytstack-check: OK (9 warnings, same as main)
  • bin/ytstack-spec lint: 0 failures, 0 warnings; bin/ytstack-spec drift: no area to look at
  • New/changed suites: git-ctx 181, hooks-stop 23, hooks-coordinate 72, hooks-readonly 100, hooks-standing 64, ytstack-finish-lane 186, ytstack-frontier 185, skill-preambles 737
  • Injection on this repository: 9,458 chars (startup), no body cut.

Codex review quota is exhausted; an independent review runs separately.

Closes #82
Closes #83

🤖 Generated with Claude Code

lx-0 and others added 7 commits November 15, 2026 19:53
…#83)

ytstack-frontier set <lane> --status parked holds a lane whose pull
request waits open, for a cap or a person; upkeep lists it as held and
ytstack-status counts it in review. The open-prs gate of
ytstack-finish-lane counts open pull requests that are not drafts and
fails when more than 100 are open.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…on its path (#82, #83)

#82: on the default branch behind origin/<default> (local refs, no
fetch) SessionStart and Stop read the pointer and Next action from
origin's STATE.md and say how far behind the checkout is
(yt_behind_origin). The Stop task reminder is said once per session and
pointer, never in a coordinate session, and a pointer older than
YT_POINTER_STALE_DAYS (3) days is STATE lint W10 instead. The Next
action is no longer cut for the 10,000-char cap: the using-ytstack body
yields last, with a pointer to its file. A manual handoff older than the
automatic one is listed as older.

#83, coordinate mode only, hints never denies: pre-tool-use-agent (now
also on Bash) on an Agent dispatch without isolation, on gh pr merge
and on gh pr close; pre-compact counts compactions beside the marker,
SessionStart says "Compaction N of this coordinator: ... rotate now",
Stop repeats it once per compaction from the second; post-tool-use-bash
notes ytstack:lesson when gh run list --branch <default> shows a
failed run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…uns ytstack-frontier check (#83)

coordinate 0.7.0 and finish-lane 0.6.0: a hard-gate sentence against
closing, reopening to retrigger or deleting the branch of a lane's pull
request (a cap waits as parked, a check reruns with gh run rerun); the
cap counts pull requests ready for review. coordinate Step 5 starts
every round of the loop with ytstack-frontier check and acts on each
stale: line (exit 2) before any new dispatch; Step 12 names the
compaction line. The operating checklist gets the loop check and the
merge/close rule; coordinator-format documents parked and the new hooks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The body cut stops at a line end and can leave room; the YT_BIN line
still does not take it, as issue #85 decided for the Next action.
Found by the Linux run (shorter temp paths).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts in DECISIONS, CHANGELOG and two spec areas kept both sides;
finish-lane goes to 0.7.0 on top of #88's 0.6.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T19:55:15.753556Z 5b52c68 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5b52c68f76

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread hooks/lib/git-ctx.sh
Comment on lines +723 to +724
n=$(git -C "$top" rev-list --count "HEAD..$r" 2>/dev/null)
case "$n" in ''|0|*[!0-9]*) return 0 ;; esac

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Do not treat a diverged default branch as only behind

When the local default branch has unpushed commits and origin/<default> also has commits absent locally, rev-list HEAD..$r is nonzero even though neither ref is an ancestor of the other. This classifies the diverged checkout as stale, causes SessionStart and Stop to substitute the remote STATE.md and suppress local lint/reminders, and recommends git merge --ff-only, which cannot succeed. Check that HEAD is an ancestor of the remote ref before enabling this behind-only behavior; otherwise report the divergence without replacing local state.

Useful? React with 👍 / 👎.

lx-0 and others added 8 commits November 15, 2026 21:47
…kip user scope (PR #94 review)

yt_behind_origin now needs a .ytstack inside the checkout whose STATE.md
origin has (user scope and an untracked STATE.md stay out entirely), and
hands out origin's copy only when HEAD is an ancestor of origin/<default>,
origin changed STATE.md since the merge base and the working tree's copy
is HEAD's. Diverged or edited with an origin change: SessionStart reads
the local file and says "N ahead, M behind", no --ff-only. Stop prunes
old session dirs that only hold stop-said when it makes a new one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…and repo; compactions counted anywhere (PR #94 review)

pre-tool-use-agent finds gh pr merge/close per line and segment, after
assignments, if/then, wrappers, env, xargs and gh -R/--repo, and ignores
quoted text and comments. post-tool-use-bash counts only the newest run
of each workflow and only origin's repository under --repo/-R.
pre-compact counts a coordinator's compaction before the .ytstack exit.
The status test keeps an in-review row beside the parked one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With closing a lane PR forbidden, an open-prs gate on merge deadlocks.
gates and merge drop --max-open; open-pr --max-open opens a draft at the
cap (drafts do not count) and says so. coordinate dispatches no new
implement lane at the cap; a parked PR leaves the count with
gh pr ready --undo and comes back with gh pr ready. The two new checklist
lines are shorter.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Kept both sides: the operating checklist has #93's line 6 and this
branch's lines as 7 and 8; DECISIONS with main's entries first; spec
lines combined. coordinate 0.7.2 and finish-lane 0.7.1, a patch above
both sides.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ields before them

With #93's checklist line a coordinate session near the cap lost its
standing list to the pointer line while the directive's tail stayed.
The order is now: ..., closing line, using-ytstack body (with a pointer
to the file), standing pointer last, as #74 decided. The Next action is
still never cut.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@lx-0
lx-0 merged commit 60b0472 into main Nov 15, 2026
4 checks passed
@lx-0
lx-0 deleted the feat/82-83-coordinator-path branch November 15, 2026 23:29
lx-0 added a commit that referenced this pull request Nov 16, 2026
* chore: move the gstack-derived skills' upstream baseline to v1.99.5.0

bin/ytstack-gstack-diff --stat reported office-hours, plan-ceo-review,
retro and ship behind v1.99.5.0. The upstream change only renames
/autoplan to /plan-eng-review in next-step recommendations and examples.
ytstack has no autoplan and already names ytstack:plan-eng-review, so
no method change is folded in; the baseline moves for all six skills
(plan-eng-review and document-release had no upstream change) and each
skill's metadata.version gets a patch bump.

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

* chore: release 0.12.0

Manifests (Claude Code, marketplace, Codex, Kimi), README badge and
status, QUICKSTART upgrade line from 0.11.x, CHANGELOG section 0.12.0
with a summary line and compare link. Covers PRs #77, #87-#94 (issues
#70, #72-#76, #78, #81-#86, #91).

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

* chore: spec areas: skills verified at the gstack v1.99.5.0 baseline; host-adapters verified at the 0.12.0 manifests

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

* chore: STATE and ROADMAP for 0.12.0: what shipped outside milestones, next action, open issues

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

* chore: KNOWLEDGE: eval record for release 0.12.0 (13 cases, all 1.00, $6.37)

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant