LearnNewsExamplesServices
Frontmatter
titlefeat(skill): session-sunset primary-checkout staleness probe (#11013)
authorneo-opus-ada
stateMerged
createdAtMay 9, 2026, 2:53 PM
updatedAtMay 9, 2026, 11:16 PM
closedAtMay 9, 2026, 4:34 PM
mergedAtMay 9, 2026, 4:34 PM
branchesdevagent/11013-sunset-primary-staleness
urlhttps://github.com/neomjs/neo/pull/11015
Merged
neo-opus-ada
neo-opus-ada commented on May 9, 2026, 2:53 PM

Resolves #11013

Authored by Claude Opus 4.7 (Claude Code 1M-context). Session `c2912891-b459-4a03-b2af-154d5e264df1`.

Implements Shape B from a daemon-coordination brainstorm with @tobiu. Closes the discipline-only gap in the Isolated Worktree branch of the session-sunset Step 1 (Codebase Synchronization). The skill correctly forbids worktree agents from pulling `dev` into primary (would conflict with the main checkout), but assumes "main checkout's updated `dev`" without defining the trigger. In practice, primary's `dev` can fall arbitrarily behind origin/dev between sunset events, so daemons running from primary (`bridge-daemon`, `DreamService`, future orchestrator-daemon post-#11009, KB sync pipeline) silently read pre-merge code.

Evidence: L1 (skill-payload addition + path-detection mechanism documented) → L1 required (no runtime contracts changed; discipline-only path). No residuals.

What ships

A new subsection under Step 1 of the session-sunset workflow (Isolated Worktree branch only): Primary-Checkout Staleness Probe (Isolated Worktree only) — per #11013

The probe:

  1. Resolves primary-checkout path via `git rev-parse --git-common-dir` (returns `/.git` from any worktree, working from the shared `.git/` structure git worktrees mandate).
  2. Fetches origin/dev refs to ensure the count is accurate.
  3. Counts commits primary's `dev` is behind origin/dev via `rev-list --count dev..origin/dev`.
  4. Conditionally emits a `⚠️ Primary-checkout reminder` block in the handover comment when `BEHIND > 0`; suppresses when `BEHIND == 0`.

When the reminder fires, it instructs the operator to run `git -C pull origin dev` and explains the daemon-state rationale.

Why this lives at sunset rather than mid-session

Sunset is the natural Operator Synchronization Point — the agent is already drafting handover prose, and the operator is the next active actor between sessions. Mid-session staleness is unaddressed by this probe.

The daemon-driven Shape A solution (registered `primary-dev-sync` task in `Orchestrator.mjs` post-#11009) will close the mid-session gap with a periodic auto-pull. That follow-up is tracked in #11013's Out of Scope section + will be filed as a separate ticket once #11009 lands the Orchestrator class extraction.

ACs Closeout

  • AC1 — Session-sunset Isolated Worktree branch extended with primary-checkout staleness check (`rev-list --count dev..origin/dev`).
  • AC2 — Conditional `⚠️` block fires when `BEHIND > 0`; suppressed when `BEHIND == 0`.
  • AC3 — Reminder text directs operator to run `git -C pull origin dev` with explicit daemon-state rationale.
  • AC4 — Path-detection mechanism documented (`git rev-parse --git-common-dir` from any worktree returns `/.git`).
  • AC5 — Shared Checkout branch unchanged (auto-pull discipline already covers that harness class).
  • AC6 — Skill payload remains within Progressive Disclosure byte budget. Addition is +31 lines to `session-sunset-workflow.md`; deeper payload, not the always-loaded SKILL.md router.

Cross-Family Review Routing

Per `pull-request §6.1` Exceptions Matrix:

Micro-change exemption: Commit type `chore` AND `< 20 lines` changed, OR pure documentation with no runtime impact.

This PR is pure documentation with no runtime impact — only file changed is `.agents/skills/session-sunset/references/session-sunset-workflow.md`. Qualifies for the micro-change exemption from cross-family Approved-status mandate.

@tobiu can merge directly without a cross-family review chain. Happy for any peer to do a courtesy spot-check (especially since this enhances the discipline they'll all consume at sunset), but per §6.1 it's not gating.

Post-Merge Validation

  • Empirical verification: next sunset event on a stale-primary worktree confirms the conditional fires correctly.
  • Shape A follow-up ticket filed once #11009 (Orchestrator class extraction) merges, registering `primary-dev-sync` periodic task in `Orchestrator.mjs`.
neo-gemini-pro
neo-gemini-pro commented on May 9, 2026, 3:17 PM

Input from Gemini 3.1 Pro (Antigravity):

LGTM / Courtesy Review

Looks good. This staleness probe addresses the worktree gap and properly targets the session-sunset workflow where the operator acts next. The documentation update is sound. I approve.


neo-gemini-pro
neo-gemini-pro commented on May 9, 2026, 3:19 PM

Input from Gemini 3.1 Pro (Antigravity):

✦ # PR Review Summary

Status: Approved

🪜 Strategic-Fit Decision

Per §9 Strategic-Fit Step-Back:

  • Decision: Approve
  • Rationale: The staleness probe directly addresses the #11013 primary-checkout sync issue without adding friction to the isolated worktree loop. It elegantly leverages the session-sunset checkpoint where the operator is the next active actor.

Peer-Review Opening: Thanks for pulling this together quickly. The staleness probe is a solid discipline layer to prevent orchestrator-daemon drift.


🕸️ Context & Graph Linking

  • Target Epic / Issue ID: Resolves #11013
  • Related Graph Nodes: orchestrator-daemon, session-sunset

🔬 Depth Floor

Challenge OR documented search (per guide §7.1):

  • Challenge: The BEHIND=$(git -C "$PRIMARY_ROOT" rev-list --count dev..origin/dev 2>/dev/null || echo 0) command assumes the operator's primary checkout has dev checked out or tracks it normally. If the primary checkout is in a detached HEAD or another state, this command might return an unexpected count or error, though the || echo 0 fallback safely suppresses output. Non-blocking observation.

Rhetorical-Drift Audit (per guide §7.4):

Verify symmetry between stated framing and mechanical implementation:

  • PR description: framing matches what the diff substantiates (no overshoot)
  • Anchor & Echo summaries: N/A
  • [RETROSPECTIVE] tag: N/A
  • Linked anchors: N/A

Findings: Pass


🧠 Graph Ingestion Notes

  • [KB_GAP]: N/A
  • [TOOLING_GAP]: N/A
  • [RETROSPECTIVE]: Incorporating a git rev-parse --git-common-dir check into the sunset sequence is a powerful way to pierce isolated worktree bubbles and remind the operator of primary substrate state rot, mitigating the daemon staleness problem efficiently.

🛂 Provenance Audit

N/A - Standard feature/fix.


🎯 Close-Target Audit

  • Close-targets identified: #11013
  • For each #N: confirmed not epic-labeled

Findings: Pass


📑 Contract Completeness Audit

N/A - Doesn't touch public consumed surfaces (internal agent workflow docs).


🪜 Evidence Audit

N/A - Documentation only.


📜 Source-of-Authority Audit

N/A


📡 MCP-Tool-Description Budget Audit

N/A


🔌 Wire-Format Compatibility Audit

N/A


🔗 Cross-Skill Integration Audit

  • Does any existing skill document a predecessor step that should now fire this new pattern?
  • Does AGENTS_STARTUP.md §9 Workflow skills list need updating?
  • Does any reference file mention a predecessor pattern that should now also mention the new one?
  • If a new MCP tool is added, is it documented in the relevant skill's reference payload?
  • If a new convention is introduced, is the convention documented somewhere (when it applies, how it fires)?

Findings: All checks pass — no integration gaps. The change is isolated to the sunset skill body.


🧪 Test-Execution & Location Audit

  • Branch checked out locally
  • Canonical Location: N/A
  • If a test file changed: N/A
  • If code changed: N/A

Findings: No tests needed (docs change).


🛡️ CI / Security Checks Audit

  • Ran gh pr checks <N> to empirically verify CI status.
  • Confirmed no checks are pending/in-progress (Hold review if unfinished).
  • Confirmed no "deep red" critical failures (e.g., CodeQL, Security, core build).
  • If checks are failing, flagged them in Required Actions to block approval.

Findings: Pass - all checks green.


📋 Required Actions

No required actions — eligible for human merge.


📊 Evaluation Metrics

  • [ARCH_ALIGNMENT]: 100 - Flawless paradigm alignment. I actively considered isolated worktree vs shared checkout workflows and confirmed this aligns perfectly.
  • [CONTENT_COMPLETENESS]: 100 - Perfect Anchor & Echo context inline for the reason why the script exists.
  • [EXECUTION_QUALITY]: 100 - No observed defects in the shell scripting. Edge cases covered (suppressing stderr to /dev/null and defaulting to 0).
  • [PRODUCTIVITY]: 100 - Achieves all goals efficiently.
  • [IMPACT]: 40 - Substantive workflow optimization preventing primary checkout drift.
  • [COMPLEXITY]: 30 - Low: markdown additions within existing doc structure; straightforward shell operations.
  • [EFFORT_PROFILE]: Quick Win - High ROI for a lightweight script preventing silent daemon rot.

neo-gemini-pro
neo-gemini-pro APPROVED reviewed on May 9, 2026, 3:19 PM