Files
harness/runtime/builder_test.go
T
sausheong 123a233cb7 Drop Felix references; harness stands as a platform on its own
Removes every Felix mention from public-facing surfaces so the framework
reads as a standalone agent platform rather than an extracted module.

User-visible changes:
- HTTP User-Agent on web_fetch / web_search: Felix/1.0 → harness/1.0
- bash tool path-substitution prefix: '[felix]' → '[harness]'
- On-disk paths: <workspace>/.felix/ → <workspace>/.harness/
  (todos.json + spill/ tree); tests updated in lockstep.
- OTel trace attributes: felix.trace_id / felix.total_ms /
  felix.phase_count → harness.* equivalents.

Doc-comment changes:
- Examples (lta-agent, data-agent) lose 'non-Felix consumer' framing.
- README drops the 'extracted from Felix' lede and the 'What was lifted
  from Felix' section, replaced with a 'Design' overview that points
  to developer.md.
- Runtime / tool / compaction doc comments rewritten so behaviour
  notes describe what the harness does without naming the prior origin.
- Test-fixture text 'you are felix' → 'you are an assistant'.

Verified: zero 'felix' (case-insensitive) in tracked .go / .md files.
All 16 packages build and pass tests.
2026-05-08 00:24:06 +08:00

54 lines
1.9 KiB
Go

package runtime
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestBuildRuntimeSetsProviderAndStaticPrompt(t *testing.T) {
spec := AgentSpec{ID: "a", Name: "A", Model: "anthropic/claude-sonnet-4-5"}
deps := RuntimeDeps{ConfigSummary: "Configured channels: cli"}
inputs := RuntimeInputs{}
rt, err := BuildRuntime(deps, inputs, spec)
require.NoError(t, err)
require.Equal(t, "anthropic", rt.Provider)
require.Equal(t, "claude-sonnet-4-5", rt.Model)
require.NotEmpty(t, rt.StaticSystemPrompt)
require.Contains(t, rt.StaticSystemPrompt, `"A" agent (id: a)`)
require.Contains(t, rt.StaticSystemPrompt, "Configured channels: cli")
}
func TestBuildRuntimeLocalProvider(t *testing.T) {
spec := AgentSpec{ID: "x", Name: "X", Model: "local/qwen2.5:3b"}
rt, err := BuildRuntime(RuntimeDeps{}, RuntimeInputs{}, spec)
require.NoError(t, err)
require.Equal(t, "local", rt.Provider)
}
func TestBuildRuntimeMinimalSpecSafe(t *testing.T) {
spec := AgentSpec{ID: "a", Name: "A", Model: "anthropic/claude-sonnet-4-5"}
rt, err := BuildRuntime(RuntimeDeps{}, RuntimeInputs{}, spec)
require.NoError(t, err)
require.Equal(t, "anthropic", rt.Provider)
require.NotEmpty(t, rt.StaticSystemPrompt)
}
func TestBuildRuntimeUsesCallerProvidedMemoryFiles(t *testing.T) {
// Caller composes memoryFiles however they want — typical patterns
// include walking AGENTS.md from workspace + $HOME, building from a
// wiki dump, or pulling from a doc index. Harness only concatenates
// it into the static prompt.
const sentinel = "MEMFILE_END_TO_END_SENTINEL"
deps := RuntimeDeps{
MemoryFiles: "\n\n## Project memory: AGENTS.md\n\n" + sentinel,
}
rt, err := BuildRuntime(deps, RuntimeInputs{}, AgentSpec{
ID: "a", Name: "A", Model: "anthropic/claude-sonnet-4-5",
})
require.NoError(t, err)
require.Contains(t, rt.StaticSystemPrompt, sentinel)
require.Contains(t, rt.StaticSystemPrompt, "## Project memory:")
}