You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4871e96
Browse filesBrowse the repository at this point in the historyBrowse files
fix(server): strip OSC/ANSI escapes from OpenCode CLI inventory and stored agent selections
opencode <=1.18 writes ESC ]0;<cwd>: ready BEL to stdout for every
non-help command even when stdout is a pipe (agent list, models
--verbose, debug skill). T3's ChildProcessSpawner captures that stdout
via collectStreamAsString and the parsers stored a polluted agent id
like "\x1b]0;imbios: ready\x07build" in model_selection_json.
Later sendTurn used that polluted id and opencode rejected it with
"Agent not found: \"\x1b]0;imbios: ready\x07build\"" which was
surfaced as session.error UnknownError + a generic SessionPrompt
UnknownError wrapper (the stack the user pasted).
Fix:
- packages/shared/src/stripTerminalEscapes.ts: shared OSC/CSI sanitizer
- apps/server/src/provider/opencodeRuntime.ts: strip before
parseModels/Agent/Skills and via parse* entry points; keeps skills
from silently degrading to [] when polluted
- apps/server/src/provider/Layers/OpenCodeProvider.ts: sanitize
inventory agent names/variants and --version parsing; build clean
capability option ids
- apps/server/src/provider/Layers/OpenCodeAdapter.ts &
textGeneration/OpenCodeTextGeneration.ts: sanitize stored
getModelSelectionStringOptionValue values before promptAsync
- packages/shared/src/model.ts: sanitize persisted option values and
model slugs on read (repairs 3 polluted threads without DB migration)
- tests: add OSC/ANSI regression cases for both parsers
Polluted threads still read as clean via model.ts sanitizer; no
migration needed but DB can be cleaned with stripTerminalEscapes.
Fixes the reported UnknownError at SessionPrompt.createUserMessage
and the earlier "Agent not found" session.error.
0 commit comments