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.

Name the agent on the dial's question, answer Codex's dialog, recap without a model

0xdiego25e8d03f5eabbc
diff --git a/cli/README.md b/cli/README.md
index 267dde6f3..1f2b568ff 100644
--- a/cli/README.md
+++ b/cli/README.md
@@ -252,7 +252,7 @@ reported as such, not described as exercised.
| `ADAPTER_CLI_DIR` | `~/.harness/cli` | install dir holding the `cli.js`/`notify.mjs` the updater swaps |
| `LOG_FRAMES` | `false` | one log line per backend frame — type, audience and opaque ids, never a payload body. Every content-bearing frame is encrypted before it reaches the socket, so this is the only way to see what the daemon actually sent |
| `HARNESS_HOOK_DEADLINE_MS` | `4500` | wall-clock budget a hook gives itself before abandoning optional work. Raise it on a slow or heavily loaded machine, where the budget is spent on load rather than on the hook and the offline registry fallback silently does nothing. Clamped, never below the default |
-| `SUMMARY_MODE` | `model` | who writes the recap HEADLINE. `model`: a one-shot of the session's own engine, fed the previous recap, the user's ask and the answer. `local`: no model — the answer's first sentence is excerpted, instantly, but each recap stands alone. The `text` under the headline is the answer's own excerpt in both modes |
+| `SUMMARY_MODE` | `local` | who writes the recap HEADLINE. `local`: no model — the answer's first sentence is excerpted, instantly; the dial shows what the terminal shows. `model`: a one-shot of the session's own engine, fed the previous recap, the user's ask and the answer — reads better across turns, at ~9s of latency per turn. The `text` under the headline is the answer's own excerpt in both modes |
| `ORI_SUMMARY_MODEL` | `deepseek/deepseek-v4-flash` | recap model for agents routed through an OpenRouter gateway (`ori claude`), which have no vendor credential to spend |
| `ORI_VOICE_ROUTE_MODEL` | `deepseek/deepseek-v4-flash` | same, for the voice router's classification |
| `ORI_CREDENTIALS_PATH` | `~/.ori/credentials.json` | where `ori login` stores its key; read only when neither the daemon env nor the agent's own process supplies one |
diff --git a/cli/src/cli.ts b/cli/src/cli.ts
index 88fe9586e..f71e049d2 100644
--- a/cli/src/cli.ts
+++ b/cli/src/cli.ts
@@ -1903,10 +1903,10 @@ async function runForeground(session: AuthSession): Promise<void> {
// SUMMARY_MODE picks the recap writer.
- // model (default) — recap = llm(instruct, previous recap, the user's ask, the answer): a disposable
+ // model — recap = llm(instruct, previous recap, the user's ask, the answer): a disposable
// one-shot of the session's own engine. The previous recap is what lets "same fix, other file"
// recap as what was done rather than as a fragment. Costs the one-shot's latency on every turn.
- // local — NO MODEL IN THE LOOP. The dial is cabled to the Mac whose window already shows this text
+ // local (default) — NO MODEL IN THE LOOP. The dial is cabled to the Mac whose window already shows this text
// in full, so the recap is a glance and the detail is one turn of the head away; the one-shot cost
// ~9s of the user's turn to say something they were already looking at. Instant, but every recap
// stands alone.
diff --git a/cli/src/config/env.ts b/cli/src/config/env.ts
index 3f48810b4..7341124fd 100644
--- a/cli/src/config/env.ts
+++ b/cli/src/config/env.ts
@@ -330,11 +330,13 @@ const envSchema = z.object({
AMP_SUMMARY_MODE: z.string().default('medium'),
// Shared recap reasoning level for Claude and Codex. Cursor effort is part of its model identifier.
SUMMARY_EFFORT: z.enum(['low', 'medium', 'high']).default('low'),
- // How the device recap is written. `model`: a disposable one-shot of the session's own engine, fed the
- // PREVIOUS recap, the user's ask and the answer — so a turn that says "same fix, other file" recaps as
- // what it did, not as a fragment; costs the one-shot's latency per turn. `local`: no model in the loop,
- // the answer's first sentence is excerpted — instant, but every recap stands alone.
- SUMMARY_MODE: z.enum(['model', 'local']).default('model'),
+ // Who writes the device recap's headline. `local` (default since 2026-09-15): no model in the loop —
+ // the answer's first sentence is excerpted, instantly; the dial shows what the terminal shows, as it
+ // shows it. `model`: a disposable one-shot of the session's own engine, fed the previous recap, the
+ // user's ask and the answer — reads better across turns, but measured at ~9s of the user's turn to
+ // rephrase "Blue selected." as "Blue selected as the colour choice" (owner: the dial is cabled to the
+ // window already showing the answer in full; the recap is a glance, not prose).
+ SUMMARY_MODE: z.enum(['model', 'local']).default('local'),
RECAP_WITHOUT_DEVICE: z.string().default('true').transform((v) => v !== 'false'),
// Model for the voice router one-shot classifier (Overview voice → pick the agent). Small/fast by default.
VOICE_ROUTE_MODEL: z.string().default('haiku'),
diff --git a/cli/src/engines/codex/askQuestion.spec.ts b/cli/src/engines/codex/askQuestion.spec.ts
index d84a9202a..e685988b1 100644
--- a/cli/src/engines/codex/askQuestion.spec.ts
+++ b/cli/src/engines/codex/askQuestion.spec.ts
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest'
import { readFileSync } from 'fs'
import { fileURLToPath } from 'url'
-import { parseEngineQuestionPane } from '../../lib/askQuestion.js'
+import { codexRowKeys, parseEngineQuestionPane } from '../../lib/askQuestion.js'
function fixture(name: string): string {
return readFileSync(fileURLToPath(new URL(`../../lib/__fixtures__/${name}`, import.meta.url)), 'utf-8')
@@ -28,4 +28,35 @@ describe('Codex question dialog', () => {
if (view?.kind !== 'question') return
expect(view.rows[0].label).toMatch(/^Yes/)
})
+
+ it('commits a request_user_input row with Enter, an approval row with the digit alone', () => {
+ const q = parseEngineQuestionPane('codex', fixture('question-codex.txt'))
+ const p = parseEngineQuestionPane('codex', fixture('permission-codex.txt'))
+ if (q?.kind !== 'question' || p?.kind !== 'question') throw new Error('fixtures did not parse')
+ expect(codexRowKeys(q.rows[0], q)).toEqual(['1', 'Enter'])
+ expect(codexRowKeys(p.rows[1], p)).toEqual(['2'])
+ })
+
+ it('reads a dialog whose top is scrolled out of the pane as still open, not as gone', () => {
+ // A four-pane window leaves Codex's dialog this much room: rows 3–5 and the footer. Row 1 and the
+ // question are above the pane. Measured 2026-09-15; the watcher used to close the dial on it.
+ const scrolled = [
+ ' sans-serif.',
+ ' 3. Mono A technical',
+ ' monospaced',
+ ' visual style.',
+ ' 4. Roboto A neutral,',
+ ' widely',
+ ' supported UI',
+ ' sans-serif.',
+ ' 5. None of the above Optionally, add',
+ ' option 1/5 | tab to add notes',
+ ' enter to submit answer',
+ ' esc to interrupt',
+ ].join('\n')
+ const view = parseEngineQuestionPane('codex', scrolled)
+ expect(view).toMatchObject({ kind: 'question', partial: true, question: '' })
+ if (view?.kind !== 'question') return
+ expect(view.rows.map((r) => r.label)).toEqual(['Mono', 'Roboto', 'None of the above'])
+ })
})
diff --git a/cli/src/lib/askQuestion.ts b/cli/src/lib/askQuestion.ts
index 85bb906d9..bdee25e44 100644
--- a/cli/src/lib/askQuestion.ts
+++ b/cli/src/lib/askQuestion.ts
@@ -60,6 +60,16 @@ export interface QuestionRow {
export interface QuestionView {
kind: 'question'
permission?: boolean
+ /**
+ * The dialog is on screen but its top — the question and its first rows — is scrolled out of the pane
+ * (Codex's request_user_input keeps the footer anchored and lets a short pane cut the top off; measured
+ * in a four-pane window: rows 3–5 and the footer visible, "1." and the question gone). Enough to know a
+ * dialog is STILL OPEN — the watcher must not close it — and not enough to announce as a question.
+ */
+ partial?: boolean
+ /** The footer says a digit only highlights and Enter commits (`enter to submit answer` — Codex's
+ * request_user_input). Absent where one digit selects and submits, which is every other dialog. */
+ enterSubmits?: boolean
question: string
rows: QuestionRow[]
multi: boolean
@@ -514,6 +524,10 @@ export function parseQuestionPane(capture: string): PaneView {
if (/^\s*[❯›>]?\s*\d+\.\s+\[/.test(lines[i])) checkbox = true
if (row.number === '1') { start = i; break }
}
+ const enterSubmits = /enter to submit answer/i.test(lines[footer])
+ if (rows.length && start < 0 && enterSubmits) {
+ return { kind: 'question', partial: true, enterSubmits, question: '', rows, multi: checkbox, typeRow: null }
+ }
if (start < 0 || rows.length === 0) return null
// The question is the nearest real text line above the rows. The dialog paints it between its header
@@ -533,6 +547,7 @@ export function parseQuestionPane(capture: string): PaneView {
const answerable = rows.filter((r) => !CHAT_ROW.test(r.label) && !TYPE_ROW.test(r.label))
return {
kind: 'question',
+ ...(enterSubmits ? { enterSubmits } : {}),
question,
rows: answerable,
multi: checkbox,
@@ -549,8 +564,9 @@ export function parseQuestionPane(capture: string): PaneView {
* draws an unnumbered list navigated with the arrow keys, so its rows carry an index and are reached by
* walking down to them.
*/
-function rowKeys(engine: AgentEngine, row: QuestionRow): string[] {
+function rowKeys(engine: AgentEngine, row: QuestionRow, view?: QuestionView): string[] {
if (engine === 'amp') return ampSelectionKeys(row)
+ if (engine === 'codex') return codexRowKeys(row, view)
// Kilo's rows sit side by side, so its walk is horizontal — see engines/kilo/askQuestion.ts.
if (engine === 'kilo') return kiloSelectionKeys(row)
// Same dialog, different engine: opencode numbers its ask dialog but not its permission prompt, so the
@@ -560,6 +576,16 @@ function rowKeys(engine: AgentEngine, row: QuestionRow): string[] {
return [row.number]
}
+/**
+ * Codex, measured 2026-09-15 on 0.149: in its request_user_input dialog a digit only MOVES the highlight
+ * and Enter submits (`enter to submit answer`) — a digit alone left the dialog up and the device's answer
+ * reported as stuck. Its approval prompt is the other way round and was verified earlier: one digit
+ * selects and commits, so that one keeps the single key.
+ */
+export function codexRowKeys(row: QuestionRow, view?: QuestionView): string[] {
+ return view?.enterSubmits ? [row.number, 'Enter'] : [row.number]
+}
+
export function matchRow(rows: QuestionRow[], answer: string): QuestionRow | null {
const a = norm(answer)
if (!a) return null
@@ -669,6 +695,14 @@ export class AskQuestionController {
return answered > 0
}
if (!allowPermissions && view.kind === 'question' && view.permission) return false
+ if (view.kind === 'question' && view.partial) {
+ // The dialog's top is out of the pane. If we have keyed an answer it has not been taken yet;
+ // give the TUI a beat. If we have not, there is nothing to match an answer against.
+ if (answered === 0) { console.warn('[question] dialog scrolled out of view — cannot key an answer'); return false }
+ if (++repeats >= 2) { console.warn('[question] dialog stuck (scrolled)'); return false }
+ await wait(STEP_MS)
+ continue
+ }
if (view.kind === 'review') {
if (!allowPermissions && answered === 0) return false
return this.deps.sendKey(terminalTarget, view.submitRow)
@@ -713,7 +747,7 @@ export class AskQuestionController {
if (row) {
// One digit selects AND submits — except on Amp, whose rows are unnumbered and reached by
// walking the list, so this is a short sequence rather than a single key.
- for (const key of rowKeys(engine, row)) {
+ for (const key of rowKeys(engine, row, view)) {
if (!await this.deps.sendKey(terminalTarget, key)) return false
await wait(TEXT_MS)
}
@@ -927,6 +961,12 @@ export class QuestionWatcher {
if (blocked) return
const engine = this.deps.getSession(sessionId)?.engine ?? 'claude'
const view = parseEngineQuestionPane(engine, await this.deps.capture(terminalTarget, CAPTURE_LINES) ?? '')
+ if (view?.kind === 'question' && view.partial) {
+ // Scrolled so its top is out of the pane: still open, so the client showing it keeps showing it —
+ // but there is no question text to announce, and the rows in view are whichever the scroll left.
+ this.misses.delete(sessionId)
+ return
+ }
if (!view || view.kind !== 'question' || !view.question || view.rows.length === 0) {
// Dialog closed, or moved to review. Either way it is no longer waiting on anybody, so the clients
// showing it are told to stop — see noteGone for why this is not announced on the first miss.
diff --git a/cli/src/lib/summarize.spec.ts b/cli/src/lib/summarize.spec.ts
index f8afd703b..8347c649d 100644
--- a/cli/src/lib/summarize.spec.ts
+++ b/cli/src/lib/summarize.spec.ts
@@ -42,7 +42,7 @@ vi.mock('./oneshot.js', () => ({
shutdownOneShotPool: vi.fn(),
}))
-import { deriveTurnBody, summarizeTurnText, syncSummaryPoolSessions } from './summarize.js'
+import { deriveTurnBody, summarizeTurnText, syncSummaryPoolSessions, deriveTurnSummary } from './summarize.js'
beforeEach(() => {
mocks.runClaude.mockReset()
@@ -330,3 +330,22 @@ describe('the body under the headline', () => {
expect(prompt).not.toContain('two parts')
})
})
+
+describe('deriveTurnSummary (the local recap)', () => {
+ it('headlines the END of the answer, not its opening line', () => {
+ // A Codex turn that asked a question: the engine's first message announces the question, its last
+ // states the outcome a minute later. The terminal is showing the outcome when the recap lands.
+ const text = 'I’ll ask for the colour choice.\n\nBlue selected.'
+ expect(deriveTurnSummary(text)?.split('\n')[0]).toBe('Blue selected.')
+ })
+
+ it('still skips a label at the top of the closing paragraph', () => {
+ const text = 'Working on it.\n\nKết quả:\nĐã sửa xong file cấu hình.'
+ expect(deriveTurnSummary(text)?.split('\n')[0]).toBe('Đã sửa xong file cấu hình.')
+ })
+
+ it('keeps the whole answer in the body', () => {
+ const text = 'I’ll ask for the colour choice.\n\nBlue selected.'
+ expect(deriveTurnSummary(text)?.split('\n\n')[1]).toBe('I’ll ask for the colour choice. Blue selected.')
+ })
+})
diff --git a/cli/src/lib/summarize.ts b/cli/src/lib/summarize.ts
index ac8de51fa..d9438e93d 100644
--- a/cli/src/lib/summarize.ts
+++ b/cli/src/lib/summarize.ts
@@ -224,10 +224,21 @@ export function deriveTurnSummary(text: string): string | null {
const stripped = stripMarkdown(text)
const body = stripped.replace(/\s+/g, ' ').trim()
if (!body) return null
- const recap = clip(firstProseLine(stripped) || body, RECAP_MAX_CHARS)
+ // The LAST part of the answer, not the first. A turn's assistant text is every message the engine
+ // wrote in it, oldest first (normalize.ts joins them with a blank line) — and an engine that asks a
+ // question opens with "I'll ask for the colour choice." and closes, a minute later, with "Blue
+ // selected." The headline is the conclusion, which is what the terminal is showing when the recap
+ // lands; the body below still carries the whole answer.
+ const recap = clip(firstProseLine(lastParagraph(stripped)) || body, RECAP_MAX_CHARS)
return `${recap}\n\n${deriveTurnBody(text)}`
}
+/** The final blank-line-separated block of an answer that has any prose in it. */
+function lastParagraph(stripped: string): string {
+ const paragraphs = stripped.split(/\n\s*\n/).map((p) => p.trim()).filter((p) => /[\p{L}\p{N}]/u.test(p))
+ return paragraphs.at(-1) ?? stripped
+}
+
/** The `text` under a recap: the answer flattened to one line and clipped — a glance, never a
* paraphrase. Shared by both recap writers so the body reads the same whoever wrote the headline. */
export function deriveTurnBody(text: string): string {
diff --git a/device/esp32-circle/main/ui/ui_screens.c b/device/esp32-circle/main/ui/ui_screens.c
index 2a0c7b6b1..f17e72dca 100644
--- a/device/esp32-circle/main/ui/ui_screens.c
+++ b/device/esp32-circle/main/ui/ui_screens.c
@@ -6908,6 +6908,25 @@ static void q_render(void)
{
lv_obj_clean(scr_question);
qitem_t *q = &s_q.q[s_q.idx];
+ // WHO is asking, above the question (owner, 2026-09-15: "noti cần thêm tên của agent ở phía trên …
+ // để user có thêm context ra quyết định"). The same question — "switch to the cheaper model?" —
+ // means different things from a scratch agent and from the one mid-deploy. Muted, small, one line:
+ // an eyebrow, not a second title.
+ {
+ int ai = find_proj(s_q.project);
+ if (ai >= 0 && s_proj[ai].name[0]) {
+ static char who[64];
+ utf8_filter(s_proj[ai].name, who, sizeof(who));
+ lv_obj_t *l = lv_label_create(scr_question);
+ lv_label_set_long_mode(l, LV_LABEL_LONG_DOT);
+ lv_obj_set_width(l, lv_pct(100));
+ lv_obj_set_style_text_font(l, &geist_sem_24, 0);
+ lv_obj_set_style_text_color(l, COL_MUTED, 0);
+ lv_obj_set_style_text_align(l, LV_TEXT_ALIGN_CENTER, 0);
+ lv_obj_set_style_pad_bottom(l, 2, 0);
+ lv_label_set_text(l, who);
+ }
+ }
static char tmp[256];
utf8_filter(q->text, tmp, sizeof(tmp));
q_add_text(tmp[0] ? tmp : "?", COL_FG, &geist_med_32); // prompt = title
@@ -7084,6 +7103,10 @@ void ui_question_show(const char *project_id, const char *session_id, const char
lv_screen_load(scr_question);
display_unlock();
audio_notify_done(); // audible alert so the user notices a question is waiting
+ // …and bring the window to the same agent, so the question can be judged against what it is doing.
+ // The same `open` a notification tap sends: the window finds the tab that holds the agent — the
+ // current one first — or opens one for it (owner, 2026-09-15, "rule vẫn như cũ").
+ if (s_q.project[0]) cable_client_send_open(s_q.project);
}
// ── Machine picker (Settings → Machines) ──────────────────────────────────────────────────────────────