[Bug Report] Scheduled automations (builtin: "schedule") silently truncate multi-line prompts at the first newline character (\n) in agentapi new-conversation
Summary
When configuring scheduled background tasks via Antigravity Sidecars (builtin: "schedule" in <configDir>/sidecars/<id>/sidecar.json), passing a multi-line string in args after -- causes agentapi new-conversation to silently truncate the prompt at the very first \n character.
Only line 1 is delivered to the newly created session’s <USER_REQUEST>. The remainder of the prompt is completely dropped without any warning or error, causing scheduled agents to execute with only their title line and missing up to 99% of their actual task instructions.
Environment
- Platform: Google Antigravity (AGY) / Windows 11 (
pwsh) - Component: Sidecar Daemon (
builtin: "schedule") & CLI Runner (agentapi new-conversation) - Config file:
~/.gemini/config/sidecars/<sidecar-id>/sidecar.json - Sidecar log path:
~/.gemini/antigravity/sidecar_data/<sidecar-id>/logs/sidecar.log
Steps to Reproduce (Minimal Reproducible Example)
- Create a scheduled sidecar at
~/.gemini/config/sidecars/test-cron/sidecar.json:{ "builtin": "schedule", "restart_policy": "always", "args": [ "CRON_TZ=Europe/Berlin 0 12 * * *", "agentapi", "new-conversation", "--", "[Daily Status Report]\nStep 1: Inspect repository git status.\nStep 2: Generate summary artifact in brain directory.\nStep 3: Deliver final response." ], "display_name": "Test Cron Truncation", "agent_permissions": { "workspace_uris": [ "file:///path/to/workspace" ] } } - Enable the automation and let it trigger (or trigger it manually).
- Inspect
~/.gemini/antigravity/sidecar_data/test-cron/logs/sidecar.log. - Inspect the resulting conversation transcript at
<brainDir>/<conversation-id>/.system_generated/logs/transcript_full.jsonl(line 1,step_index: 0).
Expected Behavior
The agent in the newly spawned conversation should receive the entire multi-line string in <USER_REQUEST>:
[Daily Status Report]
Step 1: Inspect repository git status.
Step 2: Generate summary artifact in brain directory.
Step 3: Deliver final response.
Actual Behavior
The agent receives only the first line:
[Daily Status Report]
Everything after the first \n character is silently discarded.
Empirical Log & Transcript Evidence
In our live production environment across three distinct scheduled automations, we observed this behavior 100% consistently:
1. sidecar.log output
{"level":"info","time":"...","msg":"Running command","args":["agentapi","new-conversation","--","[Daily Status Report]"]}
2. transcript_full.jsonl (step_index: 0)
{
"step_index": 0,
"type": "USER_INPUT",
"content": "[Daily Status Report]"
}
3. Consequences
- In our daily 15:00 maintenance cycle, a 2,538-character prompt (48 lines) was reduced to 62 characters (97.6% lost).
- In our 16:15 triage cycle, a 3,412-character prompt (55 lines) was reduced to 41 characters (98.8% lost). The agent was forced to run
rgover the disk to guess what its purpose was. - In our 18:00 financial audit, a 2,845-character prompt (45 lines) was reduced to 46 characters (98.4% lost).
Root Cause Analysis
In sidecar.json, args is passed as an array of CLI arguments to the background scheduler process:
"args": [
"CRON_TZ=...",
"agentapi",
"new-conversation",
"--",
"<prompt>"
]
When agentapi processes the CLI arguments on Windows (or when the internal sidecar runner parses the process invocation flags), either:
- The argument string containing raw newlines (
\n) is passed without proper shell escaping / quotes toagentapi, causing the sub-process argument parser to treat the first newline as the end of the argument or command. - Or
agentapi new-conversationinternally reads fromstdin/ positional arguments using a single-line scanner (e.g.,readLine()or similar) rather than capturing the full remaining argument string.
Workaround for Users
Until this is patched upstream, all multi-line prompts in sidecar.json must be flattened into a single continuous line with zero \n characters (using inline separators such as | or ;):
"args": [
"CRON_TZ=Europe/Berlin 0 12 * * *",
"agentapi",
"new-conversation",
"--",
"[Daily Status Report] Step 1: Inspect repository git status. | Step 2: Generate summary artifact in brain directory. | Step 3: Deliver final response."
]
Suggested Fixes for the Antigravity Team
- Preserve multi-line string arguments: Ensure the sidecar process executor properly quotes and passes strings with
\nacross OS process boundaries (especially on Windows). - Support
--prompt-file <path>orstdin: Allowagentapi new-conversationto accept--prompt-file <path>so complex automation workflows can point directly to Markdown prompt files without JSON string escaping hazards. - Update
/automationSkill Documentation: Until resolved, update the built-in skill documentation atskills/automation/SKILL.mdto explicitly warn against using unescaped newlines in the prompt argument.