Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/agent/preview.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"
)

var reTransientUserBlock = regexp.MustCompile(`(?s)^\s*<(?:reasoning-language|memory-update|background-jobs)>.*?</(?:reasoning-language|memory-update|background-jobs)>\s*\n?`)
var reTransientUserBlock = regexp.MustCompile(`(?s)^\s*<(?:reasoning-language|memory-update|background-jobs|active-goal)>.*?</(?:reasoning-language|memory-update|background-jobs|active-goal)>\s*\n?`)

// StripTransientUserBlocks removes controller-injected transient XML blocks
// from persisted user messages before deriving display text, previews, or
Expand Down
23 changes: 23 additions & 0 deletions internal/agent/preview_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package agent_test

import (
"reasonix/internal/agent"
"testing"
)

func TestStripTransientBlocksActiveGoal(t *testing.T) {
tests := []struct {
in, want string
}{
{"<active-goal>\nFix all bugs\n</active-goal>\n\nfix the auth bug", "fix the auth bug"},
{"<reasoning-language>\nuse Chinese\n</reasoning-language>\n\n<active-goal>\nDo X\n</active-goal>\n\nhelp me", "help me"},
{"<memory-update>\n- note\n</memory-update>\n\n<active-goal>\nGoal text\n</active-goal>\n\ndo it", "do it"},
{"<active-goal>\n\nmulti-line\ngoal\n</active-goal>\n\nuser text", "user text"},
}
for _, tt := range tests {
got := agent.StripTransientUserBlocks(tt.in)
if got != tt.want {
t.Errorf("StripTransientUserBlocks(%q) = %q, want %q", tt.in, got, tt.want)
}
}
}