Skip to content

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

Python

ask_user over ACP: use elicitation/create, never wait on a client that cannot answer

justrachc2155d8a10e8
diff --git a/apps/native/lib/acp-bootstrap.ts b/apps/native/lib/acp-bootstrap.ts
index dc27c79e..d2ca313a 100644
--- a/apps/native/lib/acp-bootstrap.ts
+++ b/apps/native/lib/acp-bootstrap.ts
@@ -43,7 +43,7 @@ export async function initializeWorker(
): Promise<{ sessionId: string; cwd?: string }> {
let phase = "initialize";
try {
- const initialized = await transport.request(phase, { protocolVersion: 1, clientCapabilities: { fs: {} } }, timeoutMs) as { protocolVersion?: unknown } | null;
+ const initialized = await transport.request(phase, { protocolVersion: 1, clientCapabilities: { fs: {}, _meta: { "graff/askUser": true } } }, timeoutMs) as { protocolVersion?: unknown } | null;
if (initialized?.protocolVersion !== 1) {
throw new Error("initialize returned an unsupported or missing protocolVersion; expected 1");
}
diff --git a/build.zig b/build.zig
index c2d740f2..72b76dfe 100644
--- a/build.zig
+++ b/build.zig
@@ -137,6 +137,9 @@ pub fn build(b: *std.Build) void {
const acp_startup_test = b.addSystemCommand(&.{ "python3", "scripts/test-acp-startup.py" });
acp_startup_test.addArtifactArg(exe);
test_step.dependOn(&acp_startup_test.step);
+ const acp_ask_user_test = b.addSystemCommand(&.{ "python3", "scripts/test-acp-ask-user.py" });
+ acp_ask_user_test.addArtifactArg(exe);
+ test_step.dependOn(&acp_ask_user_test.step);
const acp_v2_test = b.addSystemCommand(&.{ "python3", "scripts/test-acp-v2.py" });
acp_v2_test.addArtifactArg(exe);
test_step.dependOn(&acp_v2_test.step);
diff --git a/docs/acp-compatibility.md b/docs/acp-compatibility.md
index 2d304290..39598906 100644
--- a/docs/acp-compatibility.md
+++ b/docs/acp-compatibility.md
@@ -28,6 +28,7 @@ optional feature or draft extension is enabled.
| Workspace and worktrees | `session/new` and `session/load` adopt the client's absolute `cwd`; naming the checkout that owns a `-w` or auto-isolated tree keeps that tree. Replies carry `_meta["graff/worktree"]` (`name`, `path`, `branch`, `base`, `baseSha`, `root`, `generated`, or `null` in a main checkout). A workspace switch emits `session_info_update` with the same `_meta`. | `scripts/test-acp-workspace.py`, `src/acp_workspace.zig`, ADR 0202 |
| Prompt lifecycle | Stream session-scoped updates and return the terminal stop reason. Cancellation interrupts the active turn and cannot grant a pending permission. | `scripts/test-acp-failure.py`, `scripts/test-acp-permissions.py` |
| Tool calls | Preserve call identity, status and terminal results. Tool-like prose is not execution evidence. | `src/acp_stream.zig`, `src/agent_steps_tests.zig` |
+| Questions (`ask_user`) | A client that advertises `clientCapabilities.elicitation.form` gets a standard `elicitation/create` form request (one required `answer` string, an `enum` when the model offered choices); `accept` returns the answer, `decline`/`cancel` end the question. A client that opts in with `_meta["graff/askUser"]` gets graff's `gui_ask_user` and answers with `session/answer`. Any other client cannot show the question, so `ask_user` returns at once and tells the model to assume or ask in its reply; it never waits on a client that cannot answer. | `scripts/test-acp-ask-user.py`, `src/acp_elicit.zig` |
| Permissions | Send the advertised choices to the active client and await its response. Clients must honor an explicit rejection or cancellation; automatic approval is a separate user setting. | `scripts/test-acp-permissions.py` |
| Effort configuration | Expose supported `thought_level` values in session configuration. Validate setters, return the full option list, and emit `config_option_update` when agent-originated changes alter that state. | `scripts/test-acp-effort-config.py`, `src/acp_config.zig` |
| Configuration timing | Client changes arriving during a prompt are queued for after that turn. An effort-tool result applies on the owning agent thread before the next model request; clients refresh the affected session's controls. | `src/acp_idle.zig`, `src/jev_effort_state.zig`, `apps/native/lib/acp-client-stream.test.ts` |
diff --git a/scripts/test-acp-ask-user.py b/scripts/test-acp-ask-user.py
new file mode 100644
index 00000000..334ac611
--- /dev/null
+++ b/scripts/test-acp-ask-user.py
@@ -0,0 +1,115 @@
+#!/usr/bin/env python3
+"""ask_user over ACP never waits on a client that cannot show it.
+
+- no capability: the tool returns at once and the turn ends (no freeze)
+- clientCapabilities.elicitation.form: standard elicitation/create, answer flows back
+- _meta["graff/askUser"]: graff's gui_ask_user + session/answer (apps/native)
+"""
+import json, os, queue, signal, subprocess, sys, tempfile, threading, time
+from pathlib import Path
+sys.path.insert(0, str(Path(__file__).resolve().parent / 'eval'))
+from mock_model import ScriptedModel
+
+QUESTION = 'Which deployment target?'
+
+
+def tool_results(model):
+ out = []
+ for body in model.requests:
+ for message in body.get('messages', []):
+ if message.get('role') == 'tool':
+ content = message.get('content')
+ out.append(content if isinstance(content, str) else json.dumps(content))
+ return out
+
+
+def run(binary, case):
+ model = ScriptedModel([
+ {'tool': 'ask_user', 'arguments': {'question': QUESTION, 'options': ['npm', 'GitHub release']}},
+ {'text': 'Done.'},
+ ])
+ caps = {
+ 'none': {'fs': {}},
+ 'elicitation': {'fs': {}, 'elicitation': {'form': {}}},
+ 'legacy': {'fs': {}, '_meta': {'graff/askUser': True}},
+ }[case]
+ with tempfile.TemporaryDirectory(prefix='acp-ask-user-') as temp:
+ env = {k: v for k, v in os.environ.items() if not k.endswith('_API_KEY')}
+ config = Path(temp) / 'mcp.json'
+ config.write_text('{"mcpServers":{}}')
+ env.update(HOME=temp, AI_GATEWAY_API_KEY='local', GRAFF_MCP_CONFIG=str(config), GRAFF_NO_TELEMETRY='1',
+ GRAFF_FLEET='off', GRAFF_NO_SMOLIFY='1', GRAFF_NO_CODEDB_GUARD='1')
+ port = model.start(0)
+ env['GRAFF_VERCEL_URL'] = f'http://127.0.0.1:{port}/v1/chat/completions'
+ proc = subprocess.Popen([binary, 'acp', '--model', 'vercel', '--old', '--no-lean', '--yolo'], cwd=temp, env=env,
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True,
+ start_new_session=True)
+ messages = queue.Queue()
+
+ def read():
+ for line in proc.stdout:
+ try:
+ messages.put(json.loads(line))
+ except ValueError:
+ pass
+ messages.put(None)
+ threading.Thread(target=read, daemon=True).start()
+
+ def send(obj):
+ proc.stdin.write(json.dumps({'jsonrpc': '2.0', **obj}) + '\n')
+ proc.stdin.flush()
+
+ seen = []
+
+ def wait(id, timeout=30):
+ deadline = time.monotonic() + timeout
+ while True:
+ m = messages.get(timeout=max(.01, deadline - time.monotonic()))
+ assert m is not None, 'worker exited'
+ seen.append(m)
+ if m.get('id') == id and 'method' not in m:
+ return m
+ if m.get('method') == 'elicitation/create':
+ assert case == 'elicitation', m
+ params = m['params']
+ assert params['mode'] == 'form' and params['message'] == QUESTION, params
+ answer = params['requestedSchema']['properties']['answer']
+ assert answer['enum'] == ['npm', 'GitHub release'], answer
+ # A stale ID must not answer the live question.
+ send({'id': 'graff-elicit-0', 'result': {'action': 'accept', 'content': {'answer': 'wrong'}}})
+ send({'id': m['id'], 'result': {'action': 'accept', 'content': {'answer': 'npm'}}})
+ update = (m.get('params') or {}).get('update') or {}
+ if update.get('sessionUpdate') == 'gui_ask_user':
+ assert case == 'legacy', m
+ send({'method': 'session/answer', 'params': {'sessionId': sid, 'text': 'npm'}})
+
+ try:
+ send({'id': 1, 'method': 'initialize', 'params': {'protocolVersion': 1, 'clientCapabilities': caps}})
+ wait(1)
+ send({'id': 2, 'method': 'session/new', 'params': {'cwd': temp, 'mcpServers': []}})
+ sid = wait(2)['result']['sessionId']
+ started = time.monotonic()
+ send({'id': 3, 'method': 'session/prompt', 'params': {'sessionId': sid, 'prompt': [{'type': 'text', 'text': 'Ask me.'}]}})
+ done = wait(3, timeout=20)
+ assert done.get('result', {}).get('stopReason') == 'end_turn', done
+ results = tool_results(model)
+ assert results, 'ask_user result never reached the model'
+ methods = {m.get('method') for m in seen}
+ updates = {((m.get('params') or {}).get('update') or {}).get('sessionUpdate') for m in seen}
+ if case == 'none':
+ assert 'cannot show questions' in results[-1], results
+ assert 'elicitation/create' not in methods and 'gui_ask_user' not in updates
+ assert time.monotonic() - started < 10, 'ask_user waited on a client that cannot answer'
+ else:
+ assert 'npm' in results[-1] and 'wrong' not in results[-1], results
+ print('PASS ACP ask_user', case, flush=True)
+ finally:
+ os.killpg(proc.pid, signal.SIGKILL)
+ proc.wait(timeout=3)
+ model.stop()
+
+
+if __name__ == '__main__':
+ binary = str(Path(sys.argv[1] if len(sys.argv) > 1 else 'zig-out/bin/graff').resolve())
+ for case in ['none', 'elicitation', 'legacy']:
+ run(binary, case)
diff --git a/src/acp_elicit.zig b/src/acp_elicit.zig
new file mode 100644
index 00000000..46075dec
--- /dev/null
+++ b/src/acp_elicit.zig
@@ -0,0 +1,215 @@
+//! ask_user over ACP. A client that advertised `elicitation.form` gets the
+//! standard `elicitation/create` form request; a client that opted in with
+//! `_meta["graff/askUser"]` gets graff's `gui_ask_user`. Any other client
+//! cannot show the question, so ask_user must return at once: waiting for an
+//! answer that can never arrive froze the turn until the user cancelled it.
+const std = @import("std");
+const Io = std.Io;
+const Value = std.json.Value;
+const util = @import("util.zig");
+const acp_ask = @import("acp_ask.zig");
+
+pub const Mode = enum { none, elicitation, legacy };
+
+/// Latched at `initialize` (one ACP connection per process).
+pub var mode: Mode = .none;
+var seq = std.atomic.Value(u64).init(0);
+/// The one outstanding request; 0 when none. A late or repeated response to
+/// an earlier request must never answer a later question.
+var pending = std.atomic.Value(u64).init(0);
+
+pub const request_prefix = "graff-elicit-";
+
+pub const unsupported_text =
+ "This ACP client cannot show questions mid-turn, so nobody will see this one. " ++
+ "Do not ask again: make a reasonable, reversible assumption and continue, " ++
+ "or finish the turn and put the question in your reply.";
+
+pub fn configure(params: ?Value) void {
+ mode = detect(params);
+ pending.store(0, .release);
+}
+
+/// v1 sends `clientCapabilities`, v2 `capabilities`; the markers are the same.
+fn detect(params: ?Value) Mode {
+ const p = params orelse return .none;
+ if (p != .object) return .none;
+ const caps = p.object.get("clientCapabilities") orelse p.object.get("capabilities") orelse return .none;
+ if (caps != .object) return .none;
+ if (caps.object.get("elicitation")) |e| if (e == .object) if (e.object.get("form")) |form| if (form == .object) return .elicitation;
+ if (caps.object.get("_meta")) |meta| if (meta == .object) if (meta.object.get("graff/askUser")) |v| if (v == .bool and v.bool) return .legacy;
+ return .none;
+}
+
+fn optionLabel(opt: Value) ?[]const u8 {
+ if (opt == .string) return opt.string;
+ if (opt != .object) return null;
+ return util.strFieldObj(opt.object, "label") orelse util.strFieldObj(opt.object, "text") orelse util.strFieldObj(opt.object, "value");
+}
+
+/// Choices become an `enum` only when every option has a label; otherwise the
+/// answer stays free text so a valid reply is never unrepresentable.
+fn choices(input: Value) ?[]const Value {
+ if (input != .object) return null;
+ const opts = input.object.get("options") orelse return null;
+ if (opts != .array or opts.array.items.len < 2) return null;
+ for (opts.array.items) |opt| if (optionLabel(opt) == null) return null;
+ return opts.array.items;
+}
+
+/// `elicitation/create` in form mode with one required `answer` field.
+pub fn writeRequest(w: *Io.Writer, sid: []const u8, question: []const u8, input: Value) !void {
+ const n = seq.fetchAdd(1, .monotonic) + 1;
+ pending.store(n, .release);
+ var id_buf: [48]u8 = undefined;
+ const id = try std.fmt.bufPrint(&id_buf, request_prefix ++ "{d}", .{n});
+ var s: std.json.Stringify = .{ .writer = w };
+ try s.beginObject();
+ try s.objectField("jsonrpc");
+ try s.write("2.0");
+ try s.objectField("id");
+ try s.write(id);
+ try s.objectField("method");
+ try s.write("elicitation/create");
+ try s.objectField("params");
+ try s.beginObject();
+ try s.objectField("sessionId");
+ try s.write(sid);
+ try s.objectField("mode");
+ try s.write("form");
+ try s.objectField("message");
+ try s.write(question);
+ try s.objectField("requestedSchema");
+ try s.beginObject();
+ try s.objectField("type");
+ try s.write("object");
+ try s.objectField("properties");
+ try s.beginObject();
+ try s.objectField("answer");
+ try s.beginObject();
+ try s.objectField("type");
+ try s.write("string");
+ try s.objectField("title");
+ try s.write("Answer");
+ if (choices(input)) |opts| {
+ try s.objectField("enum");
+ try s.beginArray();
+ for (opts) |opt| try s.write(optionLabel(opt).?);
+ try s.endArray();
+ }
+ try s.endObject();
+ try s.endObject();
+ try s.objectField("required");
+ try s.write(&[_][]const u8{"answer"});
+ try s.endObject();
+ try s.endObject();
+ try s.endObject();
+ try w.writeByte('\n');
+}
+
+/// A client response to our request (from the stdin pump). Returns true when
+/// the line was ours, answered or stale.
+pub fn accept(value: Value) bool {
+ if (value != .object or value.object.contains("method")) return false;
+ const id = util.strFieldObj(value.object, "id") orelse return false;
+ if (!std.mem.startsWith(u8, id, request_prefix)) return false;
+ const n = std.fmt.parseInt(u64, id[request_prefix.len..], 10) catch return true;
+ if (n == 0 or pending.cmpxchgStrong(n, 0, .acq_rel, .acquire) != null) return true;
+ const result = value.object.get("result") orelse {
+ _ = acp_ask.reply("", true);
+ return true;
+ };
+ if (result == .object and std.mem.eql(u8, util.strFieldObj(result.object, "action") orelse "", "accept")) {
+ if (result.object.get("content")) |content| if (content == .object) if (util.strFieldObj(content.object, "answer")) |answer|
+ if (acp_ask.reply(answer, false)) return true;
+ }
+ // decline, cancel, an empty answer, or a malformed result.
+ _ = acp_ask.reply("", true);
+ return true;
+}
+
+/// The waiter is done (answered or cancelled); later responses are stale.
+pub fn finish() void {
+ pending.store(0, .release);
+}
+
+const testing = std.testing;
+
+fn parse(a: std.mem.Allocator, json: []const u8) !Value {
+ return std.json.parseFromSliceLeaky(Value, a, json, .{});
+}
+
+test "ask mode follows the client's capabilities" {
+ defer configure(null);
+ var arena = std.heap.ArenaAllocator.init(testing.allocator);
+ defer arena.deinit();
+ const a = arena.allocator();
+ configure(try parse(a, "{\"protocolVersion\":1,\"clientCapabilities\":{\"fs\":{}}}"));
+ try testing.expectEqual(Mode.none, mode);
+ configure(try parse(a, "{\"clientCapabilities\":{\"elicitation\":{\"url\":{}}}}"));
+ try testing.expectEqual(Mode.none, mode);
+ configure(try parse(a, "{\"clientCapabilities\":{\"elicitation\":{\"form\":null}}}"));
+ try testing.expectEqual(Mode.none, mode);
+ configure(try parse(a, "{\"clientCapabilities\":{\"elicitation\":{\"form\":{}}}}"));
+ try testing.expectEqual(Mode.elicitation, mode);
+ configure(try parse(a, "{\"capabilities\":{\"elicitation\":{\"form\":{}}}}"));
+ try testing.expectEqual(Mode.elicitation, mode);
+ configure(try parse(a, "{\"clientCapabilities\":{\"_meta\":{\"graff/askUser\":true}}}"));
+ try testing.expectEqual(Mode.legacy, mode);
+ configure(try parse(a, "{\"clientCapabilities\":{\"_meta\":{\"graff/askUser\":true},\"elicitation\":{\"form\":{}}}}"));
+ try testing.expectEqual(Mode.elicitation, mode);
+}
+
+test "elicitation request is a form with an answer field and option enum" {
+ defer finish();
+ var arena = std.heap.ArenaAllocator.init(testing.allocator);
+ defer arena.deinit();
+ const a = arena.allocator();
+ var out: Io.Writer.Allocating = .init(a);
+ try writeRequest(&out.writer, "s1", "Which target?", try parse(a, "{\"options\":[\"npm\",{\"label\":\"GitHub\"}]}"));
+ const msg = try parse(a, out.writer.buffered());
+ try testing.expectEqualStrings("elicitation/create", msg.object.get("method").?.string);
+ const params = msg.object.get("params").?.object;
+ try testing.expectEqualStrings("form", params.get("mode").?.string);
+ try testing.expectEqualStrings("Which target?", params.get("message").?.string);
+ const answer = params.get("requestedSchema").?.object.get("properties").?.object.get("answer").?.object;
+ try testing.expectEqual(@as(usize, 2), answer.get("enum").?.array.items.len);
+ out.clearRetainingCapacity();
+ try writeRequest(&out.writer, "s1", "Free?", try parse(a, "{\"options\":[\"one\",5]}"));
+ try testing.expect(std.mem.indexOf(u8, out.writer.buffered(), "\"enum\"") == null);
+}
+
+test "responses answer only the outstanding request" {
+ acp_ask.attach(testing.io, testing.allocator);
+ defer acp_ask.detach();
+ defer finish();
+ var arena = std.heap.ArenaAllocator.init(testing.allocator);
+ defer arena.deinit();
+ const a = arena.allocator();
+ var sink: Io.Writer.Allocating = .init(a);
+ try writeRequest(&sink.writer, "s", "q", .null);
+ const id = pending.load(.acquire);
+ const stale = try std.fmt.allocPrint(a, "{{\"id\":\"graff-elicit-{d}\",\"result\":{{\"action\":\"accept\",\"content\":{{\"answer\":\"old\"}}}}}}", .{id + 7});
+ try testing.expect(accept(try parse(a, stale)));
+ const good = try std.fmt.allocPrint(a, "{{\"id\":\"graff-elicit-{d}\",\"result\":{{\"action\":\"accept\",\"content\":{{\"answer\":\"npm\"}}}}}}", .{id});
+ try testing.expect(accept(try parse(a, good)));
+ try testing.expect(accept(try parse(a, good))); // repeated: consumed, ignored
+ const got = try acp_ask.wait(a);
+ try testing.expectEqualStrings("npm", got.text);
+ try testing.expect(!got.cancelled);
+ try testing.expect(!accept(try parse(a, "{\"id\":\"graff-permission-1\",\"result\":{}}")));
+}
+
+test "decline and cancel end the question as cancelled" {
+ acp_ask.attach(testing.io, testing.allocator);
+ defer acp_ask.detach();
+ defer finish();
+ var arena = std.heap.ArenaAllocator.init(testing.allocator);
+ defer arena.deinit();
+ const a = arena.allocator();
+ var sink: Io.Writer.Allocating = .init(a);
+ try writeRequest(&sink.writer, "s", "q", .null);
+ const decline = try std.fmt.allocPrint(a, "{{\"id\":\"graff-elicit-{d}\",\"result\":{{\"action\":\"decline\"}}}}", .{pending.load(.acquire)});
+ try testing.expect(accept(try parse(a, decline)));
+ try testing.expect((try acp_ask.wait(a)).cancelled);
+}
diff --git a/src/acp_engine.zig b/src/acp_engine.zig
index fae28e1d..8d8d0b75 100644
--- a/src/acp_engine.zig
+++ b/src/acp_engine.zig
@@ -256,6 +256,7 @@ pub fn handleLine(d: *Dispatch, arena: Allocator, w: *Io.Writer, line: []const u
const req = parseRequest(arena, line) orelse return;
if (std.mem.eql(u8, req.method, "initialize")) {
v2.negotiate(req.params, d.seed);
+ @import("acp_elicit.zig").configure(req.params);
// The draft child-session RFD is a v1 shape; v2 gets tool-call progress.
d.subagents = !v2.on() and supportsSubagents(req.params);
d.background_subagents = supportsBackgroundSubagents(req.params);
diff --git a/src/acp_inbox.zig b/src/acp_inbox.zig
index 9431534d..2f837851 100644
--- a/src/acp_inbox.zig
+++ b/src/acp_inbox.zig
@@ -107,9 +107,10 @@ pub const Inbox = struct {
fn accept(self: *Inbox, line: []const u8) !void {
var arena = std.heap.ArenaAllocator.init(self.gpa);
defer arena.deinit();
- if (self.permission) |bridge| {
+ {
const value = std.json.parseFromSliceLeaky(std.json.Value, arena.allocator(), line, .{}) catch .null;
- if (bridge.accept(value)) return;
+ if (@import("acp_elicit.zig").accept(value)) return;
+ if (self.permission) |bridge| if (bridge.accept(value)) return;
}
const req = proto.parseRequest(arena.allocator(), line);
self.mutex.lockUncancelable(self.io);
diff --git a/src/acp_stream.zig b/src/acp_stream.zig
index 5ddf2490..95529a3b 100644
--- a/src/acp_stream.zig
+++ b/src/acp_stream.zig
@@ -9,6 +9,7 @@ const Value = std.json.Value;
const util = @import("util.zig");
const proto = @import("acp_protocol.zig");
const v2 = @import("acp_v2.zig");
+const acp_elicit = @import("acp_elicit.zig");
pub fn kindFor(name: []const u8) []const u8 {
if (std.mem.eql(u8, name, "read_file") or std.mem.eql(u8, name, "codedb") or std.mem.eql(u8, name, "skill"))
@@ -198,6 +199,10 @@ pub fn translateEvent(
return .tool;
}
if (std.mem.eql(u8, typ, "ask_user")) {
+ if (acp_elicit.mode == .elicitation) {
+ try acp_elicit.writeRequest(w, session_id, util.strFieldObj(ev.object, "question") orelse "", ev.object.get("input") orelse .null);
+ return .notice;
+ }
try proto.writeNotification(w, "session/update", .{
.sessionId = session_id,
.update = .{
diff --git a/src/ask_user.zig b/src/ask_user.zig
index 9b7a727b..94395420 100644
--- a/src/ask_user.zig
+++ b/src/ask_user.zig
@@ -22,6 +22,7 @@ const protocol_seq = @import("protocol_seq.zig");
const vision = @import("vision.zig");
const vision_queue = @import("vision_queue.zig");
const acp_ask = @import("acp_ask.zig");
+const acp_elicit = @import("acp_elicit.zig");
const style = &@import("ansi.zig").style;
/// Block the root agent for an ask_user reply; subagents have no stdin.
@@ -33,10 +34,16 @@ pub fn askUser(self: *Agent, call: ToolCall) !ExecResult {
self.next_ask_id += 1;
break :blk id;
};
+ // ACP owns stdin (`root.in` is null). A client that cannot show the
+ // question must not leave the turn waiting on it (acp_elicit.zig).
+ if (self.in == null and acp_elicit.mode == .none)
+ return .{ .text = acp_elicit.unsupported_text, .is_error = true };
try emitAskUser(self, call_id, question, call.input);
- // ACP owns stdin (`root.in` is null); answers arrive on session/answer.
+ // Answers arrive as the elicitation response or session/answer.
if (self.in == null) {
+ if (self.tracer) |tr| tr.note("ask_user_wait", @tagName(acp_elicit.mode));
const got = try acp_ask.wait(self.arena);
+ acp_elicit.finish();
if (got.cancelled) return .{ .text = "user cancelled the follow-up", .is_error = true };
return finishAnswer(self, std.mem.trim(u8, got.text, " \t\r"));
}
diff --git a/src/main.zig b/src/main.zig
index 72898916..ab429737 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -579,7 +579,7 @@ test { // ── Unit tests (`zig build test`): pull in tests from imported modu
_ = .{ @import("http2_pool.zig"), @import("agent_stream_h2.zig"), @import("agent_stream_h2_transport_test.zig") }; // h2 stream path, and graff's request/response contract over the pinned http-zig
_ = @import("tui_acp_updates.zig");
_ = @import("acp_preauth.zig"); // credential-free ACP loop must stay in the test root
- _ = .{ @import("acp_protocol.zig"), @import("acp_v2.zig"), @import("acp_v2_prompt.zig"), @import("acp_engine_test.zig"), @import("subagent_mimo_tests.zig"), @import("mimo_effort_tests.zig"), @import("gateway_picker_catalog.zig") };
+ _ = .{ @import("acp_protocol.zig"), @import("acp_v2.zig"), @import("acp_v2_prompt.zig"), @import("acp_elicit.zig"), @import("acp_engine_test.zig"), @import("subagent_mimo_tests.zig"), @import("mimo_effort_tests.zig"), @import("gateway_picker_catalog.zig") };
_ = @import("task_outcome.zig"); // goal-outcome telemetry events
_ = @import("learn_delete.zig"); // #303: its tests were dead until listed here
_ = .{ @import("additional_tests.zig"), @import("req_stats.zig"), @import("exact_reply.zig"), @import("rlm_order_tests.zig"), @import("async_tool_policy.zig"), @import("agent_async_tools.zig"), @import("request_usage_attempts.zig"), @import("learn_formal.zig") };