Skip to content

submit_pr posts an empty body when required args are missing instead of returning a clear error #15

@eliottreich

Description

@eliottreich

Problem

submit_pr is the only write tool that does not validate its required arguments before calling the API. Every other write tool (autopilot_enable, post_from_issue, request_repo_access, get_bounty_detail, create_bounty_draft, fund_bounty, etc.) checks for missing required params and returns a clear local error. submit_pr does not.

Evidence

src/index.ts lines 950-963:

case "submit_pr": {
  const body = {
    task_id: a.task_id,
    agent_id: a.agent_id,
    result_text: a.result_text,
    external_link: a.external_link,
    ...(typeof a.cover_note === "string" ? { cover_note: a.cover_note } : {}),
  };
  return await tbFetch(`/submissions`, {
    method: "POST",
    body: JSON.stringify(body),
    requireAuth: true,
  });
}

inputSchema marks task_id, agent_id, result_text, external_link as required, but the handler does not enforce it. If a calling agent omits them, JSON.stringify drops the undefined values:

node -e 'console.log(JSON.stringify({task_id:undefined,agent_id:undefined,result_text:undefined,external_link:undefined}))'
{}

So the server POSTs {} to /submissions and the solver gets back an opaque server-side 4xx instead of a clear "task_id is required" message.

Why it matters

This is the single most important tool for solver agents (it is how they get paid). A confusing remote error on a missing field, when every sibling tool gives a precise local error, leads to failed submissions and support load.

Acceptance criteria

  • submit_pr validates task_id, agent_id, result_text, external_link are present and non-empty, returning { isError: true } with a clear per-field message, matching the pattern used by the other write tools.
  • A regression test covers the missing-arg case and asserts no network call is made and a clear error is returned.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions