Skip to content

fix: project agents not discoverable in get_available_agents_dict#1783

Open
wgnrai wants to merge 1 commit into
agent0ai:mainfrom
wgnrai:fix/project-agent-discoverability
Open

fix: project agents not discoverable in get_available_agents_dict#1783
wgnrai wants to merge 1 commit into
agent0ai:mainfrom
wgnrai:fix/project-agent-discoverability

Conversation

@wgnrai

@wgnrai wgnrai commented Jul 23, 2026

Copy link
Copy Markdown

Bug

get_available_agents_dict(project_name) receives the project name but drops it before calling get_agents_dict(), so the project agent scan block (if project_name: at line 79) never executes. All project-level agent profiles under .a0proj/agents/ are invisible to call_subordinate at runtime.

The same bug exists in _normalize_subagents() in helpers/projects.pyproject_name is not forwarded to get_agents_dict(), and the function signature does not accept it.

Impact

  • call_subordinate profile validation cannot find project-scoped agents at runtime
  • The system prompt available profiles list omits all project agents
  • The WebUI project settings page cannot see project-level agents
  • Project-level agent overrides in agents.json have no effect because _normalize_subagents cannot resolve project agent names

Root cause

Both functions already accept project_name as a parameter (or have it available in their calling scope). get_agents_dict() already has the project scan logic. The argument is simply never forwarded.

# helpers/subagents.py:322
def get_available_agents_dict(project_name: str | None) -> dict[...]:
    all_agents = get_agents_dict()  # ← project_name not forwarded
# helpers/projects.py:664-669
def _normalize_subagents(subagents_data) -> dict[...]:
    # project_name not in signature, not forwarded
    agents_dict = subagents.get_agents_dict()

Fix

Two changes, 6 insertions / 5 deletions:

helpers/subagents.py — forward project_name:

-    all_agents = get_agents_dict()
+    all_agents = get_agents_dict(project_name)

helpers/projects.py — thread project_name through _normalize_subagents:

 def _normalize_subagents(
-    subagents_data: dict[str, SubAgentSettings]
+    subagents_data: dict[str, SubAgentSettings],
+    project_name: str,
 ) -> dict[str, SubAgentSettings]:
     from helpers import subagents
-    agents_dict = subagents.get_agents_dict()
+    agents_dict = subagents.get_agents_dict(project_name)

Both callers (load_project_subagents(name) and save_project_subagents(name, ...)) updated to pass name:

-    return _normalize_subagents(data)
+    return _normalize_subagents(data, name)
-    normalized = _normalize_subagents(subagents_data)
+    normalized = _normalize_subagents(subagents_data, name)

Safety

  • No new logic — the project scan block already exists and is tested
  • When project_name=None (no project context), behavior is identical to current (project scan skipped, same as now)
  • Default, plugin, and user agents follow the same discovery path, unaffected

get_available_agents_dict(project_name) receives the project name but
drops it before calling get_agents_dict(), so the project agent scan
block (if project_name:) never executes. All project-level agent
profiles under .a0proj/agents/ are invisible to call_subordinate.

Same bug in _normalize_subagents() in projects.py — project_name not
forwarded to get_agents_dict(), and the function signature doesn't
accept it.

Fix: forward project_name in both call sites. Thread project_name
through _normalize_subagents as a new parameter from both callers
(load_project_subagents and save_project_subagents).

@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: f1881540d1

ℹ️ 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 helpers/subagents.py
) -> dict[str, SubAgentListItem]:
# all available agents
all_agents = get_agents_dict()
all_agents = get_agents_dict(project_name)

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 Update helper DOX for project-scoped discovery

This behavior change makes get_available_agents_dict(project_name) include project-local agents, and the same commit also changes project subagent normalization to resolve through the project name, but the matching helpers/subagents.py.dox.md / helpers/projects.py.dox.md files were not updated. In this repo, helper behavior changes are supposed to keep the same-directory file-level DOX synchronized so future callers can rely on the documented cross-module contract.

AGENTS.md reference: helpers/AGENTS.md:L21-L23

Useful? React with 👍 / 👎.

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