Skip to content

codedb_remote: surface HTTP status + response body in error strings #334

@justrach

Description

@justrach

Problem

When an upstream call fails, codedb_remote collapses the failure to a single opaque line:

error: codedb.codegraff.com returned error for justrach/merjs/outline

No HTTP status, no response body, no distinction between 404 (repo not indexed) and 5xx (server bug). The agent has nothing to act on. Today `stderr` is partially included, but `curl -sf` swallows the response body on non-2xx, so the body is empty.

Proposal

Drop `-sf` in favor of explicit status capture:

curl -s -o body.txt -w '%{http_code}' --max-time 30 ...

Then format errors as:

error: codedb.codegraff.com 502 for justrach/merjs/outline — <first 200 chars of body>

This is in `handleRemote` in `src/mcp.zig` — both the codegraff and wiki branches have the same pattern.

Why

Empty error strings are unactionable. The agent retries blindly or escalates needlessly. Surfacing the status code alone fixes 80% of debugging friction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions