Skip to content

Fix engine output limits, model refusals and a false thread 404 - #138

Merged
abhishekgahlot2 merged 12 commits into
mainfrom
fix/engine-and-gateway-bugfixes
Oct 13, 2026
Merged

abhishekgahlot2 merged 12 commits into
mainfrom
fix/engine-and-gateway-bugfixes

Conversation

@abhishekgahlot2

@abhishekgahlot2 abhishekgahlot2 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Bug fixes for engines, the provider gateway, output delivery and the thread page.

  • Thread page: a failed load (network error or 5xx) is retried once and then shown as an error the page can retry, not as "not found". Only 401, 403 and 404 mean the thread is missing.
  • Engine output limits: OpenCode and Claude Code asked Claude Opus 5, Sonnet 5 and Fable 5 for 128,000 output tokens, past the gateway's 65,536 ceiling, so those calls were refused before they were sent. Both engines now ask for at most 64,000.
  • Claude Code model slots: the native wrapper never passed the run's model slots, so Claude Code's helper and subagent calls asked for another model and were refused. The per-run settings file now carries them, along with the API key helper TTL.
  • Anthropic refusals: an over-limit max_tokens or a model the run does not use now gets Anthropic's own 400 invalid_request_error, not a 403 that Claude Code retried as an authentication failure.
  • Gateway logging: every request refused before its audit row logs one line with the run, status, reason and auth scheme (never a value).
  • Request depth: provider request bodies nested past 64 levels get a 400, not a stack overflow and a 500.
  • Slack: a binding in SLACK_USER_BINDINGS or SLACK_WORKSPACE_BINDINGS that the database refuses (workspace disconnected, org or user gone) is logged and skipped instead of failing boot.
  • Output delivery: a turn that changed many files, or left an empty or oversized file, no longer fails the finished run. A dropped sandbox listing is retried, and if the sandbox still answers the run finishes with a note. Linked files stay required, and a listing that exits non-zero or comes back wrong still fails delivery.
  • Code citations: a link anchored to a line (path:118, #L10-L20) is a citation, not a required output, so review replies no longer fail delivery.
  • Gateway timeline events are written insert-only, so the restricted gateway database role can record artifact cards and skill, memory, knowledge and approval frames.
  • Sandbox Chrome uses its basic password store, so saving a password no longer opens a keyring prompt that dims the desktop.

Each fix has its own commit and tests.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

A 5xx or network failure while loading a thread returned an empty thread, which the page rendered as not found. Only 401, 403 and 404 mean the thread is not there; anything else is tried once more and then thrown to the error page, which can retry.
A 100,000-deep body overflowed the stack when the body policy re-serialized it, and the gateway answered 500. A one-pass depth scan now runs before any provider's body policy and answers 400 request_too_deep.
A refusal before the audit row left no trace, so an engine's request refused for output_limit_exceeded showed up only as the engine's own authentication error. One line now names the run, status, reason (with the binding a forbidden capability failed) and the auth header scheme, never a value.
An over-limit max_tokens or a model the run does not use got the gateway's 403, which Claude Code reads as an authentication failure and retries ten times. The Anthropic route now answers with an invalid_request_error 400 that names the reason, so the turn ends with it.
…models

OpenCode takes its catalog's 128,000 output tokens for Claude Opus 5, Sonnet 5 and Fable 5, and Claude Code asks the same of a 1M-context model, past the gateway's 65,536 ceiling, so those calls were refused before they were sent. One cap of 64,000 now rides OpenCode's model limits and Claude Code's managed settings, together with the API key helper TTL the native wrapper never exported.
The native wrapper exports only the gateway URL and config dir, so the model slots never reached Claude Code: its Haiku helper and subagents asked for another model and the gateway refused them. The per-run settings file now carries the same slots the process environment does.
Replacing the Slack workspace in Settings deleted the old team's row while SLACK_USER_BINDINGS still bound a user to it. The boot sync's foreign key error exited the backend on every start. Integrity refusals are now logged and skipped; other database errors still fail boot.
A turn that changed hundreds of files in a project tree failed after the work was done with 'Artifact delivery failed', because more than 20 changed deliverables, one empty file or one over 50 MiB threw out of automatic discovery and failed the whole run. Discovery now skips empty and oversized files, falls back to the workspace's own top-level files when a project tree overflows (Rust target/ is pruned too), linked outputs count first and stay strict, and the summary says when changed files were left out. A delivery failure now logs its kind and SQLSTATE.
A dropped sandbox request during automatic output discovery failed finished runs with 'Artifact delivery failed' even when the agent had made no files, and a resend worked. A listing that never came back is repeated twice. If it still fails while the run's bound sandbox answers a trivial command, the run finishes with a note and every file the agent linked still delivers. A listing that exits non-zero, comes back wrong, or a sandbox that is gone or rebound still fails delivery. Logs carry the sandbox RPC code.
Review agents cited repo lines as local links (/root/work/repo/infra/deploy-app.sh:118). Every local link was a required output, and a path ending in :118 is no file, so each finished review failed with 'Artifact delivery failed'. A link anchored to a line (:12, :12:3, #L12, #L12-L20) is a citation now and stays as written.
…ord them

recordProviderEvent upserts, and its ON CONFLICT update touches the native id columns the restricted gateway role may not update, so Postgres refused every such write from the gateway. The error was retried, logged and swallowed: a workpiece_create artifact lost its artifact.created event and showed as a plain link instead of a card, and skill.loaded, memory, knowledge.retrieved and approval-card frames written from the gateway were lost too. These writes now use recordProviderEventIfAbsent. The ids are fixed per event, so nothing relied on rewriting, and failures stay non-fatal where they were. Authoring records its event on every call, so a retry heals a missing one.
Saving a password typed into the sandbox Chrome asked gnome-keyring to create or unlock a keyring, and its system prompt dims the whole desktop behind a dialog. Chrome now uses its basic password store.
@abhishekgahlot2
abhishekgahlot2 merged commit 55befd9 into main Oct 13, 2026
19 checks passed
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