Repository navigation
Description
Three defects observed during a live verification session against a running core. All are pre-existing and independent of the feature being verified; grouped because they were all found in the same PATCH /api/v1/config / GET /api/v1/status session.
1. Invalid config value returns HTTP 500, not 400
PATCH /api/v1/config with {"direct_tool_response_mode":"bogus"}:
HTTP/1.1 500 Internal Server Error
{"success":false,"error":"Failed to apply configuration: configuration validation failed: direct_tool_response_mode: invalid direct tool response mode: bogus (must be \"full\" or \"deferred\")"}
The behaviour is safe — validation caught it and the config file was left untouched — and the message is genuinely good. Only the status code is wrong: a client-supplied invalid value is a 400, not a server fault. This matters for clients that retry on 5xx.
Suggested fix: classify the ApplyConfig error in the handler — when the result carries ValidationErrors (or the error is a config-validation error), return http.StatusBadRequest with the ValidationErrors payload, reserving 500 for marshal/persist failures. The sibling call sites in internal/httpapi/ need the same treatment.
Around internal/httpapi/server.go:4665.
2. Malformed structured log line on config-apply failure
The same rejected PATCH produced:
ERROR httpapi/server.go:651 Failed to apply configuration patcherrorconfiguration validation failed: direct_tool_response_mode: ...
Note patcherrorconfiguration — the message, the error key and its value are concatenated with no separators. The call is s.logger.Error("Failed to apply configuration patch", "error", err), i.e. sugared-style key/value pairs passed to a non-sugared Error. The reported server.go:651 is also not the real call site, so the logging shim needs AddCallerSkip.
3. /api/v1/status embeds a permanently stale copy of upstream stats
For an entire ~5-minute session — long after the upstream was Ready and the log confirmed Successfully indexed tools for server {server: everything, count: 13} — every poll returned:
data.status.tools_indexed = 0
data.status.upstream_stats.servers.everything.state = "Connecting"
data.status.upstream_stats.total_tools = 0
while the sibling top-level data.upstream_stats was correct throughout. Two fields describing the same thing disagree, and the nested one never converges.
Suggested fix: either refresh the embedded snapshot from the same source as the top-level upstream_stats before serving, or drop the duplicated data.status.upstream_stats / data.status.tools_indexed so there is a single authority. If it is deliberately a last-published-event snapshot, that should be documented in the OpenAPI description, because it currently reads as live data.
Activity
fix(settings): stop a resolved default being writable; sync roadmap/s…
feat(settings): expose both serialization modes in the Web UI and tray (
docs(changelog): record spec 102, the settings UI, and these fixes
fix: direct-surface describe ids (smart-mcp-proxy#1083), config-apply…