[codex] Add dev text-turn test endpoint#5
Open
monkeyin92 wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an opt-in, local-only text-turn testing harness to the StreamCoreAI voice agent server, allowing smoke/regression testing of LLM + plugins/skills (+ optional RAG) without driving the WebRTC audio pipeline.
Changes:
- Introduces
test.turn_endpointconfig and documents it in README +config.toml.example. - Registers
POST /test-turnwhen enabled and implements the request/response handler. - Adds unit tests for the new HTTP handler.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents the new test.turn_endpoint dev-only flag and endpoint. |
| main.go | Conditionally registers the /test-turn route when enabled. |
| internal/testturn/handler.go | Implements the text-turn HTTP handler, prompt construction, optional RAG injection, and tool/skill wiring. |
| internal/testturn/handler_test.go | Adds basic request/response and error-mapping tests for the handler. |
| internal/config/config.go | Adds [test] section to the config struct (turn_endpoint). |
| config.toml.example | Adds an example [test] configuration block. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| if cfg.Test.TurnEndpoint { | ||
| log.Println("Dev test-turn endpoint enabled at POST /test-turn") | ||
| mux.HandleFunc("/test-turn", testturn.NewHandler(cfg, pluginMgr, ragClient)) |
Comment on lines
+150
to
+154
| client.SetToolHandler(func(callCtx context.Context, call llm.ToolCall) (string, error) { | ||
| tool, ok := a.pluginMgr.GetTool(call.Name) | ||
| if !ok { | ||
| return "", fmt.Errorf("unknown tool: %s", call.Name) | ||
| } |
| resp, err := run(r.Context(), req) | ||
| if err != nil { | ||
| log.Printf("[test-turn] error: %v", err) | ||
| writeJSON(w, http.StatusBadGateway, map[string]string{"error": err.Error()}) |
Comment on lines
+61
to
+65
| var req TurnRequest | ||
| decoder := json.NewDecoder(http.MaxBytesReader(w, r.Body, maxRequestBytes)) | ||
| if err := decoder.Decode(&req); err != nil { | ||
| writeJSON(w, http.StatusBadRequest, map[string]string{"error": "invalid JSON request"}) | ||
| return |
Author
|
Addressed the automated review hardening points in
Validation: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an opt-in local text-turn harness for regression and smoke testing without driving the live WebRTC audio path.
When
test.turn_endpoint = true, the server registersPOST /test-turnand accepts a single text turn (textorcustomerText) plus optional prior messages. The handler reuses the configured LLM, plugins, skills, and optional RAG context, then returns a Voice TestOps-compatible JSON response withspoken, streamed response events, and latency.Why
This gives local test tools a deterministic way to exercise assistant behavior without exposing or testing against a shared live demo agent. The endpoint is disabled by default and documented as dev-only.
Validation
go test ./...