Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
agent: stop claiming a window opened; point the model at the present tool (T9, O6, #3576)
Niko12217d5558152757
diff --git a/apps/host/server/agent/events.mjs b/apps/host/server/agent/events.mjsindex a8b82de85..67908509e 100644--- a/apps/host/server/agent/events.mjs+++ b/apps/host/server/agent/events.mjs@@ -157,6 +157,9 @@ export function withPlain(raw) {return plain ? `${plain}\n\nDetails: ${raw.replace(/^Error:\s*/, '')}` : raw;}+/** What a launch that printed nothing proves, and no more. */+export const LAUNCHED_TEXT = 'The command finished without an error, so the program was started. Strata cannot confirm that a window or page actually opened.';+/** A command whose whole point is to open something: it has no output to show when it worked. */const LAUNCH = /(^|[\s;|&(])(start-process|start|invoke-item|ii|explorer(?:\.exe)?|xdg-open|open|notepad(?:\.exe)?|code)(?=[\s;|&)]|$)/i;@@ -172,9 +175,10 @@ export function outcomeText(tool, text, args = {}) {text = text.replace(/\r?\n?\[stderr\]\r?\n(?:Cannot create type\. Only core types are supported in this language mode\.[\s\S]*?CannotCreateTypeConstrainedLanguage\s*)+$/, '');if (!text.trim()) text = '(no output)';}- // Starting a program or opening a folder prints nothing when it worked. The model used to read "finished, nothing to show" as "cannot tell- // whether it opened" and told the person so; a launch that returned without an error did start, and the result says that plainly.- if ((tool === 'pwsh' || tool === 'bash') && /^\(no output\)$/.test(text.trim()) && LAUNCH.test(String(args?.command ?? ''))) return 'Started. The program, folder or file was opened.';+ // Starting a program or opening a folder prints nothing when it worked, and also when it did not (a browser given a file:// address, a+ // program that closed at once). T9 / #3576: the card used to say "was opened", and the model repeated it ("I previewed it in a browser to+ // confirm it renders"). It says what is known: the command returned without an error.+ if ((tool === 'pwsh' || tool === 'bash') && /^\(no output\)$/.test(text.trim()) && LAUNCH.test(String(args?.command ?? ''))) return LAUNCHED_TEXT;if ((tool === 'pwsh' || tool === 'bash') && /^\(no output\)$/.test(text.trim())) return 'The command finished without any error. It printed nothing, so there is nothing more to show.';return text;}diff --git a/apps/host/server/agent/plan.mjs b/apps/host/server/agent/plan.mjsindex 68ac9312d..9ec6e3ddd 100644--- a/apps/host/server/agent/plan.mjs+++ b/apps/host/server/agent/plan.mjs@@ -117,7 +117,7 @@ export function stepObjective(plan, index) {`You are on step ${index + 1} of ${n}: ${s.text}${s.detail ? ` (${s.detail})` : ''}.`,done ? `Already done: ${done}.` : '',plan.briefing ? String(plan.briefing) : '',- isViewStep(s.text) ? 'This step is about seeing the result in a browser. Never wait for a program to close. If a person is at this computer, start the browser so the command returns at once (Windows: Start-Process; macOS: open; Linux: xdg-open) and say it is open. If there is no screen, check the page without a visible window: use the headless browser tool if you have one, otherwise read the file and its script for mistakes, and say in one plain sentence what you could and could not check. Then finish the step.' : '',+ isViewStep(s.text) ? 'This step is about seeing the result. To show a local image, SVG, HTML page or PDF, use the present tool (a browser cannot open file:// addresses). Never wait for a program to close. If a person is at this computer and you start a browser, start it so the command returns at once (Windows: Start-Process; macOS: open; Linux: xdg-open) and say only that you started it, not that the page rendered. If there is no screen, check the page without a visible window: use the headless browser tool if you have one, otherwise read the file and its script for mistakes, and say in one plain sentence what you could and could not check. Then finish the step.' : '','Do only this step, check that it worked, and then finish the goal.',index + 1 < n ? 'The next steps are handled separately: do not start them.' : '',].filter(Boolean).join(' ');diff --git a/apps/host/server/agent/preset.mjs b/apps/host/server/agent/preset.mjsindex 6088b4f93..5927959ad 100644--- a/apps/host/server/agent/preset.mjs+++ b/apps/host/server/agent/preset.mjs@@ -42,8 +42,8 @@ export const AGENT_PROMPT = ['You are a helpful assistant that can also work on this computer through your tools. You are running as {{model}}.','Answer questions directly and briefly; use a tool only when the task needs one. The person reads your replies in a chat: use plain words, not tool names or technical jargon.','Look before you change: read a file before you edit or overwrite it, and prefer a small edit to a rewrite. Search with the glob and grep tools and read files with the read tool; use the shell for running programs.',- 'When you start a program or open a folder or file for the person, the command returning without an error means it worked: say plainly that it is open. Do not say you could not confirm it. If a command fails, say what went wrong in one sentence and what you will try next.',- 'To open a page or a file for the person (a browser, an app, a folder), start it so the command returns at once and never wait for the program to close: on Windows use Start-Process, on macOS open, on Linux xdg-open. Then say plainly that it is open.',+ 'A command that starts a program, folder or page only tells you that it started. Never say a window opened, a page rendered or that you checked how it looks unless a tool confirmed it. If a command fails, say what went wrong in one sentence and what you will try next.',+ 'To show the person an image, SVG, HTML page or PDF from their folders, use the present tool: the app shows it next to the chat. A browser cannot open file:// addresses. If you do start a program, start it so the command returns at once and never wait for it to close: Start-Process on Windows, open on macOS, xdg-open on Linux.','When the person asks you to ask a subagent, a helper or another model ("ask a subagent", "ask model X"), use the subagent tool and name the model in its model field. Never look for a model with shell commands, and never wait for a helper with sleep: end your turn; its answer arrives as a new message.','Tokens prefixed with @ are files or folders the person pointed at. A failed or refused action changed nothing; say so, and do not claim work you did not do.',].join('\n\n');diff --git a/apps/host/tests/functional-fixes.test.mjs b/apps/host/tests/functional-fixes.test.mjsindex b83b93e28..534107a60 100644--- a/apps/host/tests/functional-fixes.test.mjs+++ b/apps/host/tests/functional-fixes.test.mjs@@ -96,22 +96,28 @@ test('item 7: tool rows say what happened in plain words, with what it was about}});-test('item 8: starting a program that prints nothing is reported as started, plainly', () => {+test('item 8 / T9: starting a program that prints nothing is reported as started, never as opened', () => {for (const command of ['Start-Process explorer.exe C:\\work', 'explorer.exe C:\\work', 'start notepad', 'Invoke-Item C:\\work\\a.pdf', 'ii .', 'xdg-open .', 'open .']) {- assert.match(outcomeText('pwsh', '(no output)', { command }), /^Started\./, command);+ const said = outcomeText('pwsh', '(no output)', { command });+ assert.match(said, /^The command finished without an error, so the program was started\./, command);+ assert.match(said, /cannot confirm that a window or page actually opened/, command);+ assert.ok(!/was opened|is open/i.test(said), command);}assert.match(outcomeText('pwsh', '(no output)', { command: 'New-Item x.txt | Out-Null' }), /finished without any error/, 'other silent commands keep their wording');assert.equal(outcomeText('pwsh', 'hello', { command: 'echo hello' }), 'hello', 'a command that printed something shows it');const p = new TurnProjector({ startedAt: 0 });p.consume(ev('tool/call', { callId: 'e1', name: 'pwsh', arguments: JSON.stringify({ command: 'Start-Process explorer.exe C:\\work' }) }));const res = p.consume(ev('tool/result', { message: { toolCallId: 'e1', content: [{ type: 'text', text: '(no output)' }] } }))[0].tool;- assert.match(res.result, /^Started\./); assert.equal(res.verb, 'Ran a command');+ assert.match(res.result, /cannot confirm that a window or page actually opened/); assert.equal(res.verb, 'Ran a command');});test('item 7/10: our prompt has no internal terms and is short', () => {assert.ok(AGENT_PROMPT.length < 1600, `${AGENT_PROMPT.length} chars`);assert.doesNotMatch(AGENT_PROMPT, /DSH|DeepSeek|sandbox|isolated session|file policy|Harness/i);- assert.match(AGENT_PROMPT, /do not say you could not confirm/i);+ // O6 / #3576: the prompt points at the present tool for local files and never tells the model to claim a window opened+ assert.match(AGENT_PROMPT, /use the present tool/);+ assert.match(AGENT_PROMPT, /Never say a window opened, a page rendered/);+ assert.doesNotMatch(AGENT_PROMPT, /say plainly that it is open|do not say you could not confirm/i);});test('items 3, 7, 10: what the agent sends the model is small, plain, and carries Thinking Off', { skip }, async t => {