Skip to content

fix(agents): list agents in .agentignore'd folders as disabled - #987

Merged
runkids merged 1 commit into
mainfrom
runkids/agentignore-dir-rules
Nov 23, 2026
Merged

runkids merged 1 commit into
mainfrom
runkids/agentignore-dir-rules

Conversation

@runkids

@runkids runkids commented Nov 23, 2026

Copy link
Copy Markdown
Owner

Type

  • Bug fix
  • Small improvement (docs, typo, minor refactor)
  • Feature proposal (proposals/ only — see CONTRIBUTING.md)
  • Approved feature or large change (the linked issue has the approved label)

Linked Issue

No issue. Found while reviewing #980; listed under "Not in this PR" in #985.

What was wrong

.agentignore rules disable agents. A file rule such as solo.md keeps the agent visible as disabled. A folder rule such as archive/ made agent discovery skip the folder, so every agent inside it disappeared: list agents did not show archive/reviewer.md, and uninstall agents archive/reviewer said the agent was not found. Users could not see, enable, open or remove those agents, and the dashboard's .agentignore stats left them out. Skills already list agents in ignored folders as disabled.

Fix

  • AgentKind.Discover still skips ignored folders. Sync, diff, check, audit, status, doctor, bulk update and the dashboard counts behave exactly as on main. Agents have no marker file like SKILL.md. Walking ignored folders everywhere would turn excluded docs folders into agents and audit them.
  • The new AgentKind.DiscoverAll also walks ignored folders and marks their agents disabled, like DiscoverSourceSkillsAll for skills. It is used where users see or name an agent:
    • list agents, including the TUI and --json, and the dashboard agent list;
    • dashboard detail, single-agent audit, content and metadata edits, target assignment, and the single and batch toggles;
    • uninstall agents <name>, --group and update agents <name>;
    • the .agentignore stats and the sync ignore report.
  • Name lookup is shared in resource.FindAgent:
    • an exact flat name or path (with or without .md) wins, even when the agent is disabled;
    • otherwise a name match prefers an active agent;
    • two active agents with the same name still resolve to the first one, as on main.
  • uninstall agents --all skips disabled agents, as skills' --all does. main removed agents disabled by a file rule.

Behavior changes

  • list and the dashboard now show every .md file inside an ignored folder as a disabled agent, docs included. Nothing else picks them up.
  • uninstall agents reviewer with an active team/reviewer.md and a disabled archive/reviewer.md removes the active one. On main, the walk order decided which one went.
  • uninstall agents --all keeps agents disabled by a file rule.
  • update agents <name> also reaches agents in ignored folders. A plain name still updates every agent with that file name, as before, so update agents reviewer can now update a tracked archive/reviewer.md too.

Tests

Each fails on main and passes with the fix. The exception is the file-rule cases of the server get and list tests, which keep the existing behavior covered:

  • internal/resource:
    • TestAgentKind_Discover_RespectsAgentignore covers Discover and DiscoverAll.
    • TestFindAgent is a table of exact path, flat name and name matches.
  • internal/server:
    • get and list for agents run with a file rule and a folder rule;
    • single-agent audit of an agent in an ignored folder returns 200.
  • internal/sync: TestIgnoreReport_ListsAgentsInIgnoredFolders.
  • tests/integration:
    • list agents --json marks an agent in an ignored folder as disabled;
    • uninstall --all leaves disabled agents;
    • uninstall by name and --group reach ignored folders;
    • a plain name prefers the active agent;
    • update agents <path> resolves an agent in an ignored folder.

Checks

  • make check passes in the devcontainer.
  • End to end, comparing a binary built from main with this branch (.agentignore with demo/, docs/ and solo.md):
    • list agents adds demo/reviewer.md and docs/doc.md as disabled.
    • audit agents, check, sync --dry-run and update agents --all print the same output.
    • uninstall agents demo/reviewer works; on main it says not found.
    • update agents demo/reviewer.md no longer says "no matching agents found".

Not in this PR

  • In the list TUI, enabling an agent disabled by a folder rule flips the row to enabled while the rule still matches. skillshare enable reports "not disabled" in the same case. The same already happens with glob rules and for skills. A follow-up PR fixes the TUI and enable/disable for all of these cases.

Checklist

  • I've read CONTRIBUTING.md, including its AI-assisted contributions section
  • I've reviewed every line of the diff and can explain it
  • Tests included and passing (make check) — for code changes
  • No unrelated changes in the diff
  • Scope is focused — one concern per PR

An agent disabled by a file rule in .agentignore shows in list and the
dashboard as disabled, but agent discovery skipped every ignored folder,
so an agent under a folder rule such as `archive/` vanished. Users could
not see, enable, open or remove it, and the agentignore stats missed it.

Discovery keeps skipping ignored folders by default, so sync, diff,
check, audit, status and bulk update see exactly what they saw before.
Agents have no marker file, so walking those folders everywhere would
turn excluded docs into agents. A new DiscoverAll walks them and marks
their agents disabled, like DiscoverSourceSkillsAll for skills. List,
the dashboard, toggles, the ignore stats, and commands that name an
agent use it.

Name lookup moves to resource.FindAgent. An exact flat name or path
wins. Otherwise a plain name prefers an active agent, so `uninstall
agents reviewer` no longer removes a disabled archive copy first.
`uninstall agents --all` now skips disabled agents, as skills already do.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 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-23T02:59:23.983049Z be0edec 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.

@runkids
runkids merged commit bfcc392 into main Nov 23, 2026
10 checks passed
@runkids
runkids deleted the runkids/agentignore-dir-rules branch November 23, 2026 03:04
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