Skip to content

fix: prevent raw JSON dump in respond-to-comment PR replies#19

Draft
warp-dev-github-integration[bot] wants to merge 1 commit intomainfrom
oz-agent/REMOTE-1224-fix-json-output-parsing
Draft

fix: prevent raw JSON dump in respond-to-comment PR replies#19
warp-dev-github-integration[bot] wants to merge 1 commit intomainfrom
oz-agent/REMOTE-1224-fix-json-output-parsing

Conversation

@warp-dev-github-integration
Copy link
Copy Markdown

Problem

When the Oz agent completes work via tool calls (e.g., editing files) without producing a final text message (type='agent'), the "Reply to Comment" step in the respond-to-comment workflow falls back to posting the entire raw NDJSON stream as the PR comment body. This results in comments like:

@user: {"type":"system","event_type":"run_started","run_id":"...","run_url":"..."}
{"type":"agent_reasoning","text":"..."}
{"type":"tool_call","tool":"edit_files",...}
...

See: https://github.com/warpdotdev/warp-server/pull/10070#discussion_r3029369447

Root Cause

The JSONL parsing logic in the "Reply to Comment" step only looks for events with type === 'agent' (the agent's direct text output). When no such event exists — which happens when the agent completes its work purely through tool calls and reasoning — lastText remains empty and the code falls back to raw:

const content = (lastText || raw || '').trim();

Fix

Updated the JSONL parsing in examples/respond-to-comment.yml (and regenerated .github/workflows/respond-to-comment.yml) to:

  1. Extract agent_reasoning text as fallback — when there's no type: 'agent' event, the last agent_reasoning text is used instead
  2. Extract run URLsystem events with run_url are captured and appended as a "View full agent run" link
  3. Never fall back to raw NDJSON — the isJsonl flag tracks whether the output was JSONL format; if so, only structured content is used
  4. Still handle text format — non-JSONL output (e.g. output_format: text) is used as-is

Fixes REMOTE-1224

Conversation: https://staging.warp.dev/conversation/bf17e8da-31fa-4af4-b487-5d11a0b8df35
Run: https://oz.staging.warp.dev/runs/019d4f93-ca88-7dbd-9bd1-3d6b87ff75ad

This PR was generated with Oz.

When the agent completes work via tool calls without producing a final
text message (type='agent'), the Reply to Comment step was falling back
to posting the entire raw NDJSON stream as the PR comment body.

Fix the JSONL parsing to:
- Extract agent_reasoning text as fallback when no agent text exists
- Extract run URL from system events to include a link to the full run
- Never fall back to dumping raw JSONL output
- Still handle non-JSONL (text format) output correctly

Fixes REMOTE-1224

Co-Authored-By: Oz <oz-agent@warp.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants