Skip to content

fix: address review findings from PR #475 and #477#479

Merged
BYK merged 1 commit into
mainfrom
fix/review-findings
May 27, 2026
Merged

fix: address review findings from PR #475 and #477#479
BYK merged 1 commit into
mainfrom
fix/review-findings

Conversation

@BYK
Copy link
Copy Markdown
Owner

@BYK BYK commented May 27, 2026

Summary

Addresses findings from the adversarial self-review of PR #475 and #477.

Changes

C1 — Unknown block types silently dropped in parseAnthropicResponseJSON

Added a default case to the content block switch that preserves unknown block types as serialized JSON text. This matches the pattern used in toGatewayBlock() for request parsing and prevents silent data loss if Anthropic adds new content block types.

C2 — Invalid scope values accepted by filterOps()

Changed scope validation from typeof o.scope === "string" to o.scope === "project" || o.scope === "global". Previously, an LLM producing an invalid scope like "session" or "" would pass validation and create all entries with projectPath: undefined (global scope) regardless of intent.

M2 — looksLikeApiKey() doesn't trim or reject whitespace

Added key.trim() and a /\s/ check. Environment variables can contain trailing newlines which would pass the length check but fail at the API.

M4 — /onnxruntime/i pattern too broad

Removed the overly broad /onnxruntime/i pattern from TRANSIENT_ERROR_PATTERNS. The three specific patterns that follow it (Cannot find package, LoadLibrary failed, Protobuf parsing failed) already cover the known ONNX init failures without risking silencing real bugs.

M5 — /Incorrect API key/i could match unrelated auth errors

Narrowed to /Incorrect API key provided/i which is the specific error message format returned by the OpenAI SDK, avoiding false positives from other auth error formats.

Test Plan

  • All 1915 tests pass
  • Typecheck passes across all 4 packages

- Add default case to parseAnthropicResponseJSON() to preserve unknown
  block types as text instead of silently dropping them (C1)
- Validate scope enum values ('project' | 'global') in filterOps()
  instead of accepting any string (C2)
- Add whitespace trimming and rejection to looksLikeApiKey() (M2)
- Remove overly broad /onnxruntime/i pattern from beforeSend filter,
  keep only the three specific ONNX patterns (M4)
- Narrow 'Incorrect API key' pattern to 'Incorrect API key provided'
  to avoid matching unrelated auth errors (M5)
@BYK BYK merged commit 9b2827a into main May 27, 2026
7 checks passed
@BYK BYK deleted the fix/review-findings branch May 27, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant