AntigravitySDK misclassifies Gemini 503 UNAVAILABLE errors as NonZeroAgentExitCodeError
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
Research direction
Read src/harbor/agents/installed/antigravity_sdk.py and the inherited error patterns and classifier in src/harbor/agents/installed/base.py; compare the adapter-specific patterns in antigravity_cli.py. The issue includes a deterministic mocked reproduction for _exec. Done means the reported 503 error is classified as ApiOverloadedError and the related status cases described in the issue map to the appropriate typed errors; an open linked pull request already addresses this issue.
Written by the indexing model from the issue text.
Description
Description
When a trial running the antigravity-sdk agent fails due to a transient Gemini API error (such as HTTP 503 / Status: UNAVAILABLE), Harbor classifies the failure as a generic NonZeroAgentExitCodeError instead of ApiOverloadedError.
AntigravitySDK inherits BaseInstalledAgent.ERROR_PATTERNS without defining any SDK-specific patterns. In BaseInstalledAgent.ERROR_PATTERNS, the overloaded patterns match only API Error: Overloaded, ServiceUnavailableError, Selected model is at capacity\. Please try a different model\., and Codex's "turn\.failed"...unexpected status 50[234]. Because google-antigravity surfaces these failures as google.antigravity.types.AntigravityExecutionError: ... Error 503, ..., Status: UNAVAILABLE (and request failed (code 503): ...), _classify_exec_error finds no match and falls back to NonZeroAgentExitCodeError.
Triggering Code
In src/harbor/agents/installed/antigravity_sdk.py, AntigravitySDK defines no ERROR_PATTERNS override and inherits BaseInstalledAgent.ERROR_PATTERNS:
ErrorPattern(r"API Error: Overloaded", ApiOverloadedError),
ErrorPattern(r"ServiceUnavailableError", ApiOverloadedError),
ErrorPattern(
r"Selected model is at capacity\. Please try a different model\.",
ApiOverloadedError,
),
When the runner exits non-zero, BaseInstalledAgent._classify_exec_error iterates self._compiled_error_patterns and returns NonZeroAgentExitCodeError(detail) when none match.
Environment
- Harbor Version:
0.27.0(verified identical onmaincommitcf4bd0043f4e3a91847edf1b799343caf74cf182) - Agent:
antigravity-sdk(google-antigravity) - Python:
3.13.18
Impact
- Benchmark Scoring Integrity: In
src/harbor/models/trial/error_policy.py,ApiOverloadedErrorhasshould_retry=True, has_valid_reward=False, whereasNonZeroAgentExitCodeErrorhasshould_retry=False, has_valid_reward=True. Misclassifying a transient503 UNAVAILABLEexit causes Harbor to skip retries and record an infrastructure abort as a valid0.0reward. - Persistence Even With SDK Retries: Although Harbor
0.27.0enablesLocalAgentConfig.eval()(RetryConfig.benchmark()) insideantigravity_sdk_runner.py, Harbor's outerERROR_PATTERNSclassifier is still needed whenever SDK-level retries fail fast, exhaust, or are disabled, as well as for non-retryable auth failures (401 UNAUTHENTICATED).
Reproduction Steps
The defect reproduces deterministically offline using AntigravitySDK._exec with a mocked failed ExecResult:
import asyncio
from pathlib import Path
from tempfile import TemporaryDirectory
from unittest.mock import AsyncMock
from harbor.agents.installed.antigravity_sdk import AntigravitySDK
output = (
"Traceback (most recent call last):\n"
' File "/installed-agent/run_agent.py", line 481, in <module>\n'
"google.antigravity.types.AntigravityExecutionError: model unreachable: "
"Error 503, Message: This model is currently experiencing high demand. "
"Spikes in demand are usually temporary. Please try again later., "
"Status: UNAVAILABLE\n"
"request failed (code 503): This model is currently experiencing high "
"demand. Spikes in demand are usually temporary. Please try again later.\n"
)
async def main() -> None:
env = AsyncMock()
env.exec.return_value = AsyncMock(return_code=1, stdout=output, stderr="")
with TemporaryDirectory() as tmp:
agent = AntigravitySDK(logs_dir=Path(tmp))
try:
await agent._exec(env, command="uv run --script /installed-agent/run_agent.py")
except Exception as exc:
print(type(exc).__name__)
asyncio.run(main())
Expected Behavior
AntigravitySDK._exec raises ApiOverloadedError.
Actual Behavior
AntigravitySDK._exec raises NonZeroAgentExitCodeError.
Error Log
Traceback (most recent call last):
File "/installed-agent/run_agent.py", line 481, in <module>
google.antigravity.types.AntigravityExecutionError: model unreachable: Error 503, Message: This model is currently experiencing high demand. Spikes in demand are usually temporary. Please try again later., Status: UNAVAILABLE
request failed (code 503): This model is currently experiencing high demand. Spikes in demand are usually temporary. Please try again later.
Workaround
Manually inspect failed trials whose result.json records NonZeroAgentExitCodeError for AntigravityExecutionError / code 503 in agent/antigravity_sdk.txt, exclude those trials from aggregation, and re-run them.
Analysis
Other installed agent adapters in Harbor follow a subclass-scoped ERROR_PATTERNS override rather than broadening BaseInstalledAgent.ERROR_PATTERNS (which risks false positives on unrelated tool output):
AntigravityCli.ERROR_PATTERNSmapsAGY_ERROR:status lines (UNAVAILABLE,RESOURCE_EXHAUSTED,INTERNAL,DEADLINE_EXCEEDED,UNAUTHENTICATED) to Harbor's typed API/auth exceptions.GrokBuild.ERROR_PATTERNSandVibesimilarly extend*BaseInstalledAgent.ERROR_PATTERNSwith adapter-specific patterns.
Adding an ERROR_PATTERNS override on AntigravitySDK anchored to AntigravityExecutionError: and request failed (code <status>): (matching to end-of-line so rightmost-match-wins classification outranks any earlier free-text needles) cleanly classifies 502/503 (UNAVAILABLE), 429 (RESOURCE_EXHAUSTED), 500 (INTERNAL), 504 (DEADLINE_EXCEEDED), and 401 (UNAUTHENTICATED) without affecting other agents.
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 1.9k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 156
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from harbor-framework/harbor
-
Trial runs the agent's `populate_context_post_run` on the event loop, so trials that end together stall the orchestrator for secondsPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
harbor-framework/harbor#4652 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
harbor-framework/harbor#4494 · 1 comment ·
Maintainers usually reply within 1 day
-
step workdir upload resets the work folder's owner and permissions in ModalPossibly taken @Sauvi72 claimed this 8 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
harbor-framework/harbor#4487 · 3 comments ·
Maintainers usually reply within 1 day
-
Docker: verifier log mounts are chmod 777 (no sticky), so rewardkit sandboxed graders die before writing a rewardPossibly taken @yuyz-cyber claimed this 6 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
harbor-framework/harbor#4469 · 1 comment ·
Maintainers usually reply within 1 day
-
Compare and Pareto hide total token usage when the cached token count is missingPossibly taken @Aafimalek claimed this 10 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
harbor-framework/harbor#4448 ·
Maintainers usually reply within 1 day
All issues in harbor-framework/harbor
Similar issues
-
soup prune-prompt exits 1 after writing its output on a file over 100,000 rows, and reports a capped row count otherwisePossibly taken @abdulwaarith0 claimed this today. Openneeds-triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
MakazhanAlpamys/Soup#3690 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug data-types native-format
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
ClickHouse/clickhouse-connect#1320 ·
Maintainers usually reply within 1 day
-
accepted
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
future-agi/future-agi#6392 ·
Maintainers usually reply within 1 day