Unified Agent + reusable Go agent core.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: keep codex json reminder for tool outputs

Lyric b17af04f df3c3094

+34
+5
providers/codex/client.go
··· 171 171 172 172 func inputMentionsJSON(messages []llm.Message) bool { 173 173 for _, msg := range messages { 174 + switch strings.ToLower(strings.TrimSpace(msg.Role)) { 175 + case "system", "user", "assistant": 176 + default: 177 + continue 178 + } 174 179 if strings.Contains(strings.ToLower(messageText(msg)), "json") { 175 180 return true 176 181 }
+29
providers/codex/client_test.go
··· 113 113 } 114 114 } 115 115 116 + func TestPrepareCodexRequestIgnoresToolOutputForJSONReminder(t *testing.T) { 117 + got, err := prepareCodexRequest(llm.Request{ 118 + ForceJSON: true, 119 + Messages: []llm.Message{ 120 + {Role: "system", Content: "system prompt"}, 121 + {Role: "user", Content: "list contacts"}, 122 + { 123 + Role: "assistant", 124 + ToolCalls: []llm.ToolCall{{ 125 + ID: "call_1", 126 + Type: "function", 127 + Name: "bash", 128 + RawArguments: `{"cmd":"find contacts"}`, 129 + }}, 130 + }, 131 + {Role: "tool", ToolCallID: "call_1", Content: "contacts/bus_outbox.json"}, 132 + }, 133 + }) 134 + if err != nil { 135 + t.Fatalf("prepareCodexRequest() error = %v", err) 136 + } 137 + if len(got.Messages) != 4 { 138 + t.Fatalf("messages = %+v", got.Messages) 139 + } 140 + if !strings.Contains(strings.ToLower(got.Messages[0].Content), "json") { 141 + t.Fatalf("first input message should mention JSON: %+v", got.Messages[0]) 142 + } 143 + } 144 + 116 145 func TestClientSendsBearerTokenAndCodexRequestShape(t *testing.T) { 117 146 stateDir := t.TempDir() 118 147 if err := codexauth.WriteToken(stateDir, codexauth.Token{