Skip to content

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

Python

Merge fix/gui-link-destination (#838) into cursor/yxlyx-breakage-4ffc

Rach18db9e9974d5
diff --cc .github/workflows/desktop.yml
index 84f607ac,1916e94f..ac1d75e0
--- a/.github/workflows/desktop.yml
+++ b/.github/workflows/desktop.yml
@@@ -22,8 -22,6 +22,9 @@@ jobs
- run: bun install --frozen-lockfile
- run: bun run test:desktop
- run: bun run build
+ - run: bun run test:overflow
+ - run: bun run test:tasks
++ - run: bun run test:links
- run: bun run test:projects
- run: bun run test:stress
- run: bun run test:agents
diff --cc apps/native/electron/visual-tests.cjs
index e468c4a5,d47a9d98..61a05d66
--- a/apps/native/electron/visual-tests.cjs
+++ b/apps/native/electron/visual-tests.cjs
@@@ -31,12 -31,12 +31,18 @@@ app.whenReady().then(async () =>
if (url.origin === origin && url.pathname.startsWith('/api/')) apiRequests.push(url.pathname);
callback({ cancel: !details.url.startsWith(origin) && !details.url.startsWith('data:') || url.pathname.startsWith('/api/') });
});
+ if (process.env.GRAFF_VISUAL_SUITE === 'overflow') {
+ await require('./chat-overflow-visual.cjs').runChatOverflow({ win, origin, output });
+ await require('./chat-overflow-edge-visual.cjs').runOverflowEdges({ win, origin });
+ assert.deepEqual(apiRequests, [], 'Overflow fixtures never call live APIs');
+ return;
+ }
+ if (process.env.GRAFF_VISUAL_SUITE === 'links') {
+ win.hide();
+ await require('./link-destination-visual.cjs').runLinkDestinationVisuals({ origin, output });
+ assert.deepEqual(apiRequests, [], 'Link fixtures never call engine or model APIs');
+ return;
+ }
if (process.env.GRAFF_VISUAL_SUITE === 'updates') {
await require('./updates-visual.cjs').runUpdateVisuals({ origin, output });
await require('./updates-transport.cjs').runUpdateTransport();
@@@ -106,9 -100,9 +113,10 @@@
await require('./navigation-visual.cjs').runNavigationVisuals({ win, origin, output });
await require('./browser-visual.cjs').runBrowserVisuals({ win, origin, output });
await require('./agents-visual.cjs').runAgentVisuals({ win, origin, output });
+ await require('./task-rows-visual.cjs').testTaskRows({ win, origin });
await require('./updates-visual.cjs').runUpdateVisuals({ origin, output });
await require('./updates-transport.cjs').runUpdateTransport();
+ await require('./link-destination-visual.cjs').runLinkDestinationVisuals({ origin, output });
if (process.env.GRAFF_PERFORMANCE_TESTS) await require('./performance-scenarios.cjs').runPerformance({ win, origin, output });
assert.deepEqual(apiRequests, [], 'Visual fixtures must not call the engine or model APIs');
fs.writeFileSync(path.join(output, 'results.json'), JSON.stringify({ passed: results, apiRequests }, null, 2));
diff --cc docs/adr/0098-desktop-link-destination.md
index 00000000,878076bd..20fda594
mode 000000,100644..100644
--- a/docs/adr/0098-desktop-link-destination.md
+++ b/docs/adr/0098-desktop-link-destination.md
@@@ -1,0 -1,33 +1,33 @@@
-# 0096. Desktop web links share one destination policy
++# 0098. Desktop web links share one destination policy
+
+ Status: accepted 2026-09-10
+
+ ## Context
+
+ Conversation links always opened in the system browser, even when users
+ wanted to keep pages beside their chat (#824). The desktop server's origin
+ can change between launches, so origin-scoped browser storage alone cannot
+ reliably preserve this preference.
+
+ ## Decision
+
+ Store the explicit `system` or `graff` choice atomically in desktop user data.
+ Default missing or invalid preferences to the existing system-browser behavior.
+ Expose the setting through trusted app-frame IPC, not to browser pages.
+
+ Use Electron's shared navigation interception for both normal links and
+ new-window links rather than adding handlers to individual Markdown renderers.
+ Validate HTTP(S) URLs and reject credentials before routing either destination.
+ Same-origin app navigation stays in the app; same-origin popups are denied.
+
+ For Graff, send the validated link to the renderer, which resolves the focused
+ chat and reveals its existing isolated Browser pane. Never replace the main
+ application view or fall back to the system browser when Graff navigation fails.
+
+ ## Consequences
+
+ The preference survives origin changes and restarts. All conversation renderers
+ use the same routing policy without coupling Markdown to Electron. The renderer
+ still owns chat focus and pane layout; Electron owns URL safety and OS opening.
+ Persistence, routing edge cases, and real Electron interactions are covered by
+ the desktop tests and `test:links`, also included in `test:projects`.
diff --cc docs/adr/README.md
index 36fc5813,1629fd5f..7a27318f
--- a/docs/adr/README.md
+++ b/docs/adr/README.md
@@@ -106,8 -106,8 +106,9 @@@ record only when you need the evidence
| [0093](0093-project-layout-breadth-and-directory-hints.md) | Project layout favors breadth under its caps; missing directories offer bounded sibling hints without changing confinement or ADR 0090 constraint policy. |
| [0094](0094-subagent-interrupt-is-a-cancel-file.md) | GUI Stop writes `{id}.cancel` in the activity dir; the child finishes failed even if the model returns. Not `session/cancel`. |
| [0095](0095-live-evals-are-gated-prs.md) | Live evals are gated PRs with no SPEC.md; score pass @ n=3 and list$ on passing reps only. |
-| [0096](0096-desktop-link-destination.md) | Persist the desktop link destination outside origin-scoped storage; validate once and reveal the focused chat's Browser without navigating the app. |
+| [0096](0096-orphan-listeners-are-not-stop-authority.md) | Legacy listener discovery is read-only; stop authority requires verified ownership, port preflight checks both families, and unknown browser visibility protects listening jobs. |
| [0097](0097-isolate-probe-clipboards.md) | Offline PTY probes get private clipboard commands per process; direct probe runs retain OS clipboard integration. |
++| [0098](0098-desktop-link-destination.md) | Persist the desktop link destination outside origin-scoped storage; validate once and reveal the focused chat's Browser without navigating the app. |
## When to write one
diff --cc scripts/codex_ws_error_test.py
index 219555fe,02b21487..8b5944a0
--- a/scripts/codex_ws_error_test.py
+++ b/scripts/codex_ws_error_test.py
@@@ -188,16 -188,11 +188,17 @@@ def run_chain_reanchor_scenario
first.connection_id != rejected.connection_id
or rejected.connection_id == rebuilt.connection_id
or rejected.body.get("previous_response_id") != "resp_chain_1"
+ # A fresh socket may chain only from its observed prewarm,
+ # never from the rejected inference response or another socket.
+ or not mock.has_fresh_parent(rebuilt)
):
raise AssertionError(
- "chain-error: rejected delta was not rebuilt on a fresh WS"
+ "chain-error: rejected delta was not rebuilt as full input on a fresh WS: "
+ f"connections={(first.connection_id, rejected.connection_id, rebuilt.connection_id)!r}, "
+ f"rejected_parent={rejected.body.get('previous_response_id')!r}, "
+ f"rebuilt_parent={rebuilt.body.get('previous_response_id')!r}"
)
+ mock.assert_fresh_anchor(rebuilt)
rebuilt_types = [
item.get("type")
for item in rebuilt.body.get("input", [])
diff --cc scripts/codex_ws_mock.py
index 9bbf6863,cfd135ed..e46080bf
--- a/scripts/codex_ws_mock.py
+++ b/scripts/codex_ws_mock.py
@@@ -270,6 -262,14 +270,11 @@@ class CodexMock
with self._lock:
return list(self.requests)
+ def assert_fresh_anchor(self, request: RecordedRequest) -> None:
+ """A full replay may chain only to this socket's empty-input prewarm."""
- with self._lock:
- expected = self._prewarms.get(request.connection_id)
- if (("previous_response_id" in request.body) != (expected is not None)
- or request.body.get("previous_response_id") != expected):
++ if not self.has_fresh_parent(request):
+ raise AssertionError("full replay used a stale or unexpected chain anchor")
+
# ── internals ─────────────────────────────────────────────────────────
def _log(self, message: str) -> None:
diff --cc scripts/codex_ws_test.py
index 68baf7da,4a7cfb8c..f7061c21
--- a/scripts/codex_ws_test.py
+++ b/scripts/codex_ws_test.py
@@@ -437,11 -437,7 +437,12 @@@ def assert_midturn_requests(mock: Codex
if first.connection_id == final.connection_id:
raise AssertionError("midturn: final request reused the pre-compaction WS")
for request in requests:
+ if not mock.has_fresh_parent(request):
+ raise AssertionError(
+ f"midturn: request {request.ordinal} carried stale previous_response_id: "
+ f"{request.body['previous_response_id']!r}"
+ )
+ mock.assert_fresh_anchor(request)
# The note turn is a bounded, tool-less auxiliary call on its own persona —
# never the root prompt, which would hand it the whole tool catalog and its
@@@ -580,11 -576,7 +581,12 @@@ def assert_transactional_requests(mock
"transactional: final request reused the pre-compaction WS"
)
for request in requests:
+ if not mock.has_fresh_parent(request):
+ raise AssertionError(
+ f"transactional: request {request.ordinal} carried stale "
+ f"previous_response_id: {request.body['previous_response_id']!r}"
+ )
+ mock.assert_fresh_anchor(request)
first_input = first.body.get("input")
if (