Skip to content

Add error handling on the calls to the server to debug issue #132 - #137

Merged
adamdotdevin merged 1 commit into
anomalyco:devfrom
tmeire:fix/server-error-reporting
Jun 21, 2025
Merged

Add error handling on the calls to the server to debug issue #132#137
adamdotdevin merged 1 commit into
anomalyco:devfrom
tmeire:fix/server-error-reporting

Conversation

@tmeire

@tmeire tmeire commented Jun 16, 2025

Copy link
Copy Markdown
Contributor

This PR adds HTTP response code checking on a couple of calls to the server.

@tmeire tmeire mentioned this pull request Jun 16, 2025
@adamdotdevin

Copy link
Copy Markdown
Member

hey @tmeire sorry, just seeing this and i reworked init quite a bit! want to take a look at latest and see if your changes still apply?

@tmeire

tmeire commented Jun 17, 2025

Copy link
Copy Markdown
Contributor Author

@adamdottv merged the changes from dev and moved the http status code checks to the new locations 👍

@adamdotdevin

Copy link
Copy Markdown
Member

really sorry, things moved again, mind to rebase? also, we have toast messages now if you'd like to notify the user that way

@tmeire
tmeire force-pushed the fix/server-error-reporting branch from 2c4ef78 to 1294118 Compare June 21, 2025 07:38
@tmeire

tmeire commented Jun 21, 2025

Copy link
Copy Markdown
Contributor Author

@adamdotdevin rebased again

If it bails out on the providers cmd, it's still crashing because multiple parts in the rest of the code assume there's always a provider configured.
https://github.com/sst/opencode/pull/137/files#diff-beefbb340638978338691e76199450f7df3739be9105f0b8cdf1a38b6835d341R129

@adamdotdevin
adamdotdevin merged commit 119d2d9 into anomalyco:dev Jun 21, 2025
achembarpu pushed a commit to achembarpu/opencode that referenced this pull request Aug 4, 2025
xywsxp pushed a commit to xywsxp/opencode that referenced this pull request Apr 24, 2026
bussard76 pushed a commit to bussard76/openwork that referenced this pull request May 12, 2026
bussard76 pushed a commit to bussard76/openwork that referenced this pull request May 12, 2026
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
avion23 pushed a commit to avion23/opencode that referenced this pull request Jun 10, 2026
@arvsrn arvsrn mentioned this pull request Jun 11, 2026
6 tasks
mayoalexander added a commit to FREELABEL/iris-opencode that referenced this pull request Aug 18, 2026
Same model, same question, six hours apart:

  17:01  'fetch my family projects' -> bloqs list, then bloqs SEARCH family,
         found anomalyco#200 Family Businesses and anomalyco#137 Family Health and Finance
         Management Workflow. Correct.
  21:58  'what personal + family project do i have' -> bloqs list ONLY, answered
         'Mia Mayo — Life Atlas' and stopped. Missed both.

Neither anomalyco#200 nor anomalyco#137 appears anywhere in 'bloqs list' — it is recency-ordered and
truncated. So the list-only answer is not partial, it is WRONG, and nothing in the
result tells the model that. The list looks complete.

kimi-k3 and glm-5.2 failed the same way on the same prompt, both stopping after one
list call and guessing from names. That is three models making one mistake, which
makes it a tool-description problem rather than a model problem.

The description now states plainly that 'bloqs list' is not an inventory, gives the
measured example, and says: search by topic, list only to enumerate recent boards or
when the user already named one.

Also covers the second failure in that transcript. Asked 'are there any other
projects?', the model ran 'bloqs get 602 --items' — which returns what is INSIDE 602
and cannot say anything about other boards — then answered from memory of the earlier
list. Both are now called out explicitly, along with a reminder that an oversized
result saved to a file is a success.

Put in the TOOL DESCRIPTION rather than a prompt file deliberately: it reaches every
model through the same channel, and the default model has changed three times this
week.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
mayoalexander added a commit to FREELABEL/iris-opencode that referenced this pull request Aug 18, 2026
…ot everything

Two data-contract defects, both measured, both of which read as model failures
and were not. Written test-first; the tests fail against the old behaviour.

1. TRUNCATION WAS INVISIBLE.
   `bloqs list --json` returned 20 records as a FLAT ARRAY. The account has 137.
   No total, no truncated flag, no next — so a model reading it reasonably
   concluded it had everything, then answered "your family project is anomalyco#602"
   while anomalyco#200 Family Businesses, anomalyco#137 Family Health and Finance, anomalyco#544 and anomalyco#584
   sat in the other 117. The API sends the total; the CLI dropped it on the floor.

   Now: {data, meta:{returned, total, truncated, limit, hint}}. Verified live —
   returned 20, total 137, truncated true.

   When the server sends no total, a FULL page is treated as truncated. Claiming
   "complete" on no evidence is exactly the failure being fixed: over-reporting
   costs one extra query, under-reporting produces a confident wrong answer.

2. `list` HAD NO FIELD CONTRACT.
   bloqs list  = 20 records x  4 fields =   2,290 bytes
   agents list = 30 records x 72 fields = 145,395 bytes
   Same verb, 63x apart. The second overflowed the MCP every time, forcing a
   spill -> jq -> narrow round-trip to answer "what agents do I have".

   LIST_FIELDS caps a listing at 8 fields — identity plus discriminators — and a
   test enforces the ceiling plus the presence of an id and a human-readable
   label, because a row you cannot follow up with `get` is not lean, it is
   useless. `agents get <id>` still returns the full record.

   Measured: agents list 145,395 -> 7,828 bytes. 18.6x. It no longer overflows.

WHY THIS RATHER THAN MORE PROMPTING. I previously diagnosed the missed-bloqs bug
as a prompt problem and wrote tool-description guidance for it. That guidance
still helps, but it was teaching models to compensate for a payload that
misleads them. A tool returning 15% of the data while looking complete will
defeat any model; one returning 145KB for a listing makes an easy question
expensive. Fix the contract, not the reader.

Shape change on --json for these two commands: consumers doing `jq '.[]'` now
need `jq '.data[]'`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

2 participants