The loop runner hooks every model call and tool call and reports ordered,
redacted, clipped entries. Each is persisted as an agent_transcript task
event through InsertEvent, left out of the timeline read, and served per
attempt at /api/tasks/{id}/transcript. The step run view shows it with Trace.
42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
//go:build unix
|
|
|
|
package agentexec
|
|
|
|
import (
|
|
"os"
|
|
"os/exec"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/samcharles93/archie-core/internal/domain/agentrun"
|
|
)
|
|
|
|
func TestHarnessLiveOutput(t *testing.T) {
|
|
if os.Getenv("ARCHIE_TEST_HARNESS_OUTPUT") == "1" {
|
|
adapter := &codexHarnessOutput{}
|
|
user := ""
|
|
if os.Geteuid() == 0 {
|
|
user = "65534"
|
|
}
|
|
err := invoke(t.Context(), "/tmp", &agentrun.HarnessSpec{User: user}, []string{"sh", "-c", `printf '%s\n' '{"type":"thread.started","thread_id":"live-thread"}'; printf '%s\n' 'live diagnostic' >&2`}, adapter, agentrun.Reporter{})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if adapter.SessionID() != "live-thread" {
|
|
t.Fatal("forwarding lost the adapter input")
|
|
}
|
|
return
|
|
}
|
|
cmd := exec.CommandContext(t.Context(), os.Args[0], "-test.run=^TestHarnessLiveOutput$")
|
|
cmd.Env = append(os.Environ(), "ARCHIE_TEST_HARNESS_OUTPUT=1")
|
|
got, err := cmd.CombinedOutput()
|
|
if err != nil {
|
|
t.Fatalf("harness: %v: %s", err, got)
|
|
}
|
|
for _, want := range []string{"live-thread", "live diagnostic"} {
|
|
if !strings.Contains(string(got), want) {
|
|
t.Errorf("worker output %q is missing %q", got, want)
|
|
}
|
|
}
|
|
}
|