Skip to content

Detect and refresh stale scaffolded agents on upgrade - #43

Merged
ovhirup merged 4 commits into
mainfrom
issue-31-stale-agents
Nov 2, 2026
Merged

ovhirup merged 4 commits into
mainfrom
issue-31-stale-agents

Conversation

@ovhirup

@ovhirup ovhirup commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Fixes #31. Closes #32 and #33.

Problem

Re-running /stackwich:stackwich replaced the CLAUDE.md block but left the agents that an earlier release had scaffolded. Nothing flagged them. An advisor.md from before 3.3.0 has no Source: or Open questions: lines, which policy-rev 6 and later rely on, and tools/check_install.py still reported INSTALL: PASS for it.

Changes

  • tools/check_install.py compares each agent's body with assets/<role>.md, with any rename applied, and names the first line that differs. Changes to model: and name: in the frontmatter still pass, since the README invites model swaps.
  • tools/diagnose.py reports a Stackwich agent that differs from the current assets as Stackwich, stale and adds a problem line. Agent names are left out of the comparison, so collision renames still match. It still prints only names, never file contents.
  • SKILL.md step 3 treats an existing agent with the Stackwich credit as an earlier install, not a collision. If its body differs, the installer offers to replace it in place, keeping its name: and model:, and never overwrites without asking. Step 4 gains a matching check. Both steps sit outside the policy block, so policy-rev stays at 7.
  • evals/evals.json case 2 and docs/evals.md cover the new behavior.
  • Test fixture: scaffold() now applies a rename to references inside agent bodies, as SKILL step 3 already required. Before, it renamed only the name: line.

Verification

  • Tests were written first and failed before the fix: 4 errors.
  • cd tools && python3 -m unittest discover -v: 50 passed, up from 45, with none skipped.
  • cd measured && python3 -m unittest -v test_measured: 12 passed, and approve.py --self-check reports SOD: PASS.
  • Every structural check step of validate.yml, run locally, printed OK.
  • End-to-end test: a scope holding the advisor as it was before 3.3.0 (git show e632345^:…/advisor.md).
    • main's check_install.py reports INSTALL: PASS.
    • This branch reports FAIL: agent advisor — body differs from assets/advisor.md (stale or edited); first difference at line 25….
    • diagnose.py exits 1 and reports the advisor as stale.
    • After copying in the current asset, check_install.py reports INSTALL: PASS.

Not included


Generated by Claude Code

An upgrade replaced the CLAUDE.md block but left agents scaffolded by an
earlier release in place, and check_install passed them: an advisor from
before 3.3.0 has no Source/Open questions lines that policy-rev 6+ relies on.

- check_install compares each agent body with assets/<role>.md, renames
  applied, and names the first differing line. model: and name: stay free.
- diagnose reports Stackwich agents that differ from the assets as stale,
  ignoring agent names so collision renames still match.
- SKILL.md step 3 treats a credited agent as an earlier install and offers
  an in-place refresh, never a silent overwrite; step 4 checks it.
- evals case 2 and docs/evals.md cover the new behavior.

The policy block is unchanged; policy-rev stays 7.

Closes #32, #33.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TgCNfwCj3YG9xP3pMB6z2k
@chatgpt-codex-connector

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

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T08:02:25.513326Z dfc1348 Draft marked ready
ℹ️ 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: dfc13482e3

ℹ️ 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 tools/diagnose.py Resolved
diagnose.py normalizes agent names from a set(), so rename() built its
regex alternatives in hash order. With a collision rename that extends a
role name (executor -> executor-stackwich), `executor` could match the
start of `executor-stackwich` at the hyphen's word boundary, and a
correctly scaffolded install was reported stale under some PYTHONHASHSEED
values (0, 3, 5 among 0-5). Alternatives are now sorted longest first.

Tests: rename() with the prefix listed first, and diagnose under 8 hash
seeds with the extending rename.

Reported by the Codex review on #43.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TgCNfwCj3YG9xP3pMB6z2k
The release workflow publishes the 3.5.0 section as the release notes,
and it only described the policy-rev 8 changes. Stale-agent detection
(#31), the self-ignoring .stackwich/ (#34) and tools/validate.py (#35)
ship in the same release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TgCNfwCj3YG9xP3pMB6z2k
@ovhirup
ovhirup merged commit 3f1d987 into main Nov 2, 2026
2 checks passed
@ovhirup
ovhirup deleted the issue-31-stale-agents branch November 2, 2026 09:38
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.

Detect stale Stackwich agents in check_install and diagnose Upgrades leave stale scaffolded agents in place, and nothing detects it

2 participants