GUARDS Plugin Failure Modes and Source Map
Use this playbook to map agy-guards doctor checks, session gaps, hook denials, spoke hangs, and factory stalls to concrete root causes and (when available) agy-guards source modules.
1. Interpreting agy-guards doctor checks and session gaps
Project-level checks
store(SchemaFit::BehindorSchemaFit::Ahead):Behind: the database schema predates the runningagy-guardsbinary. Runningagy-guards inspect <workspace_root>opens the read-write migrator and upgradesguards.sqlite3.Ahead:~/.local/bin/agy-guardsis older thanguards.sqlite3. Reinstall or rebuildagy-guardsfrom the newer revision; do not delete the store unless discarding state is intended.
installationandfactory_installation:- Verify
~/.gemini/config/import_manifest.jsonhas a singleguardsimport,~/.gemini/config/hooks.jsonmatches~/.gemini/config/agy-guards-hooks.receipt.json, and~/.gemini/config/plugins/guards/mcp_config.jsonpoints to an executable~/.local/bin/agy-guards. factory_installationadditionally verifies~/.gemini/config/agy-guards-installation.receipt.json(or--installation-receipt <path>) against both the running binary hash and installed plugin assets (plugin.json,mcp_config.json,hooks.json,README.md,agents/,rules/,skills/). Rebuilding~/.local/bin/agy-guardswithcargo buildwithout running the installer invalidates factory provenance even when ordinaryinstallationreportsok.
- Verify
github:- Verifies persona tokens from
~/.config/agy-guards/credentials(0600) viaGET /user. - Warns when
GUARDS_*orGITHUB_TOKENvariables are exported in the shell environment (the engine ignores shell env tokens). - Warns when
GUARDS_HUB_TARS_GITHUB_TOKENandGUARDS_SPOKE_DOYLE_GITHUB_TOKENauthenticate as the same GitHub account, which blocks independent PR approval and--merge.
- Verifies persona tokens from
open_calls:historical: false: an MCP call (commonlywait_for_spokeor a slow GitHub operation) is still open in the active conversation or crashed mid-call.historical: truewithliveness: "unknown": an unmatchedstartrecord left behind by an earlier conversation that exited abruptly.
caller_identity:- Recent
huborspokeMCP calls arrived with an emptyconversationfield, indicatingpre-tool-usedid not runnote_callerbeforecall_mcp_tool(broken hook projection or non-projected host).
- Recent
recent_errors(hook-denial blind spot):doctorintentionally treats"hook denied..."messages as policy enforcement rather than engine errors. When an agent loops or stalls on refused tool calls,recent_errorscan still reportok; always searchlogs/<session_id>/server.logfor"hook denied".
sandbox:- Checks
bwrap(bubblewrap) namespace availability. Failures indicate missingbwrapor restricted unprivileged user namespaces on the Linux host.
- Checks
Per-session gaps and deliverables
missing_caller: session calls lack caller conversation identity.no_logs: session exists inguards.sqlite3without a matchinglogs/<session_id>/directory.stale: session is non-terminal and inactive past--stale-secs(default600).store_ahead: store schema is newer than theagy-guardsbinary.skipped_phase/deliverables: a passed phase (G.2throughD.2) is missing expected artifact files underartifacts/<id>/or lacks provenance entries in.writers.skill_health_unchecked:skill_run: trueruns (backed by.run.json, such asrun-chores-*) only verify artifact presence (health_coverage: "artifacts_only").
2. Common runtime bug signatures
A. Spoke subagent hang, wait_for_spoke timeout, or hook denied a prod
- Inspect
logs/<session_id>/server.logandlogs/spoke-continuations/forSPOKE_WAIT_PROGRESS,PROD_SENT, and"hook denied a prod". - Locate the spoke
<conversationId>fromaudit.log(process: "spoke") orPROD_SENT, then inspect<agy_app_dir>/brain/<spokeConversationId>/.system_generated/:- Permission stall (
Askprompt in headless/background spoke): check the last entry insteps/orlogs/transcript.jsonl. Spokes require pre-approvedmcp(guards_spoke/*)and workspace permissions; an interactive prompt stalls unattended execution. - Wrong MCP server target: check
server.logfor"spoke subagents must call ServerName: \"guards_spoke\", never \"guards_hub\"". - Premature spoke stop without reporting: spoke hit
model_stop,NO_TOOL_CALL, rate limit, or crash before calling itsguards_spokecompletion tool. Checkmessages/to see whether hub prods arrived, and checkgate_send_messageinserver.logfor cleanup-lease orprod_effectrefusals ("hook denied a prod"). - Worktree drift or premature reap: check
logs/cleanup/and~/.gemini/antigravity-cli/worktrees/<hubConversationId>/subagent-*. VerifyWritespokes were spawned withWorkspace: "branch"and MCP inheritance disabled.
- Permission stall (
B. Bundle gate or G.1 interview loop (AwaitingApproval, AlreadyConsumed, Ambiguous)
- Inspect
~/.gemini/{antigravity-cli,antigravity}/brain/<hubConversationId>/.system_generated/logs/transcript.jsonl(andtranscript_full.jsonl). - Check four failure causes:
- 128 KiB transcript tail cutoff:
agy-guardsonly inspects the last 128 KiB of the transcript file. Large tool outputs emitted after the user’s answer push"approved"orask_questioncompletions out of window. - Ambiguous multi-issue approval: more than one session in the workspace is waiting at a gate, so bare
approvedreturnsApprovalAction::Ambiguousand requiresapproved <issue_number>. - Malformed
ask_questionreconciliation:accept_bundle_question/note_interview_outcomedid not see a completed answer matching the recorded question. - Unblocking externally: once logs are saved and human intent is clear, run
agy-guards approve <workspace_root> <issue_number>from outside the run.
- 128 KiB transcript tail cutoff:
C. Self-protection hook lockouts or Scope::Unknown denials
- Activated caller lockout: once
<state_base>/hook-callers/<conversationId>exists,pre-tool-useblocks reads outside<workspace_root>, writes to~/.gemini/, andrun_commandstrings mentioningguards.sqlite3,~/.gemini, oragy-guardssubcommands other than--versionandinspect. Always debug from a separate conversation outside<workspace_root>. Cannot verify the host conversation identity or GUARDS activity(Scope::Unknown):pre-tool-usecould not verify caller metadata and failed closed. Inspect~/.gemini/config/hooks.json,~/.gemini/config/agy-guards-hooks.receipt.json, andcli.logforagy-guards projected hook:stderr errors.
D. Stale Antigravity MCP schema cache
- Compare cached tool JSON files in
~/.gemini/antigravity-cli/mcp/guards_hub/andguards_spoke/againstagy-guards toolsandagy-guards tools --spoke. - If a binary upgrade added, renamed, or changed arguments on an MCP tool while the host kept cached schemas (or an old
agy-guardshub MCP server PID stayed alive), restart the hostagyprocess so MCPtools/listrefreshes.
E. Single-agy /proc workspace collision or wedged factory lease
agy-guards factoryscans/proc/<pid>/cmdline,/proc/<pid>/cwd, and--add-dirarguments, aborting withworkspace has existing agy processes: <pid>if anyagyprocess resolves to canonical<workspace_root>.- It also holds a non-blocking
flockat~/.local/share/guards-factory/locks/<sha256_hex>. - Check
FACTORY_START_FAILURE.md,FACTORY_LEDGER.ndjson, and live/procPIDs before terminating orphanedagyoragy-guardsprocesses.
3. Source localization map (<plugin_root>/)
When the plugin-agy-guards repository (crates/agy-guards/Cargo.toml and antigravity/plugin.json) is available locally, map runtime failures directly to these modules:
| Subsystem | Source path under <plugin_root>/ |
|---|---|
CLI parsing, hook dispatch, reset, gc, approve, inspect | crates/agy-guards/src/main.rs, crates/agy-guards/src/cli.rs |
| Hook scope activation, workspace/control-surface guards, projected hooks | crates/agy-guards/src/hook_scope.rs, crates/agy-guards/src/hook_projection.rs, crates/agy-guards/src/hooks/ |
doctor checks, receipt provenance, bwrap check | crates/agy-guards/src/doctor.rs, crates/agy-guards/src/doctor/installation.rs |
monitor timeline merge, deduplication, --follow exit rules | crates/agy-guards/src/monitor.rs |
JSONL FileLayer, .seq counter, secret redaction | crates/agy-guards/src/logging.rs |
Gemini transcript.jsonl 128 KiB tail parser and gate/interview reconciliation | crates/agy-guards/src/transcript.rs |
Spoke liveness hashing, continuations, send_message prods, artifact status | crates/agy-guards/src/spoke_monitor.rs, crates/agy-guards/src/spoke_continuation.rs, crates/agy-guards/src/prod_effect.rs, crates/agy-guards/src/spoke_artifact.rs |
Spoke worktree lease and gc reaper | crates/agy-guards/src/cleanup/ |
SQLite GUARDS store, Door::Reset ownership checks, MCP tools | crates/agy-guards/src/store/, crates/agy-guards/src/ownership.rs, crates/agy-guards/src/tools/ |
Unattended factory supervisor, NDJSON ledger, /proc scanner, workspace lock | crates/agy-guards/src/factory/ |
| Plugin manifests, persona subagents, rules, and internal skills | antigravity/plugin.json, antigravity/mcp_config.json, antigravity/agents/, antigravity/rules/, antigravity/skills/ |