summaryrefslogtreecommitdiff
path: root/libpanto/src/agent.zig
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-06-18 14:15:55 -0600
committert <t@tjp.lol>2026-06-18 14:16:24 -0600
commit270cd00129551647e7c764a13836e03e0b2dc4e2 (patch)
treef939bbf999dd67d996b4025b03dbfe4abd30b9f4 /libpanto/src/agent.zig
parent7c2d8825660f73198149c0b2ce26166b16ba3532 (diff)
preserve signature origins across compactions
Diffstat (limited to 'libpanto/src/agent.zig')
-rw-r--r--libpanto/src/agent.zig12
1 files changed, 3 insertions, 9 deletions
diff --git a/libpanto/src/agent.zig b/libpanto/src/agent.zig
index 39c2f1a..ed1600f 100644
--- a/libpanto/src/agent.zig
+++ b/libpanto/src/agent.zig
@@ -83,6 +83,9 @@ fn cloneMessage(alloc: Allocator, msg: conversation.Message) !conversation.Messa
.content = content,
.usage = msg.usage,
.metadata = if (msg.metadata) |m| try alloc.dupe(u8, m) else null,
+ // Preserve the producing identity so a kept-verbatim turn isn't
+ // re-stamped with the compaction model on persist.
+ .identity = if (msg.identity) |id| try conversation.dupeWireIdentity(alloc, id) else null,
};
}
@@ -330,8 +333,6 @@ pub const Agent = struct {
self._config = config;
}
-
-
/// Add a system message (append or replace mode) to the conversation
/// and persist it. The persisted entry records the mode so replay
/// reconstructs the same effective system prompt.
@@ -2638,7 +2639,6 @@ test "runStep surfaces EmptyAssistantResponse when provider commits an empty mes
h.seedInto(agent);
agent._open_stream_fn = stub.install();
-
try testing.expectError(error.EmptyAssistantResponse, drainTurn(agent, "hi"));
}
@@ -2721,7 +2721,6 @@ test "runStep: distinct sources run on distinct threads in parallel" {
h.seedInto(agent);
agent._open_stream_fn = stub.install();
-
try drainTurn(agent, "go");
const view_a = agent._registry.lookup("src_a_t") orelse return error.NotFound;
@@ -3143,7 +3142,6 @@ test "runStep: context overflow without compaction prompt propagates" {
agent._open_stream_fn = stub.install();
// No compaction_system_prompt set -> overflow propagates.
-
try testing.expectError(error.ContextOverflow, drainTurn(agent, "hi"));
}
@@ -3269,7 +3267,6 @@ test "runStep: provider 500 retries with backoff notification" {
h.seedInto(agent);
agent._open_stream_fn = stub.install();
-
var rr = RetryRecorder{ .allocator = allocator };
defer rr.deinit();
try drainTurnRecording(agent, "hi", &rr);
@@ -3307,7 +3304,6 @@ test "runStep: provider auth failure does not retry" {
h.seedInto(agent);
agent._open_stream_fn = stub.install();
-
var rr = RetryRecorder{ .allocator = allocator };
defer rr.deinit();
try testing.expectError(error.ProviderAuthFailed, drainTurnRecording(agent, "hi", &rr));
@@ -3346,7 +3342,6 @@ test "runStep: retries exhaust and hard-fail after max_attempts" {
h.seedInto(agent);
agent._open_stream_fn = stub.install();
-
var rr = RetryRecorder{ .allocator = allocator };
defer rr.deinit();
try testing.expectError(error.ProviderUnavailable, drainTurnRecording(agent, "hi", &rr));
@@ -3477,7 +3472,6 @@ test "runStep: Retry-After is honored and reported" {
h.seedInto(agent);
agent._open_stream_fn = stub.install();
-
var rr = RetryRecorder{ .allocator = allocator };
defer rr.deinit();
try drainTurnRecording(agent, "hi", &rr);