Refactor chaterror.Classify to normalize evidence gathering
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
Línea de trabajo
Empieza por coderd/x/chatd/chaterror/classify.go y después lee signals.go y provider_error.go para seguir cómo se recopilan y muestran actualmente el transporte y el texto de respuesta estructurado. Ejecuta las pruebas de señales existentes de chaterror y, después, haz que las fuentes de evidencia sean coherentes y añade la matriz de solo body/solo transporte descrita en el issue; se considera terminado cuando todas las señales se clasifiquen de forma idéntica independientemente de la fuente, sin cambiar la firma pública de Classify.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Note: this issue was filed by an over-eager agent with too many MCP tools.
Context
PR coder/coder#27913 fixed a bug where a Bedrock credential resolution failure was incorrectly retried as a generic 500. The fix widened several signal checks in chaterror.Classify to read combinedText (the merged transport wrapper + structured response body) instead of lower (just the wrapper).
This exposed a structural issue: the classifier has two parallel text sources (lower from err.Error() and structured.detail from ProviderError.ResponseBody) and signal checks inconsistently pick which to match against. PR coder/coder#27913 widened the body-only signals, but the underlying design is fragile.
Problems
-
Two-source inconsistency: Some signals check
lower, some checkcombinedText, and it is unclear which uses which without reading each line. New signal checks can silently regress tolower-only. -
Pattern sprawl: Too many string patterns across too many signal lists (
overloadedPatterns,authStrongPatterns,configPatterns,timeoutPatterns, etc.) without documentation of which provider incident motivated each pattern. -
Signal/display coupling:
structured.detail(used for signal matching) is the first line of the response body only (providerErrorResponseMessagetruncates at the first newline). If the useful signal text appears on line 2+, it is missed. The signal source and the user-facing detail display are the same string; they should be decoupled.
Proposed approach
Data-flow normalization, not a rule engine:
- One
gatherEvidencestep at the top ofClassifythat produces a single struct: lowercased combined text (transport error + full structured body, not just first line), status code, and any structured provider fields. - Every signal check reads only from the evidence struct. No signal touches raw inputs.
- Keep the prioritized rule ordering as plain Go code. Do not build a pattern-matching DSL or data-driven rule table.
- Decouple signal matching text from user-facing detail display text.
Non-goals
- No new error taxonomy.
- No change to
Classify's public signature. - No pattern DSL or data-driven rule engine.
Test strategy
Convert signal tests to a matrix that programmatically asserts each source-agnostic signal classifies correctly when the pattern arrives via body-only and via transport-only. This makes "forgot to check the other source" impossible to reintroduce silently.
Related
- PR coder/coder#27913 (the incremental fix)
coderd/x/chatd/chaterror/classify.go(the classifier)coderd/x/chatd/chaterror/signals.go(the pattern definitions)coderd/x/chatd/chaterror/provider_error.go(response body extraction)
- Lenguaje dominante
- Sin datos de lenguaje
- Estrellas
- 3
- Forks
- 0
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de coder/internal
-
flake
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
flake
-
flake
-
flake
Todos los issues de coder/internal
Issues similares
-
Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Automattic/safe-publish#593 ·
-
executions.Query — startDate and timeRange filters are sent with inverted comparison operators Abiertoarea/plugin
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
kestra-io/plugin-kestra#190 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
xinnan-tech/xiaozhi-fde-talk#263 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
pending-maintainer-response pending-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100