The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: keep multiline delegation goals out of Desktop report bodies
Tekniumf6a4a5adde2e
diff --git a/apps/desktop/src/lib/async-report.test.ts b/apps/desktop/src/lib/async-report.test.tsindex 3075201a32a..e134b655fc7 100644--- a/apps/desktop/src/lib/async-report.test.ts+++ b/apps/desktop/src/lib/async-report.test.ts@@ -38,7 +38,7 @@ describe('async report hydration', () => {})it('separates batch result blocks without leaking preambles or transcript plumbing', () => {- const content = `[ASYNC DELEGATION BATCH COMPLETE — batch]\nPrivate instructions\nRole: leaf\n\n--- ✓ TASK 1/2: private goal (status=completed) ---\n${report}\nFull live transcript (complete tool/assistant trace): /private/path\n\n--- ✓ TASK 2/2 (status=completed) ---\nPlain result`+ const content = `[ASYNC DELEGATION BATCH COMPLETE — batch]\nPrivate instructions\nRole: leaf\n\n--- ✓ TASK 1/2: private goal (status=completed) ---\n${report}\nFull live transcript (complete tool/assistant trace): /private/path\n\n--- ✓ TASK 2/2: private goal\nprivate continuation (status=completed) ---\nPlain result`expect(hydrate(content).metadata.custom.asyncResult).toBe(`${report}\n\nPlain result`)expect(hydrate('[ASYNC DELEGATION COMPLETE — malformed]\nPrivate instructions').metadata.custom.asyncResultdiff --git a/apps/desktop/src/lib/chat-messages/hydration.ts b/apps/desktop/src/lib/chat-messages/hydration.tsindex 53fc0cebe94..df3b765df39 100644--- a/apps/desktop/src/lib/chat-messages/hydration.ts+++ b/apps/desktop/src/lib/chat-messages/hydration.ts@@ -166,7 +166,8 @@ function asyncResultBody(content: string): string | undefined {if (content.startsWith('[ASYNC DELEGATION')) {if (content.startsWith('[ASYNC DELEGATION BATCH COMPLETE')) {- bodies = content.split(/^--- [✓✗⚠] TASK [^\n]+ ---\r?\n/gm).slice(1)+ // Task goals can span lines; stopping at a newline leaks the next goal and transcript footer.+ bodies = content.split(/^--- [✓✗⚠] TASK \d+\/\d+(?:: [\s\S]*?)? {2}\(status=[^\n]*\) ---\r?\n/gm).slice(1)} else {const result = content.match(/^--- (?:RESULT|ERROR) ---\r?\n/m)bodies = result ? [content.slice(result.index! + result[0].length)] : []diff --git a/evals/desktop_bug_campaign/async-report-README.md b/evals/desktop_bug_campaign/async-report-README.mdnew file mode 100644index 00000000000..45d4cb35272--- /dev/null+++ b/evals/desktop_bug_campaign/async-report-README.md@@ -0,0 +1,35 @@+# Async report rendering probe++Offline integration proof for Desktop async completion reports. The producer creates+synthetic output, passes it through the real cron manual-completion formatter,+process notification formatter, durable delivery and SQLite, then reads actual rows.+The browser imports production hydration, runtime, SystemMessage and Desktop CSS.+No model, scheduled job or user configuration is used.++From the repository root with the normal Python and npm dependencies installed:++```sh+export HOME=$(mktemp -d)+export HERMES_HOME="$HOME/.hermes"+export ASYNC_REPORT_ARTIFACT_DIR=$(mktemp -d)+# If Chromium is installed outside the temporary HOME, set+# PLAYWRIGHT_BROWSERS_PATH to that installation's browser cache.+.venv/bin/python evals/desktop_bug_campaign/async-report-producer.py "$ASYNC_REPORT_ARTIFACT_DIR/producer.json"+node evals/desktop_bug_campaign/async-report-vite.mjs+# In another shell with the same environment:+node evals/desktop_bug_campaign/async-report-live.mjs before+node evals/desktop_bug_campaign/async-report-live.mjs after+```++The Vite probe binds loopback port 18164. Stop it after verification. The pinned+baseline hydration is from commit `a688e7d5ff9aeaaa9c97d28c316467f89ab8c943`;+all other renderer modules are the current checkout. Compare the emitted JSON and+screenshots: cron/delegation/batch/legacy Markdown headings and tables are absent+before and present after, plain results survive, malformed envelopes remain compact,+and task goals/context/transcript footer paths do not render. Batch goals include a+multiline case because the producer does not flatten them.++This is producer/store integration plus live Chromium rendering, **not** scheduled+execution, completion-poller/HTTP/WebSocket E2E, Bot Chat routing, or native macOS QA.+The `process` case means an async-delegation event through the process notification+formatter, not a terminal-process completion event. All fixtures are synthetic.diff --git a/evals/desktop_bug_campaign/async-report-live.mjs b/evals/desktop_bug_campaign/async-report-live.mjsindex e7fc7b8e31e..3e64ecbe7cf 100644--- a/evals/desktop_bug_campaign/async-report-live.mjs+++ b/evals/desktop_bug_campaign/async-report-live.mjs@@ -1,9 +1,10 @@import { chromium } from '../../node_modules/playwright/index.mjs'import fs from 'node:fs'import { execFileSync } from 'node:child_process'-const a='/home/teknium/.hermes/cache/desktop-bugs-74848ed3/followups/async-reports'+const a=process.env.ASYNC_REPORT_ARTIFACT_DIR+if (!a) throw new Error('Set ASYNC_REPORT_ARTIFACT_DIR to an offline artifact directory')const tag=process.argv[2]??'after'-const browser=await chromium.launch({headless:false,args:['--no-sandbox']})+const browser=await chromium.launch({headless:true,args:['--no-sandbox']})const page=await browser.newPage({viewport:{width:1400,height:1000}})const errors=[];page.on('pageerror',e=>errors.push(String(e)))const producer=JSON.parse(fs.readFileSync(`${a}/producer.json`,'utf8'))diff --git a/evals/desktop_bug_campaign/async-report-producer.py b/evals/desktop_bug_campaign/async-report-producer.pyindex 1a76eab5992..cde0f59b73a 100644--- a/evals/desktop_bug_campaign/async-report-producer.py+++ b/evals/desktop_bug_campaign/async-report-producer.py@@ -30,7 +30,7 @@ with tempfile.TemporaryDirectory(prefix="async-report-producer-") as temporary:events = {"cron": dict(common, **result),"process": dict(common, status="completed", summary=report),- "batch": dict(common, is_batch=True, goals=["PRIVATE FIRST", "PRIVATE SECOND"], results=[+ "batch": dict(common, is_batch=True, goals=["PRIVATE FIRST", "PRIVATE SECOND\nPRIVATE CONTINUATION"], results=[dict(task_index=0, status="completed", summary=report, live_transcript="/private/transcript"),dict(task_index=1, status="completed", summary="Plain batch result"),]),diff --git a/evals/desktop_bug_campaign/async-report-vite.mjs b/evals/desktop_bug_campaign/async-report-vite.mjsindex bde12d574b5..94322224eff 100644--- a/evals/desktop_bug_campaign/async-report-vite.mjs+++ b/evals/desktop_bug_campaign/async-report-vite.mjs@@ -3,7 +3,9 @@ import fs from 'node:fs'import { execFileSync } from 'node:child_process'import path from 'node:path'const root = path.resolve(import.meta.dirname, '../../apps/desktop')-const artifactDir = process.env.NAVIGATION_ARTIFACT_DIR ?? '/home/teknium/.hermes/cache/desktop-bugs-74848ed3/followups/async-reports'+const artifactDir = process.env.ASYNC_REPORT_ARTIFACT_DIR+if (!artifactDir) throw new Error('Set ASYNC_REPORT_ARTIFACT_DIR to an offline artifact directory')+fs.mkdirSync(artifactDir, {recursive:true})const fixture = path.join(import.meta.dirname, 'async-report-probe.tsx')const baseline = path.join(artifactDir, 'baseline-hydration.ts')fs.writeFileSync(baseline, execFileSync('git', ['show', 'a688e7d5ff9aeaaa9c97d28c316467f89ab8c943:apps/desktop/src/lib/chat-messages/hydration.ts'], {encoding:'utf8'}).replaceAll("from './", "from '@/lib/chat-messages/"))