GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||
GeezerVison is showing github.com — feat(harness): add a Gemini CLI harness (tap, turn, and init templates) by michaelxu2288 · Pull Request #516 · scaleapi/scale-agentex-python Conversation
|
| elif evt_type == "result": | ||
| done = _close_text() | ||
| if done is not None: | ||
| yield done | ||
| if on_result is not None: | ||
| await on_result(evt) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Terminal failures appear successful
A terminal Gemini result can have status: "error", but this branch closes the text stream and invokes the normal result callback without checking the status or error payload. UnifiedEmitter therefore treats authentication, turn-limit, and other terminal failures as successful completion, potentially returning missing or partial output instead of surfacing the error. Standalone error events are also logged without entering the canonical stream.
Knowledge Base Used:
This is a comment left during a code review. Path: src/agentex/lib/adk/_modules/_gemini_cli_sync.py Line: 262-267 Comment: **Terminal failures appear successful** A terminal Gemini `result` can have `status: "error"`, but this branch closes the text stream and invokes the normal result callback without checking the status or error payload. `UnifiedEmitter` therefore treats authentication, turn-limit, and other terminal failures as successful completion, potentially returning missing or partial output instead of surfacing the error. Standalone error events are also logged without entering the canonical stream. **Knowledge Base Used:** - [Agent framework integrations](https://app.greptile.com/scale-ai/-/custom-context/knowledge-base/scaleapi/scale-agentex-python/-/docs/agent-framework-integrations.md) - [Harness delivery and metrics](https://app.greptile.com/scale-ai/-/custom-context/knowledge-base/scaleapi/scale-agentex-python/-/docs/harness-and-metrics.md) --- For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in d9b1ceb. A result with status: "error" now emits a TextContent error ("Error: Gemini CLI turn failed: ") before on_result fires, the same shape the Codex tap uses for turn.failed. Standalone error events with severity "error" are delivered the same way; warnings are still only logged. Covered by tests at the tap level and through UnifiedEmitter.yield_turn.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
bc51c52 to
761833e
Compare
Adds Gemini CLI as a framework harness alongside Claude Code and Codex: - convert_gemini_cli_to_agentex_events: maps the CLI's stream-json events (init, message deltas, tool_use, tool_result, error, result; schema per packages/core/src/output/types.ts in google-gemini/gemini-cli) onto the canonical StreamTaskMessage* stream. Assistant deltas open one text slot that closes on the next tool event, the result, or end of stream, so every Start has a Done; tool requests and results pair by tool_id. - GeminiCliTurn: HarnessTurn wrapper exposing session_id and model from the init event and normalising result.stats into TurnUsage. - Both exported from agentex.lib.adk. - agentex init templates sync-gemini-cli, default-gemini-cli and temporal-gemini-cli (registered in TemplateType, file map and menus), cloned from the Claude Code templates: prompt passed via -p with stdin closed (the CLI reads stdin to EOF in headless mode), optional GEMINI_MODEL, GEMINI_API_KEY credential, npm install -g @google/gemini-cli in the Dockerfile. Turns are independent prompts: the CLI's --resume takes latest/index, not a session id. - Tests: tap (text deltas, whole messages, tools, errors, callbacks, source close on cancel), turn (usage mapping, protocol), harness end to end through UnifiedEmitter with span derivation; template suite covers the three new templates. Offline tests only; a live smoke run needs a Gemini API key. Claude-Session: https://claude.ai/code/session_01HCVKnA7LeJZ44nxZz1uzF3
…silently A terminal `result` with `status: "error"` (auth failure, turn limit, fatal tool error) went straight to `on_result`, so UnifiedEmitter delivered the turn as an ordinary completion with partial or no output. Deliver it as a TextContent error message before firing `on_result`, the same shape the Codex tap uses for `turn.failed`. Standalone `error` events with severity "error" are delivered the same way; warnings are still only logged.
…ines - Read stdout with an 8 MiB line limit. A tool_result that echoes a file is one stream-json line, and asyncio's 64 KiB default made readline() raise and abort the turn. - After SIGTERM, wait at most 5 s for the CLI to exit, then SIGKILL, so a CLI that ignores SIGTERM cannot hang request or activity cancellation. - Match the sibling templates on current main: the optional private index step in both Dockerfiles, and make_workflow_logger in the Temporal workflow. - Fix "Gemini CLI CLI" wording. Verified with a fake `gemini` that prints a 100,000-character line and ignores SIGTERM: the line is read whole and aclose() returns after 5 s.
f853785 to
583856c
Compare
pyright 1.1.399 (the locked version `scripts/lint` runs) reported six errors in the Gemini CLI tests: attribute access on a content union after a list-comprehension filter, which does not narrow the indexed element, and aclose() on the tap's AsyncIterator return type. Assert the concrete content type before reading it, and cast the tap to AsyncGenerator where the test closes it. Test behaviour is unchanged.
At least 1 approving review is required to merge this pull request.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.