{"type":"assistant.message","timestamp":"2026-07-30T13:28:00.694Z","data":{"content":"Direct fetch works! The 400 error must be happening at a different call. The issue might be when the tool result is sent back and the messages array has a `tool` role message that uses `tool_call_id`. Let me check what format the tool response should be in:\n\nActually, looking at the response more carefully - there are 2 choices: one with content+reasoning, and one with tool_calls. My code takes `choices[0]` which has content+reasoning and sees `finish_reason: \"tool_calls\"`. But the content message doesn't have `tool_calls` in it - only the second choice does.\n\nLet me fix this by finding the choice with `tool_calls`:"}}
{"type":"tool.execution_start","timestamp":"2026-07-30T13:28:00.695Z","data":{"toolName":"bash","mcpServerName":"","command":"python3 << 'EOF'\nwith open('/home/runner/work/rig/rig/skills/rig/rig.ts', 'r') as f:\n content = f.read()\n\nold = ''' const choice = data.choices?.[0];\n const msg = choice?.message;\n if (!msg) throw new Error(\"api-proxy: empty response\");\n messages.push(msg);\n\n if (choice?.finish_reason === \"tool_calls\" || (msg.tool_calls && msg.tool_calls.length > 0)) {'''\n\nnew = ''' // Prefer the choice with tool_calls; fall back to first choice\n const choice = data.choices?.find((c) => c.finish_reason === \"tool_calls\" && c.message?.tool_calls?.length) ?? data.choices?.[0];\n const msg = choice?.message;\n if (!msg) throw new Error(\"api-proxy: empty response\");\n messages.push(msg);\n\n if (choice?.finish_reason === \"tool_calls\" || (msg.tool_calls && msg.tool_calls.length > 0)) {'''\n\nif old in content:\n content = content.replace(old, new)\n with open('/home/runner/work/rig/rig/skills/rig/rig.ts', 'w') as f:\n f.write(content)\n print(\"REPLACED\")\nelse:\n print(\"NOT FOUND\")\n idx = content.find(\"const choice = data.choices?.[0]\")\n print(f\"Found at: {idx}\")\nEOF"}}
{"type":"tool.execution_complete","timestamp":"2026-07-30T13:28:00.771Z","data":{"toolName":"bash","mcpServerName":"","success":true,"result":{"content":"REPLACED\n<shellId: 180 completed with exit code 0>","detailedContent":"REPLACED\n<shellId: 180 completed with exit code 0>"}}}
{"type":"assistant.message","timestamp":"2026-07-30T13:28:05.741Z","data":{"content":""}}
{"type":"tool.execution_start","timestamp":"2026-07-30T13:28:05.742Z","data":{"toolName":"bash","mcpServerName":"","command":"cd /home/runner/work/rig/rig\nnode skills/rig/rig.ts 2>&1 << 'EOF'\nimport { agent, defineTool, s } from \"rig\";\n\nconst getTodayTool = defineTool(\"get_greeting\", {\n description: \"Returns a greeting message.\",\n parameters: s.object({ name: s.string }),\n async handler({ name }) {\n return { greeting: `Hello, ${name}!` };\n },\n});\n\nexport default agent({\n model: \"small\",\n tools: [getTodayTool],\n instructions: 'Call get_greeting with name=\"World\" and return {\"greeting\": <the greeting string>}.',\n output: s.object({ greeting: s.string }),\n});\nEOF"}}
{"type":"tool.execution_complete","timestamp":"2026-07-30T13:28:10.851Z","data":{"toolName":"bash","mcpServerName":"","success":true,"result":{"content":"{\"greeting\":\"Hello, World!\"}\n<shellId: tooltest3 completed with exit code 0>","detailedContent":"{\"greeting\":\"Hello, World!\"}\n<shellId: tooltest3 completed with exit code 0>"}}}
{"type":"assistant.message","timestamp":"2026-07-30T13:28:17.105Z","data":{"content":"Tool calling works. Now let's run the actual program:"}}
{"type":"tool.execution_start","timestamp":"2026-07-30T13:28:17.106Z","data":{"toolName":"bash","mcpServerName":"","command":"cd /home/runner/work/rig/rig\nexport RIG_DEBUG=\"agent:invoke,agent:retry,agent:error,agent:failure,agent:close,engine:copilot:create,engine:copilot:close\"\nnode skills/rig/rig.ts < /tmp/gh-aw/agent/program.ts > /tmp/gh-aw/agent/stdout_final2.log 2>/tmp/gh-aw/agent/stderr_final2.log\necho \"EXIT:$?\""}}
{"type":"tool.execution_complete","timestamp":"2026-07-30T13:28:35.059Z","data":{"toolName":"bash","mcpServerName":"","success":true,"result":{"content":"EXIT:1\n<shellId: rigfinal2 completed with exit code 0>","detailedContent":"EXIT:1\n<shellId: rigfinal2 completed with exit code 0>"}}}
[copilot-sdk-driver] [sdk-driver] error: Authorization error, you may need to run /login (Request ID: bb3153e6-2334-4b75-81ad-5b1735af00a7)
Workflow Failure
Workflow: Daily Rig Sample Report
Branch: main
Run: https://github.com/githubnext/rig/actions/runs/30544609602
Warning
Engine Failure: The
copilotengine terminated unexpectedly.Last agent output:
Action Required
Assign this issue to an agent to debug and fix the issue.
Debug with any coding agent
Use this prompt with any coding agent (GitHub Copilot, Claude, Gemini, etc.):
Manually invoke the agent
Debug this workflow failure using your favorite Agent CLI and the
agentic-workflowsprompt.agentic-workflowsskill from.github/skills/agentic-workflows/SKILL.mdor https://github.com/github/gh-aw/blob/main/.github/skills/agentic-workflows/SKILL.mddebug the agentic workflow daily-rig-sampler failure in https://github.com/githubnext/rig/actions/runs/30544609602Tip
Stop reporting this workflow as a failure
To stop a workflow from creating failure issues, set
report-failure-as-issue: falsein its frontmatter: