From d9d206ee00fd8bd4ac0239ae42d7ae2f178c402d Mon Sep 17 00:00:00 2001 From: PJ Date: Mon, 13 Jul 2026 07:02:17 +0530 Subject: [PATCH] feat(verifier): read llm instructions off config --- internal/verifier/llm.go | 9 ++++++++- internal/verifier/llm_test.go | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/internal/verifier/llm.go b/internal/verifier/llm.go index a5f6c2f..fe9c1a3 100644 --- a/internal/verifier/llm.go +++ b/internal/verifier/llm.go @@ -12,6 +12,9 @@ import ( // read off globalThis.actions when the spec assigned `actions = llm({...})`. type LLMConfig struct { Model string + // Instructions is optional spec-level guidance appended to the prompt to + // steer the model toward bug-hunting (empty when unset). + Instructions string } // LLMConfig reports the LLM action backend config when the spec selected it @@ -42,7 +45,11 @@ func (v *Verifier) LLMConfig() (LLMConfig, bool) { if value := configObject.Get("model"); value != nil && !goja.IsUndefined(value) { model = value.String() } - return LLMConfig{Model: model}, true + instructions := "" + if value := configObject.Get("instructions"); value != nil && !goja.IsUndefined(value) && !goja.IsNull(value) { + instructions = value.String() + } + return LLMConfig{Model: model, Instructions: instructions}, true } // Screenshot returns the most recent step's screenshot PNG (set by diff --git a/internal/verifier/llm_test.go b/internal/verifier/llm_test.go index 686ebcd..a1a4fb4 100644 --- a/internal/verifier/llm_test.go +++ b/internal/verifier/llm_test.go @@ -96,6 +96,20 @@ func TestLLMConfigDetectsMarker(t *testing.T) { if config.Model != "vendor/model" { t.Errorf("model = %q, want vendor/model", config.Model) } + if config.Instructions != "" { + t.Errorf("instructions = %q, want empty when unset", config.Instructions) + } +} + +func TestLLMConfigReadsInstructions(t *testing.T) { + v := newLoadedVerifier(t, `globalThis.actions = { kind: "llm", config: { model: "m", instructions: "find bugs" } };`) + config, ok := v.LLMConfig() + if !ok { + t.Fatal("LLMConfig not detected") + } + if config.Instructions != "find bugs" { + t.Errorf("instructions = %q, want %q", config.Instructions, "find bugs") + } } func TestLLMConfigAbsentForSeededSpec(t *testing.T) {