Skip to content

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

Python

Ask claim owners on Accord instead of chatting the user

justrach2f6291994793
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4d388d51..34404a66 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,7 +12,7 @@ current is part of cutting a release.
## Unreleased
-- `#1088`: claims own one artifact. Staging (`git add`) is not a publication lock; `git -C` uses that tree's branch; issue create and a new-branch push are not the latest issue or an unrelated PR.
+- `#1088`: claims own one artifact. A conflict pings the owner on Accord (JSONL still durable); staging is not a lock; issue create and a new-branch push are not someone else's issue or PR.
- `#1084`: gpt-6-astra `/effort medium` sends medium (no longer remapped to low).
- Empty Enter-Enter while a turn is running interrupts (or steers the next queued prompt). It no longer required a queue to arm.
- Desktop ACP workers can park after a quiet period (`GRAFF_ACP_IDLE_MS`, default 30s) and `--resume` with the saved cache id. Parking is skipped while a prompt or `session/idle` subscriber is live; tab close still reaps immediately.
diff --git a/docs/adr/0144-claim-asks-on-accord.md b/docs/adr/0144-claim-asks-on-accord.md
new file mode 100644
index 00000000..b78d1df3
--- /dev/null
+++ b/docs/adr/0144-claim-asks-on-accord.md
@@ -0,0 +1,25 @@
+# 0144. Claim conflicts ask on Accord; they do not serialize the machine
+
+Status: accepted 2026-09-20
+
+## Context
+
+Artifact claims are a durable file ledger (ADR 0100). Accord is already the
+live duplex for co-resident sessions (ADR 0134). The gate still refused
+unrelated `git add` / issue create / new-branch push, then dumped a long
+"NOT performed… owner must handoff" string into the tool result. Models
+pasted that essay into the user's chat instead of pinging the owner.
+
+## Decision
+
+The ledger still owns the artifact. On a real conflict the harness posts one
+line to the owner's worktree room and the device room (JSONL + Accord). The
+tool result is one line. The model does not broker the handoff in the
+transcript. Staging is not a claim. Empty keys do not match named claims
+(#1088).
+
+## Consequences
+
+A live owner gets a `[peer]` wake and can `handoff` / `release`. Unrelated
+work proceeds. `GRAFF_ACCORD=0` still delivers on JSONL. Revisit if claims
+should *live* as Accord state instead of a file; that is not this decision.
diff --git a/docs/adr/README.md b/docs/adr/README.md
index 191c0f5f..f83099ae 100644
--- a/docs/adr/README.md
+++ b/docs/adr/README.md
@@ -163,6 +163,7 @@ record only when you need the evidence or the edge cases.
| [0141](0141-observer-notch-is-a-nonactivating-panel.md) | The desktop session observer is a non-activating SwiftUI edge panel; cells are live ACP work, opt-in from Settings. |
| [0142](0142-zigzag-is-not-a-frontend.md) | Zigzag is not a frontend. TTY `graff repl` is `TUI/`; piped/CI uses a local scripted Model. Do not vendor zigzag. |
| [0143](0143-release-desktop-is-com-codegraff-app.md) | Packaged Codegraff.app is `com.codegraff.app`. `dev.*` identities are local rebuilds only. |
+| [0144](0144-claim-asks-on-accord.md) | Claim conflicts ping the owner on Accord/JSONL; the model does not broker handoff in chat. |
## When to write one
diff --git a/src/artifact_claim.zig b/src/artifact_claim.zig
index 474cbac1..07e167d5 100644
--- a/src/artifact_claim.zig
+++ b/src/artifact_claim.zig
@@ -44,7 +44,16 @@ pub fn mutationKind(cmd: []const u8) Kind {
}
pub fn refuseText(arena: Allocator, kind: Kind, key: []const u8, owner: Owner) []const u8 {
- return std.fmt.allocPrint(arena, "artifact claim held: {s} {s} is owned by live session \"{s}\" (pid {d}). The action was NOT performed. Acknowledging the shared-tree checkpoint, polling, or finding no pull request does not transfer ownership. The owner must peer_message action=handoff (or action=release) first.", .{ @tagName(kind), if (key.len > 0) key else "(worktree)", owner.session, owner.pid }) catch "artifact claim held: the action was NOT performed";
+ return std.fmt.allocPrint(arena, "artifact claim held: {s} {s} owner=\"{s}\" pid {d}. NOT performed. Asked them on Accord to handoff or release.", .{ @tagName(kind), if (key.len > 0) key else "(worktree)", owner.session, owner.pid }) catch "artifact claim held: the action was NOT performed";
+}
+
+/// JSONL is durable; Accord is the live poke (ADR 0134 / 0144). Do not make
+/// the model broker a handoff in the user's chat.
+fn pingOwner(io: Io, arena: Allocator, owner: Owner, kind: Kind, key: []const u8) void {
+ if (builtin.is_test) return;
+ const text = std.fmt.allocPrint(arena, "need {s} {s} handed off or released — a publish is blocked", .{ @tagName(kind), if (key.len > 0) key else "worktree" }) catch return;
+ _ = presence.postTo(io, arena, text, owner.session);
+ _ = presence.postToDevice(io, arena, text, owner.session, false);
}
// --- process-global ledger (one worktree, many tests swap it) ---
@@ -172,7 +181,10 @@ pub fn gateCommandIn(arena: Allocator, io: Io, cmd: []const u8, key: []const u8,
} else if (compare_key.len > 0 and c.key.len > 0 and !std.mem.eql(u8, c.key, compare_key)) continue;
// Named claims do not match an unresolved git/issue/push target (#1014, #1088).
if (compare_key.len == 0 and c.key.len > 0 and kind != .pull_request) continue;
- if (!sameOwner(c.owner, me) and ownerLive(io, c.owner)) return refuseText(arena, c.kind, c.key, c.owner);
+ if (!sameOwner(c.owner, me) and ownerLive(io, c.owner)) {
+ pingOwner(io, arena, c.owner, c.kind, c.key);
+ return refuseText(arena, c.kind, c.key, c.owner);
+ }
}
return null;
}