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)
| 72 | // limit and 400s (or is silently truncated). On failure, raise ctx.FixedSystem; |
| 73 | // don't loosen the assertion. |
| 74 | func 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. |
| 86 | func TestCtrlDEmptyQuits(t *testing.T) { |
nothing calls this directly
no test coverage detected