Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

Require a settled resize-anchor frame and fix open-fence scroll.

Cursor Agent174fdb5af6de
diff --git a/apps/native/components/primitives/StreamingCode.tsx b/apps/native/components/primitives/StreamingCode.tsx
index da4c5759..bedad7aa 100644
--- a/apps/native/components/primitives/StreamingCode.tsx
+++ b/apps/native/components/primitives/StreamingCode.tsx
@@ -29,15 +29,15 @@ export default function StreamingCode({ node: _node, className, children, collap
</CompletedCode>;
const bounded = typeof codeBlockMaxHeight === "number" ? codeBlockMaxHeight > 0 && Number.isFinite(codeBlockMaxHeight)
: !["0", "none", "Infinity", ""].includes(codeBlockMaxHeight);
- return <CodeBlockContainer dir="ltr" language={language} isIncomplete data-code-streaming>
+ return <CodeBlockContainer dir="ltr" language={language} isIncomplete data-code-streaming className="min-w-0 max-w-full">
<CodeBlockHeader language={language} />
- {(copy || download) && <div className="pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end">
- <div data-streamdown="code-block-actions" className="pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur">{actions}</div>
+ {(copy || download) && <div className="flex justify-end px-2 pb-1">
+ <div data-streamdown="code-block-actions" className="flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur">{actions}</div>
</div>}
<div data-language={language} data-streamdown="code-block-body"
- className={`min-w-0 rounded-md border border-border bg-background p-4 text-sm ${bounded ? "overflow-y-auto" : ""}`}
+ className={`min-w-0 max-w-full overflow-x-auto rounded-md border border-border bg-background p-4 text-sm ${bounded ? "overflow-y-auto" : ""}`}
style={bounded ? { maxHeight: codeBlockMaxHeight } : undefined}>
- <pre className="overflow-x-auto"><code className="whitespace-pre">{code.replace(/\n+$/, "")}</code></pre>
+ <pre className="min-w-0"><code className="whitespace-pre">{code.replace(/\n+$/, "")}</code></pre>
</div>
</CodeBlockContainer>;
}
diff --git a/apps/native/electron/chat-overflow-visual.cjs b/apps/native/electron/chat-overflow-visual.cjs
index 1fa78bba..d3421bfc 100644
--- a/apps/native/electron/chat-overflow-visual.cjs
+++ b/apps/native/electron/chat-overflow-visual.cjs
@@ -161,7 +161,8 @@ async function runChatOverflow({ win, origin, output }) {
const left = Math.max(r.left + local.clientLeft, b.left, 0), right = Math.min(r.left + local.clientLeft + local.clientWidth, b.left + e.clientWidth, innerWidth);
const top = Math.max(r.top + local.clientTop, b.top, 0), bottom = Math.min(r.top + local.clientTop + local.clientHeight, b.top + e.clientHeight, innerHeight);
const x = Math.floor((left + right) / 2), y = Math.floor((top + bottom) / 2);
- return { x, y, hit: right - left > 2 && bottom - top > 2 && local.contains(document.elementFromPoint(x, y)),
+ const hitEl = document.elementFromPoint(x, y);
+ return { x, y, hit: right - left > 2 && bottom - top > 2 && local.contains(hitEl) && !hitEl?.closest('[data-streamdown="code-block-actions"]'),
contained: r.left >= b.left - 1 && r.right <= b.left + e.clientWidth + 1, top: e.scrollTop };
})()`);
// Streaming and entry animations may move a block after it first appears.
diff --git a/apps/native/lib/streaming-code.test.ts b/apps/native/lib/streaming-code.test.ts
new file mode 100644
index 00000000..5fc79372
--- /dev/null
+++ b/apps/native/lib/streaming-code.test.ts
@@ -0,0 +1,16 @@
+import { readFileSync } from "node:fs";
+import { dirname, join } from "node:path";
+import { fileURLToPath } from "node:url";
+import { describe, it } from "node:test";
+import assert from "node:assert/strict";
+
+describe("streaming code overflow", () => {
+ it("puts horizontal overflow on the constrained open-fence body", () => {
+ const src = readFileSync(join(dirname(fileURLToPath(import.meta.url)), "../components/primitives/StreamingCode.tsx"), "utf8");
+ const body = src.match(/data-streamdown="code-block-body"[\s\S]*?className=\{`([^`]+)`\}/)?.[1] ?? "";
+ assert.match(body, /min-w-0/);
+ assert.match(body, /max-w-full/);
+ assert.match(body, /overflow-x-auto/);
+ assert.doesNotMatch(src, /sticky top-2 z-10 -mt-10/);
+ });
+});
diff --git a/apps/native/package.json b/apps/native/package.json
index 7116ba12..7a0a7e37 100644
--- a/apps/native/package.json
+++ b/apps/native/package.json
@@ -10,7 +10,7 @@
"start": "NEXT_TELEMETRY_DISABLED=1 next start --port 3000",
"mock-serve": "node scripts/mock-serve.mjs",
"lint": "next lint",
- "test": "node --experimental-strip-types --test lib/cite-markup.test.ts lib/graff-events.test.ts lib/acp.test.ts lib/sessions.test.ts lib/session-store.test.ts lib/follow-scroll.test.ts lib/prompt-queue.test.ts lib/prompt-queue-steer.test.ts lib/prompt-queue-resume.test.ts lib/agents.test.ts lib/mermaid-plugin.test.ts lib/prompt-history.test.ts lib/attachments.test.ts lib/workspaces.test.ts lib/fuzzy.test.ts lib/folder-picker.test.ts lib/browser/annotations.test.ts lib/browser/url.test.ts lib/extension-bridge.test.ts components/site/harness-split.test.ts components/site/appearance-panel.test.ts",
+ "test": "node --experimental-strip-types --test lib/cite-markup.test.ts lib/graff-events.test.ts lib/acp.test.ts lib/sessions.test.ts lib/session-store.test.ts lib/follow-scroll.test.ts lib/prompt-queue.test.ts lib/prompt-queue-steer.test.ts lib/prompt-queue-resume.test.ts lib/streaming-code.test.ts lib/agents.test.ts lib/mermaid-plugin.test.ts lib/prompt-history.test.ts lib/attachments.test.ts lib/workspaces.test.ts lib/fuzzy.test.ts lib/folder-picker.test.ts lib/browser/annotations.test.ts lib/browser/url.test.ts lib/extension-bridge.test.ts components/site/harness-split.test.ts components/site/appearance-panel.test.ts",
"electron:build": "bash electron/build.sh",
"test:electron": "bun test electron/policy.test.cjs",
"test:webauthn": "node scripts/test-webauthn.mjs",
diff --git a/scripts/test-tui-resize-anchor.py b/scripts/test-tui-resize-anchor.py
index 0391d0ed..bcccedc7 100644
--- a/scripts/test-tui-resize-anchor.py
+++ b/scripts/test-tui-resize-anchor.py
@@ -158,7 +158,8 @@ def stable_frame(fd, rows, cols, budget=1.5):
if last is not None and now == last:
return now
last = now
- return last
+ # An expired wait is not a settled frame. Judging drift from `last` is #866.
+ return None
def reread(fd):