Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

fix(muse): stop scraping a running turn into a question nobody asked

0xdiego25446063cb5dd7
diff --git a/cli/src/engines/muse/askQuestion.spec.ts b/cli/src/engines/muse/askQuestion.spec.ts
index 82a8c04e4..287b9db6e 100644
--- a/cli/src/engines/muse/askQuestion.spec.ts
+++ b/cli/src/engines/muse/askQuestion.spec.ts
@@ -46,4 +46,21 @@ describe('muse question dialog', () => {
expect(parseMuseQuestionPane('just some prose\n⟩ ')).toBeNull()
expect(parseMuseQuestionPane('Enter to select · ↑/↓ to move')).toBeNull() // footer with no rows
})
+
+ it('does not invent a question out of a RUNNING turn that printed a numbered list', () => {
+ // Reported live: "read the source of this html file" → the device showed options to pick from while
+ // the terminal asked nothing. `esc to interrupt` is muse's running-turn status line, and it used to
+ // anchor this parser; the numbered lines in the file's own output then became the options and the
+ // bullet above them became the question.
+ const running = [
+ '⟩ read source in autonomous-harness folder to get context',
+ '◆ Bash (12s)',
+ ' • 5 Features:',
+ ' 1. Offline-first, no server needed',
+ ' 2. Next.js clone, ready locally',
+ ' 3. Instant setup',
+ '✧ Working… esc to interrupt • 23s',
+ ].join('\n')
+ expect(parseMuseQuestionPane(running)).toBeNull()
+ })
})
diff --git a/cli/src/engines/muse/askQuestion.ts b/cli/src/engines/muse/askQuestion.ts
index 6fb0a9a3d..b572152ed 100644
--- a/cli/src/engines/muse/askQuestion.ts
+++ b/cli/src/engines/muse/askQuestion.ts
@@ -20,7 +20,22 @@
import type { PaneView, QuestionRow } from '../../lib/askQuestion.js'
const ROW_RE = /^\s*[›>]?\s*(\d+)[.)]\s+(.+?)\s*$/
-const FOOTER_RE = /enter to select|↑\/↓ to move|esc to interrupt/i
+/**
+ * The dialog's footer, and ONLY the dialog's. It is one line:
+ *
+ * Enter to select · ↑/↓ to move · Tab for an optional note · Esc to interrupt
+ *
+ * `esc to interrupt` used to be a third alternative here. It is a SUFFIX of that same line, so it bought
+ * nothing — and it is also what muse prints on its own status line for any RUNNING turn (see
+ * sessionInput.ts, which relies on exactly that). Any turn whose output happened to contain numbered
+ * lines therefore anchored here and was scraped into a question that nobody asked: reading an HTML file
+ * with a numbered feature list produced the "question" `• 5 Features:` on the device while the terminal
+ * showed no dialog at all.
+ *
+ * `enter to select` is the robust anchor of the two kept: the line is long, and a narrow pane truncates
+ * from the END, which takes `Esc to interrupt` first and leaves this untouched.
+ */
+const FOOTER_RE = /enter to select|↑\/↓ to move/i
/** Opens a free-text editor; the device's question screen cannot type, so it is never an answer. */
const NOT_AN_ANSWER = /^none of the above\b/i