MCPcopy Index your code
hub / github.com/codehamr/codehamr / TestSystemPromptFitsFixedSystemReservation

Function TestSystemPromptFitsFixedSystemReservation

internal/tui/tui_test.go:74–83  ·  view source on GitHub ↗

TestSystemPromptFitsFixedSystemReservation pins ctx.FixedSystem against the embedded prompt. Grow the prompt past the reservation and Pack over-allocates to history on small-ctx profiles, so the next request exceeds the server's limit and 400s (or is silently truncated). On failure, raise ctx.FixedS

(t *testing.T)

Source from the content-addressed store, hash-verified

72// limit and 400s (or is silently truncated). On failure, raise ctx.FixedSystem;
73// don't loosen the assertion.
74func TestSystemPromptFitsFixedSystemReservation(t *testing.T) {
75 cfg, _, _ := config.Bootstrap(t.TempDir())
76 m := New(cfg, llm.New("http://x", cfg.ActiveProfile().LLM, ""), "/workspaces/codehamr", "test")
77 cost := chmctx.Message{Role: chmctx.RoleSystem, Content: m.system}.Tokens()
78 if cost > chmctx.FixedSystem {
79 t.Fatalf("system prompt costs %d tokens, FixedSystem reserves only %d - "+
80 "raise ctx.FixedSystem so Budget() doesn't over-allocate to history",
81 cost, chmctx.FixedSystem)
82 }
83}
84
85// TestCtrlDEmptyQuits: Ctrl+D on empty textarea returns a Quit command.
86func TestCtrlDEmptyQuits(t *testing.T) {

Callers

nothing calls this directly

Calls 5

BootstrapFunction · 0.92
NewFunction · 0.92
ActiveProfileMethod · 0.80
TokensMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected