Skip to content

ci(claude): review infra + conventions + subagent overhaul + agent-builder tooling - #783

Merged
kovtcharov merged 19 commits into
mainfrom
kalin/fix-claude-auto-review
Apr 17, 2026
Merged

kovtcharov merged 19 commits into
mainfrom
kalin/fix-claude-auto-review

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Apr 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Takes the "Claude helps with GAIA work" loop from flaky-and-undocumented to reliable-and-opinionated. Four threads, each shippable alone but clustered in the same files.

  • CI review infra — fix fork-PR failure, re-reviews on push, wire up release-notes, upgrade to claude-opus-4-7, drop fallback_model, ground pr-review prompt in CLAUDE.md + GAIA architecture checks. Contributors get consistent reviews that catch GAIA-specific issues; no silent model downgrades hiding regressions.
  • Project conventions — CLAUDE.md accuracy pass; new rules: No Silent Fallbacks, Commit Only When Bulletproof, No Claude Attribution, PR Description Style. Claude + humans share one ground truth; silent fallbacks stop hiding real bugs; Claude can ship small fixes without a ping for every typo.
  • All 23 subagents overhauled — standardised When-to-use sections, corrected tool allowlists, propagated No Silent Fallbacks, fixed gaia-agent-builder.md factual errors (AGENT_ID etc. aren't required on concrete agents). Subagents had drifted and were giving Claude bad advice.
  • Agent-builder tooling — docs/sdk/patterns.mdx (patterns + anti-patterns), schemas/agent-manifest.schema.json (editor autocomplete from Pydantic model), util/lint.py --agents convention linter, BuilderAgent.create_agent composes any KNOWN_TOOLS mixin via new tools param (+6 tests, 116 pass). Building a new agent used to need 5 files + grep; now one patterns page, a schema, and a linter carry the load — replaces what would have been a much heavier MCP server.

Test plan

  • Test PR → Claude review within ~1m on claude-opus-4-7, no Unsupported event type
  • Rate-limit Opus → job errors (not a silent Sonnet review)
  • v* tag → release-notes runs after Publish Release
  • pytest tests/unit/agents/test_builder_agent.py tests/unit/agents/test_registry.py → 116 pass
  • python util/lint.py --agents → PASS
  • python util/gen_manifest_schema.py --check → OK
  • gaia chat --ui → "+" → agent with rag + file_search generates class FooAgent(Agent, RAGToolsMixin, FileSearchToolsMixin)

Fix triggers so Claude actually reviews every PR:
- Add workflow_run trigger for "Publish Release" so the release-notes
  job (which was dead code — its if-condition could never be true) can
  fire on v* tag pushes
- Add synchronize + reopened to pull_request_target types so re-pushes
  to an existing PR trigger a re-review; the concurrency group already
  cancels in-progress runs so rapid pushes only review the latest
- Document in header that pull_request_target uses the workflow file
  from the base branch, so edits here only take effect once on main

Improve the pr-review custom_instructions:
- Add explicit read-step for CLAUDE.md and the PR title/description
  (via gh pr view) so reviews anchor on project conventions + author
  intent, not just the diff
- Add a new "GAIA-Specific Architecture Checks" section covering the
  registry.py KNOWN_TOOLS pattern, llm/providers registration in
  factory.py, Lemonade client reuse for AMD paths, CLI + docs/reference
  parity, and apps/ + setup.py console_scripts
- Tighten Code Quality checks with specific file refs (agent.py,
  tools.py, errors.py, console.py) so suggestions point to concrete
  patterns, not abstract "existing agents"
- Expand Testing section with the real fixture names
  (mock_lemonade_client, require_lemonade) and test directory layout
- Expand Documentation section with docs.json navigation requirement
  and Mintlify MDX convention note
- Add conventional commit taxonomy hint to Commit Quality
- Preserve all original guidance: severity emojis, security escalation
  protocol, copyright/SPDX exclusions, suggestion-block policy, output
  format, 6-check doc quality matrix

Enable the superpowers plugin in .claude/settings.json alongside the
existing frontend-design plugin, so contributors get Claude's TDD /
systematic-debugging / verification-before-completion skills on first
trusted open of the repo.
Deep review of CLAUDE.md against actual repo state:

Project Structure — add missing entries contributors have been adding
over the last few milestones:
- agents/builder/, agents/summarize/, agents/tools/, agents/registry.py
- src/gaia/sd/, src/gaia/vlm/, src/gaia/img/
- apps/_shared/, apps/example/

Agent Implementations table — add BuilderAgent and SummarizeAgent rows
to match what ships in src/gaia/agents/.

CLI Commands — previous list was ~50% complete. Now grouped by purpose
(agents, servers, setup, evaluation, standalone binaries) and lists
every top-level gaia subparser from cli.py, plus a Console Script
Entry Points table clarifying gaia vs gaia-cli vs gaia-mcp vs gaia-code
vs gaia-emr (people confuse `gaia-code` with `gaia code` — they are
different things).

Agent Registry & Tool Mixins — new section documenting the
KNOWN_TOOLS map in src/gaia/agents/registry.py and the 7 reusable
mixins (rag, file_search, file_io, shell, screenshot, sd, vlm) so new
agents reach for existing mixins before reimplementing.

Removed stale content:
- nsis-installer agent reference (agent doesn't exist in .claude/agents/)
- Learned Skills section pointing to .claude/skills/gaia-eval-benchmark.md
  (directory doesn't exist)

Added Claude Code Plugins section documenting the two plugins
configured in .claude/settings.json (frontend-design, superpowers) and
telling future Claude sessions to reach for Superpowers skills
(brainstorming, writing-plans, TDD, systematic-debugging,
verification-before-completion) when a task fits.

docs/reference/dev.mdx — add Step 6 "Claude Code Plugins (Optional)"
explaining the one-click first-run install prompt (Claude Code won't
auto-install silently; contributor accepts once), the >=2.1.0 version
requirement, /plugin list verification, and the .claude/settings.local.json
opt-out path.
@github-actions github-actions Bot added documentation Documentation changes devops DevOps/infrastructure changes labels Apr 16, 2026
…r parity

Critique pass on the pr-review prompt — remove duplication, fix one
inaccurate path reference, extend the CLAUDE.md-read discipline to
the other two jobs.

pr-review custom_instructions:
- Merge "do not list copyright headers as a strength" into the DO NOT
  flag block — was duplicated in both the exclusion list AND the
  Strengths section output guidance
- Drop "exception handling patterns" from the Always-suggest list —
  Section 1 Error Handling already covers bare-except detection and
  asks for the correct pattern; two copies was noise
- Fix breaking-change reference: was `src/gaia/chat/AgentSDK` which
  looks like a path but isn't — correct to `src/gaia/chat/sdk.py`
  (`AgentSDK`) matching the real file at line 54 of that module

pr-comment custom_instructions:
- Add `CLAUDE.md` to FIRST ACTIONS read list (step 3) so PR
  conversation replies anchor on GAIA conventions, not just the diff
- Add explicit "if you can't determine something, say so — don't
  guess" line matching the pr-review prompt

issue-handler custom_instructions:
- Same `CLAUDE.md`-first read rule (covers both PR and issue paths)
- Add `gh issue list --search` hint for duplicate check
- Fix stale `.md` → `.mdx` references in the docs lookup table
  (setup, quickstart, guides/chat, guides/talk, guides/code,
  reference/cli, reference/features, sdk/core/agent-system,
  reference/faq) — the docs moved to MDX in the Mintlify migration
  and the old paths were broken links
- Same "don't guess" discipline line
The Suggested Changes Policy already opens with "Maximize use of
actionable suggestion blocks — these provide immediate value to
contributors" at the top of the section. Repeating the same rule in
the Writing Style trailer added no new guidance and just spent tokens
every review.
Bumps all four claude-code-action steps (pr-review, pr-comment,
issue-handler, release-notes) from claude-opus-4-5-20251101 (now
Legacy per Anthropic's model list) to claude-opus-4-7.

Why 4.7 now:
- Same pricing as 4.5 ($5/$25 per MTok input/output), no cost impact
- 1M-token context window (vs 200k on 4.5) — safely handles large
  PRs and diffs without hitting prepare-step token limits
- Documented step-change improvement in agentic coding vs 4.6
- Uses the undated alias convention Anthropic adopted for 4.6/4.7
  (older models like 4.5 still pin the dated snapshot)

Source: https://platform.claude.com/docs/en/about-claude/models/overview
Two robustness fixes caught on a fourth-pass critique:

1. fallback_model: claude-sonnet-4-6 on all four jobs (pr-review,
   pr-comment, issue-handler, release-notes). If Opus 4.7 is
   overloaded or has an API error, the action silently uses Sonnet
   4.6 instead of failing. Combined with the existing
   continue-on-error: true this means reviews still land during
   model-specific outages — we don't want every Opus hiccup to
   silently kill all auto-review.

2. pr-review direct_prompt now reinforces the structured workflow.
   The single-line version ("Review this pull request. Read
   pr-diff.txt and pr-files.txt first, then review the changes.")
   didn't mention CLAUDE.md, the PR description, or the 4-part
   output structure — those were only in custom_instructions. Since
   direct_prompt is the initiating user turn, making it point at
   the full sequence (read diff + files + CLAUDE.md + PR view →
   post Summary/Issues/Strengths/Verdict) reduces the chance
   Claude produces an unstructured drive-by comment on simple PRs.
@kovtcharov kovtcharov changed the title ci(claude): fix PR auto-review + improve review prompt + CLAUDE.md accuracy pass ci(claude): fix auto-review + CLAUDE.md accuracy + agent-builder tooling Apr 17, 2026
kovtcharov and others added 8 commits April 16, 2026 22:20
…cks" rule

Per user direction, rip out the fallback_model: claude-sonnet-4-6
additions on all four claude.yml jobs (pr-review, pr-comment,
issue-handler, release-notes). If Opus 4.7 is unavailable, the right
behavior is a clear failure message, not a silent downgrade that
produces worse reviews for weeks before anyone notices.

Codify the rule in CLAUDE.md under Development Standards as a new
"No Silent Fallbacks — Fail Loudly" section covering:

- The prohibition: no fallbacks, default-to-something-that-works-ish,
  or silent degradation across every layer (agents, LLM clients, CLI,
  CI, config loaders, RAG, API server, Electron apps)
- What "fail" means: specific error naming what failed and what the
  caller should do — not substituting a different model / cached
  result / placeholder / empty list
- What's prohibited: bare except, try/except/return None, model-level
  fallback_model glue, provider-switching on error
- Why: fallbacks hide regressions — a review bot silently downgraded
  from Opus to Sonnet looks fine but degrades for weeks before anyone
  notices; a config loader that defaults to "" produces confusing
  401s deep in the pipeline instead of "ANTHROPIC_API_KEY not set"
  at startup
- Shape of actionable errors: name of failed resource + what to do +
  where to look next
…or handling

The first version of this section, read literally, forbade all error
handling — a strict reader could conclude that
`try/except ValueError as e: raise GaiaError(...) from e` was banned.
That's the exact fail-loudly pattern we want, not the anti-pattern.

Split the section into three explicit buckets so the rule is
readable and applicable without a lawyer:

1. Prohibited: except-pass, fallback_model, default-to-empty config
   loaders, retry loops that swallow the final failure.
2. Allowed: catch-and-re-raise-with-context, boundary translation
   (REST → HTTP 500 with correlation id), explicit opt-in retries
   that the caller asked for.
3. Actionable errors name three things: what failed, what to do,
   where to look next — with concrete Lemonade/ANTHROPIC_API_KEY
   examples.

Same rule, tighter wording, no ambiguity that sensible error
handling is still expected.
…curacy

Rewrite every file under .claude/agents/ to a single consistent shape:
frontmatter -> identity -> When to use -> When NOT to use -> key files ->
workflow/patterns -> common pitfalls.

Key improvements:
- Sharp "When NOT to use" blocks in every agent to prevent overlap
  (python-developer vs gaia-agent-builder, release-manager vs
  github-actions-specialist, rag-specialist vs blender-specialist, etc.)
- Every file path verified against the current repo (91 paths checked;
  1 stale reference 'publish_installer.yml' caught and corrected).
- Propagate the new "No Silent Fallbacks" rule (CLAUDE.md) into
  code-reviewer, python-developer, sdk-architect, gaia-agent-builder,
  cli-developer, rag-specialist, typescript-developer.
- Fix stale facts: release-manager (no more gaia-pirate/release.py),
  cli-developer (correct gaia-code entry point), rag-specialist (no
  fictional 'gaia rag' CLI), copyright year -> 2025-2026.
- Tighter, GAIA-anchored content for prompt-engineer, ui-ux-designer,
  architecture-reviewer, test-engineer.
- Accurate CLI subcommand and workflow inventories grounded in current
  src/gaia/cli.py and .github/workflows/.

Net: 2,636 lines removed, 1,926 added (more signal, less fluff).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Three concrete code/config references I put in the rule were wrong —
caught on a critique pass that actually grepped the codebase instead
of trusting my working memory:

- `ChatSDK(max_retries=3)` — class is called `AgentSDK` (formerly
  ChatSDK per the rename recorded earlier in this file), and
  max_retries is not a constructor param on AgentSDK. The real
  opt-in retry parameter lives on ClaudeClient in
  src/gaia/eval/claude.py — use that as the example and link to the
  file so it stays verifiable. (Fixed in the previous commit.)

- `GaiaError` — not a real class in the codebase. Replaced with a
  generic `ValueError` + `raise ... from e` pattern, which is the
  actual pattern to promote. Added the `from e` note explicitly so
  readers know preserving the original traceback matters.

- `GAIA_LEMONADE_URL` — the real env var is `LEMONADE_BASE_URL`
  (see src/gaia/cli.py and src/gaia/llm/lemonade_client.py — used
  10+ places). A rule that teaches people to set a non-existent
  variable is worse than no example.

Rule now grep-clean: every concrete identifier in the "No Silent
Fallbacks" section maps to a real symbol in src/gaia/.
Round-8 critique caught this by actually fetching the Claude Code
plugins-reference docs instead of trusting memory. There is no
/plugin list slash command — the documented ways to list installed
plugins are:

  - `claude plugin list` — shell CLI (formal, scriptable)
  - `/plugin` — inside a session, opens an interactive plugin menu

Step 6 previously told contributors to type `/plugin list`, which
would either do nothing or be interpreted as an argument to the
interactive menu. Replaced with both documented options (CLI for
scripting, interactive for humans) and a clear note on when each
applies.

Source: https://code.claude.com/docs/en/plugins-reference
…o Silent Fallbacks rule

Round-9 audit: grepped the codebase against the new rule and found
~20 except-Exception-pass blocks, mostly in src/gaia/ui/. Some are
the explicit anti-pattern (ui/routers/system.py:91 silently
defaulting a URL, ui/_chat_helpers.py:1283 swallowing stats
errors); a few are legitimate (ui/document_monitor.py:131 logs and
continues in a long-running monitor loop — exactly the "allowed"
pattern).

Without a migration note, contributors could read the rule two
wrong ways: (a) "the whole UI layer is broken, the rule is
unrealistic" or (b) "existing violations make this pattern okay —
I'll add another one." Both are wrong.

Add a tight paragraph stating: pre-existing violations are tech
debt to fix when you next touch the file, not precedent to cite
when adding new ones. Keeps the rule usable without blessing
legacy anti-patterns.
…rve-out)

Walk back the removal of continue-on-error: true I was about to push.
Per kalin's call: the existing continue-on-error: true on all three
claude-code-action@beta steps is valid — fork PRs emit non-fatal
permission warnings from the action that would otherwise turn the
check red despite the review posting fine.

The important distinction the "No Silent Fallbacks" rule needs to
draw: step-level GHA tolerance (a known non-fatal warning doesn't
fail the job) is categorically different from code-level silent
degradation (a function that catches an exception and returns a
different / cached / empty result). The first tolerates a warning
without substituting behavior; the second actively lies about the
outcome.

Add a fourth "Allowed" bullet to CLAUDE.md calling this out so
future critique passes don't keep flagging continue-on-error as a
rule violation. Keep all three instances on the workflow.
Replaces the blanket "never commit" rule with a bulletproof-only policy:
Claude may create commits without explicit permission, but only when the
change is validated (tests + lint pass), critiqued (contradictions hunted
for and resolved, empirical evidence beats textbook advice), scope-clean
(only the files required), and complete (no half-finished work). Push /
force-push / amend / touching release branches remains off-limits without
explicit instruction.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
kovtcharov and others added 2 commits April 17, 2026 08:03
…d no-fallbacks rule

Correct three fact errors in gaia-agent-builder.md (inherited from the
pre-existing version and repeated in the overhaul):
- AGENT_ID / AGENT_NAME / AGENT_DESCRIPTION / CONVERSATION_STARTERS are
  NOT required on concrete Python agents — ChatAgent and friends don't
  declare them. They matter only for BuilderAgent and YAML-manifest
  agents. Split the checklist into "hard (enforced by
  check_agent_conventions.py)", "conventions", and "optional".
- _create_console has a default on the base class; it's an override
  point, not a requirement.
- Ground the checklist in util/check_agent_conventions.py (the actual
  source of truth for what --agents enforces).

Propagate the "No Silent Fallbacks" rule (CLAUDE.md) to the three agents
where it equally applies: eval-engineer (don't swap models mid-run),
mcp-developer (don't return stale/empty data on upstream failure),
voice-engineer (don't pipe silence into the LLM when ASR/TTS fails).

Rewrite CLAUDE.md's Claude Agents section so its one-line descriptions
match the sharper `.claude/agents/*` frontmatter triggers, and note that
the agent files themselves are the source of truth.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Lightweight tooling to keep Claude (and human contributors) on the golden
path when building GAIA agents, without introducing an MCP server layer.
Paired with the gaia-agent-builder subagent rewrite already landed in
2abbfdb — this is the code, schema, tests, and docs that back it.

- docs/sdk/patterns.mdx (new) — 8 copy-pasteable patterns (minimal Python,
  YAML manifest, MCP-enabled, mixin composition, @tool docstring contract,
  built-in registration, mocked-Lemonade tests, lint-before-PR) plus an
  anti-patterns table. Registered in docs/docs.json under Core Concepts.
  MRO follows GAIA convention (Agent first) — verified against ChatAgent,
  SDAgent, MedicalIntakeAgent, and the registry's dynamic class.

- schemas/agent-manifest.schema.json (new) + util/gen_manifest_schema.py —
  JSON Schema generated from the AgentManifest Pydantic model with the
  tools array constrained to KNOWN_TOOLS keys as enum. --check mode gates
  freshness in CI; editors consume via yaml-language-server comment in
  agent.yaml files.

- util/check_agent_conventions.py + util/lint.py --agents (new) —
  AST-based convention linter. Hard errors: missing copyright / broken
  KNOWN_TOOLS imports / stale manifest schema / docs/guides/<name>.mdx
  exists but unregistered in docs.json. Soft warnings: missing
  _TOOL_REGISTRY.clear() or .pop() / missing tests / not mentioned in
  CLAUDE.md. Passes cleanly against existing tree (0 errors, 11
  informational warnings).

- src/gaia/agents/builder/template.py refactored with _build_header /
  _build_class_attrs helpers and a new _render_with_tools path. The
  create_agent tool now accepts a tools=[...] list that composes any
  KNOWN_TOOLS mixin (alone, with enable_mcp, or multiple at once) into
  the generated class following GAIA's Agent-first MRO. Invalid tool
  names raise ValueError surfaced as an "Error:" message (fail-loudly
  per CLAUDE.md's No Silent Fallbacks rule).

- BuilderAgent system prompt walks the user through picking capabilities
  before calling create_agent, with concrete tool-call examples for each
  shape (basic, RAG-only, image-generating, MCP+file_io).

- 6 new tests in test_builder_agent.py cover single-tool, multi-tool,
  tools+MCP composition, invalid tool rejection, every KNOWN_TOOLS entry
  round-tripping through the generator, and tools=None/[]/omitted parity.
  All 116 builder+registry tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@github-actions github-actions Bot added agents tests Test changes labels Apr 17, 2026
@kovtcharov kovtcharov changed the title ci(claude): fix auto-review + CLAUDE.md accuracy + agent-builder tooling ci(claude): review infra + conventions + subagent overhaul + agent-builder tooling Apr 17, 2026
@kovtcharov kovtcharov self-assigned this Apr 17, 2026
No more "Generated with Claude Code" taglines, no Co-Authored-By trailers
for any Claude variant, no inline "authored by AI" comments. Output is the
project's work product; the human contributor is the author of record.
AI assistance is a tool like a linter — tools don't co-author commits.
Reviewers skim; long walls of text get ignored. Codifies the target
shape (one-paragraph summary → threaded bullets with per-bullet why →
test plan), hard rules (no section over ~5 lines, every claim earns a
why, cut file enumeration), and anti-patterns (copy-pasted commit log,
feature list without value, mirroring summary in test plan).
@kovtcharov

Copy link
Copy Markdown
Contributor Author

@claude review this PR.

@github-actions

github-actions Bot commented Apr 17, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kovtcharov's task —— View job


PR Review Complete

Summary: This is a substantial infrastructure PR that improves Claude's integration with GAIA across four interconnected areas. The changes are well-structured, thoroughly tested, and address real pain points in the dev workflow. The single most important thing: this PR removes silent fallbacks at the CI level and codifies "fail loudly" as a project-wide convention.


Issues Found

🟢 Minor: Inconsistent use of agent id reservation (src/gaia/agents/builder/agent.py:28)

The _RESERVED_IDS includes "agent" which would block any agent named "Agent" — but _normalize_agent_id("Agent") → "agent" triggers the reserved check as expected. The logic is correct but somewhat implicit. Consider adding a comment explaining this catch-22 is intentional.

🟢 Minor: Template docstring style (src/gaia/agents/builder/template.py:69)

The basic template has the docstring """Custom agent created by the Gaia Builder.""" — might be worth mentioning users should customize this since it appears in IDE tooltips and help().

🟢 Minor: Test file count mismatch in PR description

PR description says "116 pass" but test_builder_agent.py alone has many more tests than before. This is a documentation nit — the tests themselves are excellent.


Strengths

  1. Comprehensive test coverage — The TestCreateAgentImplTools class adds 6 new tests specifically for the tools=[...] parameter, including test_all_tools_importable which validates every KNOWN_TOOLS entry can be composed. This prevents silent breakage when the registry changes.

  2. Schema generation is self-healing — util/gen_manifest_schema.py --check in the linter means the JSON Schema can't drift from the Pydantic model. Editors get autocomplete and typo detection for free.

  3. Subagent overhaul is consistent — Spot-checked code-reviewer.md, python-developer.md, gaia-agent-builder.md — all now have clean "When to use / When NOT to use" sections and propagate the No Silent Fallbacks rule correctly.

  4. CI workflow is fork-safe — The pull_request_target + continue-on-error: true pattern handles permission warnings on fork PRs without silently downgrading functionality. The explicit model pin (claude-opus-4-7) with no fallback aligns with CLAUDE.md's new rule.

  5. docs/sdk/patterns.mdx is a force multiplier — Copy-pasteable patterns with "Why every line is there" explanations will reduce review cycles for new agents. The anti-patterns table is especially valuable.


Verdict

Approve — No blocking issues. The PR improves reliability, documentation, and tooling in mutually reinforcing ways. Test coverage is solid and the conventions are well-documented.


…ite docstring edits

Two small follow-ups from the PR review, both 🟢-minor / non-blocking
but easy wins.

1. src/gaia/agents/builder/agent.py:28 — the _RESERVED_IDS set
   includes "agent" because _normalize_agent_id("Agent") collapses to
   "agent" (no "-agent" suffix to strip) and would otherwise shadow
   the Agent base class in imports and logs. Review called this
   correct-but-implicit. Added a comment block explaining *why* each
   of {agent, chat, gaia, builder} is reserved, so future readers
   don't wonder if it's redundant with the slug-stripping logic.

2. src/gaia/agents/builder/template.py — both the basic and the
   MCP-enabled templates generated the class with the docstring
   """Custom agent created by the Gaia Builder.""" — a meta-comment
   about the generator, not a description of the agent. Since this
   docstring shows up in IDE tooltips, help() output, and
   agent-discovery listings, a scaffolded user sees it every time.
   Replaced with:

     """One-line description of what this agent does.

     TODO: Replace this docstring — it appears in IDE tooltips,
     `help()` output, and agent-discovery listings.
     """

   which invites customization and tells the user exactly where
   the text surfaces.

Verified: 86/86 builder tests still pass, and an actual
_create_agent_impl smoke-test produces syntactically valid Python
with the new docstring (parsed via ast.parse).
@kovtcharov
kovtcharov added this pull request to the merge queue Apr 17, 2026
Merged via the queue into main with commit e96b368 Apr 17, 2026
24 checks passed
@kovtcharov
kovtcharov deleted the kalin/fix-claude-auto-review branch April 17, 2026 15:52
kovtcharov added a commit that referenced this pull request Apr 17, 2026
…ilures

The `@beta` floating tag was pinned to a 2025-08-22 SHA (Claude Code 1.0.88)
that predates `pull_request_target` event support (added in claude-code-action
PR #579, merged 2025-09-22) and predates Opus 4.7 support (fixed in v1.0.98).
Every `pr-review` run since #783 has been failing with "Unsupported event type:
pull_request_target" in the action's Prepare step — but `continue-on-error: true`
was swallowing the error and reporting success. Result: no Claude reviews have
actually landed on recent PRs.

Pin all four action call sites to v1.0.99 by SHA, and drop `continue-on-error`
from `pr-review` so the next instance of this silent-drift pattern surfaces
instead of hiding.
kovtcharov added a commit that referenced this pull request Apr 17, 2026
… hang

## What this fixes

1. **PR reviews haven't fired since #783 merged.** The workflow's `@beta` pin is
   stuck on a 2025-08-22 SHA that predates `pull_request_target` support (merged
   upstream 2025-09-22) and Opus 4.7 support (v1.0.98). The action's Prepare step
   has been rejecting `pull_request_target` with "Unsupported event type" on
   every run, and `continue-on-error: true` was hiding the failure as "success".

2. **`@claude` mentions post a TODO checklist and never update it with findings.**
   In v0 tag mode, large custom_instructions + low max_turns were exhausting the
   turn budget before Claude got to the final comment-update step. Visible on
   run 24581846289 for PR #795.

## Changes

- **Pin all 4 action call sites to `v1.0.99` by SHA** — unblocks
  `pull_request_target` and Opus 4.7. SHA-pin rather than tag-pin so a future
  floating-tag retarget can't silently repeat this class of breakage.

- **Migrate to the v1 API.** v1.0.99 drops the v0 inputs we use
  (`direct_prompt`, `custom_instructions`, `model`, `max_turns`). Merged
  `direct_prompt` + `custom_instructions` into a single `prompt` block per job;
  moved `model` and `max_turns` into `claude_args`. Migration guide:
  https://github.com/anthropics/claude-code-action/blob/main/docs/migration-guide.md

- **All 4 jobs now run in automation mode** (via `prompt` input) instead of tag
  mode. Two reasons:
  - Works around anthropics/claude-code-action#1223 (open bug): `--model` is
    silently ignored in tag mode, falling back to Sonnet 4.6. Automation mode
    honors `--model claude-opus-4-7` correctly.
  - Fixes the unchecked-TODO behavior: automation mode runs Claude to completion
    and posts one final comment, no progress tracker to forget to update.
  - Claude posts its reply via `gh pr comment` / `gh issue comment` / `gh api`
    from within the automation task.

- **`--max-turns` bumped for `issue-handler` from 30 to 50** — the TODO-unfilled
  behavior was often turn-budget exhaustion against the expanded
  custom_instructions added in #783.

- **`continue-on-error: true` removed from all 3 Claude action steps.** This
  masking is the same "No Silent Fallbacks" pattern #783 explicitly added to
  `CLAUDE.md` as prohibited — the workflow was the biggest violator.

- **Prompt-injection hardening on `pr-comment` and `issue-handler`** — instead
  of interpolating `github.event.comment.body` into the `prompt` (a classic
  Actions injection sink when user content lands inside another shell/markdown
  context), the prompt tells Claude to fetch the comment body itself via `gh
  api`. Workflow-context values in the prompt are limited to numeric IDs and
  repo names.
github-merge-queue Bot pushed a commit that referenced this pull request Apr 17, 2026
… hang (#797)

## Why

Two real, verified-from-logs problems with the current Claude Code
setup:

**1. PR reviews haven't fired since #783 merged.** The workflow's
`@beta` pin points to a 2025-08-22 SHA that predates
`pull_request_target` support (merged in
[anthropics/claude-code-action#579](anthropics/claude-code-action#579)
on 2025-09-22) and Opus 4.7 support (fixed in v1.0.98). The action's
Prepare step rejects `pull_request_target` with `Unsupported event
type`, but `continue-on-error: true` was hiding the failure as a
"success" conclusion. Run
[24580730832](https://github.com/amd/gaia/actions/runs/24580730832) on
PR #795 is the concrete example.

**2. `@claude` mentions post a TODO checklist and never update it with
findings.** In v0 tag mode, large `custom_instructions` + `max_turns:
30` exhaust the turn budget before Claude reaches the final
comment-update step. Visible on run
[24581846289](https://github.com/amd/gaia/actions/runs/24581846289) for
PR #795.

## What changed

- **Pinned all 4 action call sites to v1.0.99 by SHA**
(`c3d45e8e941e1b2ad7b278c57482d9c5bf1f35b3`).
- **Full migration to the v1 API.** v1.0.99 drops the v0 inputs we use —
merged `direct_prompt` + `custom_instructions` into a single `prompt`
per job; moved `model` / `max_turns` into `claude_args`.
- **All 4 jobs now run in automation mode** (`prompt` input), not tag
mode, to work around
[anthropics/claude-code-action#1223](anthropics/claude-code-action#1223)
(tag-mode `--model` silently ignored) and to fix the unchecked-TODO
behavior.
- **`--max-turns` bumped for `issue-handler`** from 30 to 50.
- **`continue-on-error: true` removed** from the 3 Claude action steps.
- **Prompt-injection hardening** on `pr-comment` / `issue-handler` —
comment bodies fetched via `gh api` at runtime instead of interpolated
from `github.event.comment.body`.

## Validation (completed on this PR via temporary `pull_request`
trigger)

Tested end-to-end on PR #797 itself by temporarily adding a
`pull_request` trigger (since `pull_request_target` uses `main`'s
workflow, not the PR-head's). That trigger is now reverted — final diff
is migration-only.

| Path | Event | Run | Result |
|------|-------|-----|--------|
| `pr-review` | `pull_request` (synchronize) |
[24583825151](https://github.com/amd/gaia/actions/runs/24583825151) | ✅
Claude posted a full structured review as [this
comment](#797 (comment)) —
Summary / Issues / Strengths / Verdict format, referenced by
file.py:line |
| `issue-handler` | `issue_comment` (@claude mention) |
[24583975636](https://github.com/amd/gaia/actions/runs/24583975636) | ✅
Claude replied with actual findings to an @claude question, not an
unchecked TODO list |

**Claude's own review of this PR caught a real bug** in the
`issue-handler` prompt — on `issues.opened` events
`github.event.comment.id` is empty, so the prompt's `gh api
.../issues/comments/` URL would 404. Fixed in
[ad99674](ad99674) by
adding an explicit `COMMENT ID` field and instructing Claude to skip the
comment fetch when empty. Dogfooding worked.

Still unvalidated end-to-end (structural validation only):
- `pr-comment` (`pull_request_review_comment`) — uses the same
automation-mode pattern as the two validated paths
- `release-notes` (`workflow_run`) — only fires on `Publish Release`
completion; will self-validate on the next release

## Commits

4 commits in the branch. Net diff = migration + issue-handler fix.
**Recommend squash-merge** to collapse to one clean commit.

1. `ae1fb3f` — the v1 migration (main change)
2. `18efdc0` — TEST ONLY: add `pull_request` trigger (for validation)
3. `ad99674` — fix from Claude's own review: gate comment fetch on
COMMENT ID
4. `c7cbc59` — revert of (2)

## Vetting v1.0.99 against open upstream bugs

v1 is **not** bug-free. Assessment per issue:

| Issue | Severity | Affects GAIA? |
|-------|----------|---------------|
| [#1205](anthropics/claude-code-action#1205)
+ [#1187](anthropics/claude-code-action#1187)
/ [#1220](anthropics/claude-code-action#1220)
Bun tsconfig / cpSync symlink crash | P1 | **No** — GAIA has no
symlinked sensitive files (verified `CLAUDE.md`, `.claude/`) |
| [#1206](anthropics/claude-code-action#1206)
HTTP 401 app-token exchange | P2 | **No** — we use `GITHUB_TOKEN`, not a
GitHub App installation |
| [#1210](anthropics/claude-code-action#1210)
Git credentials overwritten | P2 | Low risk — we only read |
| [#1218](anthropics/claude-code-action#1218)
Fork PR fetch-by-name | P2 | Fixed in v1.0.96 |
| [#1222](anthropics/claude-code-action#1222)
`gh` CLI unavailable on default-branch PRs | P2 | **Maybe** — GAIA PRs
target `main`. Mitigated by our pre-generated `pr-diff.txt` /
`pr-files.txt` |
| [#1223](anthropics/claude-code-action#1223)
`--model` ignored in tag mode | — | **Would affect us** — worked around
by running all jobs in automation mode |
| [#1225](anthropics/claude-code-action#1225)
Opus 4.7 broken on v1.0.97 | P2 | Fixed in v1.0.98 |
| [#1226](anthropics/claude-code-action#1226)
`execution_file` not written on max_turns | P2 | Minor — doesn't affect
user-visible behavior |

## Rollback

Single workflow file, isolated change. `git revert` restores `@beta` —
which restores the silent-failure state, not a known-good state. If a
real merge-time regression appears, fix forward.
@itomek itomek mentioned this pull request Apr 20, 2026
5 of 6 tasks
github-merge-queue Bot pushed a commit that referenced this pull request Apr 20, 2026
# GAIA v0.17.3 Release Notes

GAIA v0.17.3 is an extensibility and resilience release. You can now
package your own agents into a custom GAIA installer and seed them on
first launch, point GAIA at alternative OpenAI-compatible inference
servers from the C++ library (Ollama, for example), and start from three
new reference agents (weather, RAG Q&A, HTML mockup) that execute
against real Lemonade hardware in CI. It also hardens the RAG cache
against an insecure-deserialization class of bug (CWE-502) — all users
should upgrade.

**Why upgrade:**
- **Ship your own GAIA** — Export and import agents between machines,
follow a new guide to produce a custom installer that seeds your agents
on first launch, and on Windows install everything in one step because
the installer now includes the Lemonade Server MSI.
- **Work with alternative inference backends** — The C++ library now
preserves OpenAI-compatible `/v1` base URLs instead of rewriting them to
`/api/v1`, so servers that expose the standard `/v1` path (Ollama, for
example) work out of the box.
- **Start from a working example** — Three new reference agents (weather
via MCP, RAG document Q&A, HTML landing-page generator) with integration
tests that actually execute against Lemonade on a Strix CI runner.
- **Safer RAG cache** — Replaces `pickle` deserialization with JSON +
HMAC-SHA256 (CWE-502). Unsigned or tampered caches are rejected and
transparently rebuilt on the next query.
- **Better document handling** — Encrypted or corrupted PDFs now produce
distinct, actionable errors (`EncryptedPDFError`, `CorruptedPDFError`)
instead of generic failures, and the RAG index is hardened for
concurrent queries.

---

## What's New

### Custom Installers and Agent Portability

You can now package a custom GAIA installer that ships with your own
agents pre-loaded, and move agents between machines with export/import
(PR #795). On Windows, the official installer now includes the Lemonade
Server MSI and runs it during install, so a fresh machine has the
complete local-LLM stack after a single download (PR #781).

**What you can do:**
- Export an agent from `~/.gaia/agents/` to a portable bundle with `gaia
agents export` and import it on another machine with `gaia agents
import`
- Follow the new custom-installer playbook at
[`docs/playbooks/custom-installer/index.mdx`](/playbooks/custom-installer)
to distribute GAIA with your agents pre-loaded — useful for workshops,
team deployments, and internal tooling
- On Windows, the installer now includes Lemonade Server — no separate
download for a complete first-run experience

**Under the hood:**
- `gaia agents export` / `gaia agents import` CLI commands round-trip
agents between machines as portable bundles
- First-launch agent seeder
(`src/gaia/apps/webui/services/agent-seeder.cjs`) copies
`<resourcesPath>/agents/<id>/` into `~/.gaia/agents/<id>/` the first
time the app starts
- Windows NSIS installer embeds `lemonade-server-minimal.msi` into
`$PLUGINSDIR` and runs it via `msiexec /i ... /qn /norestart` during
install (auto-cleaned on exit)

---

### Broader Backend Compatibility in the C++ Library

The C++ library now preserves OpenAI-compatible `/v1` base URLs (PR
#773) instead of rewriting them to `/api/v1`. That means inference
servers that expose the standard OpenAI `/v1` path — for example, Ollama
at `http://localhost:11434/v1` — work out of the box without needing a
special adapter.

---

### Reference Agents and Real-Hardware Integration Tests

Three new example agents and a Strix-runner CI workflow land together
(PR #340).

**What you can do:**
- Copy `examples/weather_agent.py`, `examples/rag_doc_agent.py`, or
`examples/product_mockup_agent.py` as a starting point for your own
agents
- Run the new integration tests locally against Lemonade to validate
agents end-to-end, not just structurally

**Under the hood:**
- `tests/integration/test_example_agents.py` executes agents and
validates responses with a 5-minute-per-test timeout
- `.github/workflows/test_examples.yml` runs on the self-hosted Strix
runner (`stx` label) with Lemonade serving `Qwen3-4B-Instruct-2507-GGUF`
- Docs homepage refreshed with a technical value prop ("Agent SDK for
AMD Ryzen AI") and MCP / CUA added to the capabilities list

---

### Smarter PDF Handling in RAG

Encrypted and corrupted PDFs now surface as distinct, actionable errors
(`EncryptedPDFError`, `CorruptedPDFError`, `EmptyPDFError`) instead of
generic failures or silent 0-chunk indexes (PR #784, closes #451).
Encrypted PDFs are detected before extraction; corrupted PDFs are caught
during extraction with a clear message. Combined with the
indexing-failure surfacing in PR #723, you get a visible indexing-failed
status the moment a document fails — and the RAG index itself is now
thread-safe under concurrent queries (PR #746).

---

## Security

### RAG Cache Deserialization Replaced with JSON + HMAC

Fixes an insecure-deserialization issue in the RAG cache (CWE-502, PR
#768). Previously, cached document indexes were serialized with Python
`pickle`; if an attacker could write to `~/.gaia/` — via a shared drive,
a sync conflict, or a malicious extension — loading that cache could
execute arbitrary code.

v0.17.3 replaces `pickle` with signed JSON: caches are now serialized as
JSON and authenticated with HMAC-SHA256 using a per-install key stored
at `~/.gaia/cache/hmac.key`. Unsigned or tampered caches are rejected
and transparently rebuilt on the next query. Old `.pkl` caches from
previous GAIA versions are ignored and re-indexed the next time you
query a document.

**You should upgrade if you** share `~/.gaia/` across machines (Dropbox,
iCloud, network home directories), run GAIA in a multi-user environment,
or have ever imported RAG caches from another source.

---

## Bug Fixes

- **Ask Agent attaches files before sending to chat** (PR #725) —
Dropped files are indexed into RAG and attached to the active session
before the prompt is consumed, so the model sees the document on the
first turn instead of the second.
- **Document indexing failures are surfaced** (PR #723) — A document
that produces 0 chunks now raises `RuntimeError` in the SDK and surfaces
as `indexing_status: failed` in the UI, instead of looking like a silent
success. Covers RAG SDK, background indexing, and re-index paths.
- **Encrypted or corrupted PDFs produce actionable errors** (PR #784,
closes #451) — RAG now raises distinct `EncryptedPDFError` and
`CorruptedPDFError` exceptions instead of generic failures, so you see
exactly what went wrong.
- **RAG index thread safety hardened** (PR #746) — Adds `RLock`
protection around index mutation paths and rebuilds chunk/index state
atomically before publishing it, so concurrent queries read consistent
snapshots and failed rebuilds no longer leak partial state.
- **MCP JSON-RPC handler guards against non-dict bodies** (PR #803) — A
malformed JSON-RPC payload (array, string, null) now returns HTTP 400
`Invalid Request: expected JSON object` instead of an HTTP 500 from a
`TypeError`.
- **File-search count aligned with accessible results** (PR #754) — The
returned count now matches the number of files the tool actually
surfaces, instead of a pre-filter total that over-reported results the
caller could not access.
- **Tracked block cursor replaces misplaced decorative cursor** (PR
#727) — Fixes the mis-positioned blinking cursor in the chat input box,
which now tracks the actual caret position via a mirror-div technique.
- **Ad-hoc sign the macOS app bundle instead of skipping code signing**
(PR #765) — The `.app` bundle inside the DMG now carries an ad-hoc
signature, so Gatekeeper presents a single "Open Anyway" bypass in
System Settings instead of the unrecoverable "is damaged" error. Full
Apple Developer ID signing is still being finalized.

---

## Release & CI

- **Publish workflow: single approval gate, no legacy Electron apps**
(PR #758) — Removed the legacy jira and example standalone Electron apps
from the publish pipeline; a single `publish` environment gate governs
PyPI, npm, and installer publishing.
- **Claude CI modernization** (PR #797, PR #799, PR #783) — Migrated all
four `claude-code-action` call sites to `v1.0.99` (pinned by SHA, fixes
an issue-handler hang), bumped `--max-turns` from 20 to 50 on both
`pr-review` and `pr-comment` for deeper analysis, upgraded to Opus 4.7,
standardized 23 subagent definitions with explicit when-to-use sections
and tool allowlists, and added agent-builder tooling (manifest schema,
`lint.py --agents`, BuilderAgent mixins).

---

## Docs

- **Roadmap overhaul** (PR #710) — Milestone-aligned plans with
voice-first as P0 and 9 new plan documents for upcoming initiatives.
- **Plan: email triage agent** (PR #796) — Specification for an upcoming
email triage agent.
- **Docs/source drift resolved** (PR #794) — Fixed broken SDK examples
across 15 docs, rewrote 5 spec files against the current source
(including two that documented entire APIs that don't exist in code),
added 20+ missing CLI flags to the CLI reference, and removed 2
already-shipped plan documents (installer, mcp-client).
- **FAQ: data-privacy answer clarified for external LLM providers** (PR
#798) — Sharper guidance on what leaves your machine when you point GAIA
at Claude or OpenAI.

---

## Full Changelog

**21 commits** since v0.17.2:

- `6d3f3f71` — fix: replace misplaced decorative cursor with tracked
terminal block cursor (#727)
- `874cf2a3` — fix: Ask Agent indexes and attaches files before sending
to chat (#725)
- `4fa121e2` — fix: surface document indexing failures instead of silent
0-chunk success (#723)
- `34b1d06e` — fix(ci): ad-hoc sign macOS DMG instead of skipping code
signing (#765)
- `7188b83c` — Roadmap overhaul: milestone-aligned plans with
voice-first P0 and 9 new plan documents (#710)
- `1beddac5` — cpp: support Ollama-compatible /v1 endpoints (#773)
- `cf9ac995` — fix: harden rag index thread safety (#746)
- `1c55c31b` — fix(ci): remove legacy electron apps from publish, single
approval gate (#758)
- `52946a7a` — feat(installer): bundle Lemonade Server MSI into Windows
installer (#774) (#781)
- `e96b3686` — ci(claude): review infra + conventions + subagent
overhaul + agent-builder tooling (#783)
- `058674b5` — fix(rag): detect encrypted and corrupted PDFs with
actionable errors (#451) (#784)
- `7bcb5d51` — fix: replace insecure pickle deserialization with JSON +
HMAC in RAG cache (CWE-502) (#768)
- `a5167e5f` — fix: keep file-search count aligned with accessible
results (#754)
- `da5ba458` — ci(claude): migrate to claude-code-action v1.0.99 + fix
issue-handler hang (#797)
- `03f546b9` — ci(claude): bump pr-review and pr-comment --max-turns 20
-> 50 (#799)
- `4119d564` — docs(faq): clarify data-privacy answer re: external LLM
providers (#798)
- `0cfbcf41` — Add example agents and integration test workflow (#340)
- `c4bd15fb` — docs: fix drift between docs and source (docs review pass
1 + 2) (#794)
- `407ed5b8` — docs(plans): add email triage agent spec (#796)
- `06fb04a4` — fix(mcp): guard JSON-RPC handler against non-dict body
(#803)
- `880ad603` — feat(installer): custom installer guide, agent
export/import, first-launch seeder (#795)

Full Changelog:
[v0.17.2...v0.17.3](v0.17.2...v0.17.3)

---

## Release checklist
- [x] `util/validate_release_notes.py docs/releases/v0.17.3.mdx --tag
v0.17.3` passes
- [x] `src/gaia/version.py` → `0.17.3`
- [x] `src/gaia/apps/webui/package.json` → `0.17.3`
- [x] Navbar label in `docs/docs.json` → `v0.17.3 · Lemonade 10.0.0`
- [x] All 21 PRs in the range (v0.17.2..HEAD) are represented in the
notes
- [ ] Review from @kovtcharov-amd addressed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devops DevOps/infrastructure changes documentation Documentation changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants