fix(ask-gemini): pass prompt via --print for agy >= 1.1.1#1
Conversation
agy 1.1.1 stopped reading stdin in print mode, so `agy -p - < file` sent a literal "-" and dropped the prompt (agy answered a stale turn or hung at exit 0, relayed as success:true). Pass the prompt as the --print arg, read stdin from /dev/null, and cap the wait with --print-timeout. Bumps to 0.14.0.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
📝 WalkthroughWalkthroughUpdated ask-gemini to version 0.14.0 and changed agy prompt delivery from stdin to the Changesagy prompt handling
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@skills/ask-gemini/scripts/ask-gemini`:
- Around line 1134-1142: Add an argument-size guard around prompt_text and the
args construction in the agy invocation flow, especially for CONTEXT_MODE=relay.
When the assembled prompt exceeds the safe argv limit, fail early with a clear
user-facing error instead of attempting the --print invocation; preserve the
existing behavior for prompts within the limit.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 69f6d228-d0dc-4ad2-a68d-00a23bbfd156
📒 Files selected for processing (2)
skills/ask-gemini/CHANGELOG.mdskills/ask-gemini/scripts/ask-gemini
| # agy >= 1.1.1: --print takes the prompt as an ARG and no longer reads stdin, | ||
| # so the old `-p - < prompt_file` silently dropped the prompt. Pass it as the | ||
| # --print value; stdin from /dev/null so agy can't block on a pipe. | ||
| local prompt_text | ||
| prompt_text=$(cat "$prompt_file") | ||
| local args=("--print" "$prompt_text" "--dangerously-skip-permissions" "--model" "$AGY_MODEL") | ||
| [[ -n "$resume_uuid" ]] && args+=("--conversation" "$resume_uuid") | ||
| [[ "$SANDBOX" = true ]] && args+=("--sandbox") | ||
| args+=("--print-timeout" "${max_to}s") |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify --print-timeout is a valid agy flag and check its expected format.
agy --help 2>&1 | grep -A2 'print-timeout' || echo "Flag not found in help output"
# Also check if agy supports a file-based prompt input as an alternative for large prompts.
agy --help 2>&1 | grep -iE 'print|prompt|file|stdin' || echo "No relevant flags found"Repository: ASACHIT/ask-gemini
Length of output: 210
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the prompt launch path and nearby helper logic.
sed -n '900,980p' skills/ask-gemini/scripts/ask-gemini
printf '\n---\n'
sed -n '1120,1160p' skills/ask-gemini/scripts/ask-gemini
printf '\n=== searches ===\n'
rg -n --hidden --no-messages 'print-timeout|dangerously-skip-permissions|--print|CONTEXT_MODE=relay|build_prompt\(' skills/ask-gemini/scripts/ask-geminiRepository: ASACHIT/ask-gemini
Length of output: 5725
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect prompt construction and any size limits/truncation logic.
sed -n '875,940p' skills/ask-gemini/scripts/ask-gemini
printf '\n---\n'
rg -n --hidden --no-messages 'MAX_PROMPT|prompt.*limit|truncate|ARG_MAX|E2BIG|prompt_file|prompt_text|relay' skills/ask-gemini/scripts/ask-geminiRepository: ASACHIT/ask-gemini
Length of output: 3357
Guard relay prompts against argv size limits CONTEXT_MODE=relay inlines file contents, so passing the assembled prompt via --print can hit E2BIG for larger projects. Add a size guard or fallback path so these runs fail with a clear message instead of an OS-level argv error.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@skills/ask-gemini/scripts/ask-gemini` around lines 1134 - 1142, Add an
argument-size guard around prompt_text and the args construction in the agy
invocation flow, especially for CONTEXT_MODE=relay. When the assembled prompt
exceeds the safe argv limit, fail early with a clear user-facing error instead
of attempting the --print invocation; preserve the existing behavior for prompts
within the limit.
Symptom
Under agy >= 1.1.1, an ask-gemini delegation returns
success:truebut theresponseis a canned greeting / a stale session-continuation / an unrelated answer — the task text never reaches the model. exit code is 0, so the wrapper reports success and callers integrate junk as a real answer.Root cause (version drift)
agy 1.1.1 changed print mode — from its changelog:
So
--print/-pnow takes the prompt as an argument and no longer reads stdin. The script invokedagy -p - < prompt_file, so agy received a literal-as the prompt and discardedprompt_file. On a resumed conversation it answered the previous turn; on a fresh one it hung until timeout — always exit 0.Fix
--printargument:agy --print "$prompt_text" …/dev/nullso agy can never block on a pipe/tty--print-timeout <max>s--dry-runinvocation render; bump to 0.14.0Verification
agy --print "<text>"returns a real answer, whereas the oldagy -p - < filereturnsError: timeout waiting for response. Confirmed end-to-end through the launcher on fresh and resumed sessions, chains,--task -stdin, special characters, and a ~19 KB prompt.Summary by CodeRabbit
Bug Fixes
Documentation