Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

Merge pull request #11814 from atomantic/claim/issue-11797

[._.]/c48dbe34d040
diff --cc server/lib/tuiHandshake.js
index 332832a74a,4ad1866f39..fce44ee2cb
--- a/server/lib/tuiHandshake.js
+++ b/server/lib/tuiHandshake.js
@@@ -463,10 -463,34 +463,36 @@@ export const AGY_INPUT_READY_PATTERN =
export const OPENCODE_INPUT_READY_PATTERN = /askanything/i;
// The update offer overlays the composer and defaults to Confirm. Escape
// closes it without installing software or changing the operator's settings.
-const OPENCODE_UPDATE_PROMPT_PATTERN = /updateavailable.*anewreleasev[\d.]+isavailable\.wouldyouliketoupdatenow\?/i;
+// Match the heading and release announcement: the following question wraps
+// across screen rows with composer-border glyphs interleaved in the PTY stream.
+const OPENCODE_UPDATE_PROMPT_PATTERN = /updateavailable.*anewreleasev[\d.]+isavailable\./i;
+ // OpenCode rejects a model it cannot resolve with a startup toast, then paints
+ // its composer with a DIFFERENT model — so the composer-ready signal is not
+ // proof the task's model is the one that will answer. Matched against a tail
+ // with whitespace AND box/block glyphs removed, because the toast wraps across
+ // rows with the border between them. The id must be `provider/model`: that
+ // shape keeps the whitespace-stripped match from firing on ordinary prose.
+ const OPENCODE_MODEL_REJECTION_PATTERN = /Model([A-Za-z0-9][\w.-]*\/[\w.:@+/-]*?)isnotvalid/i;
+ const BOX_AND_BLOCK_GLYPHS = /[\s\u2500-\u259F]+/g;
+
+ /**
+ * Error analysis for an OpenCode startup model rejection. `model-not-found` is
+ * a request-specific category, so the cooldown policy leaves the provider's
+ * other models available (see isRequestSpecificCategory).
+ */
+ function describeOpencodeModelRejection(rejectedModel) {
+ return {
+ category: ERROR_CATEGORIES.MODEL_NOT_FOUND,
+ actionable: true,
+ origin: 'provider',
+ message: `OpenCode rejected the selected model "${rejectedModel}" at startup, so no prompt was sent.`,
+ suggestedFix: 'Choose a model that `opencode models` lists for this provider, or clear the model override to use the CLI default. PortOS did not change any model setting.',
+ escalation: 'Pick a model OpenCode accepts (or clear the override to use the CLI default), then approve the retry.',
+ affectedModel: rejectedModel,
+ };
+ }
+
// Handshake markers are matched against a rolling window of whitespace-stripped
// output rather than a single chunk, so a marker split across two PTY reads
// (`? for short` | `cuts`) still matches. Sized to a few screens of chrome.