Skip to content

refactor: separate upstream error classification and logging - #11875

Merged
lpcox merged 3 commits into
mainfrom
copilot/refactor-upstream-response-modules
Nov 20, 2026
Merged

lpcox merged 3 commits into
mainfrom
copilot/refactor-upstream-response-modules

Conversation

@lpcox

@lpcox lpcox commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Upstream response handling mixes forwarding and retry orchestration with diagnostics and credential redaction, making the error path difficult to review independently.

  • Classification: Extract dependency-free model-error predicates.
  • Logging: Isolate logger setup, audit routing, request metadata, and credential-redacted stream-error handling; reuse existing logging factories.
  • Integration: Preserve public and testing exports, retry semantics, and forwarding behavior. Include both new modules in the Docker image.

@lpcox lpcox changed the title [WIP] Refactor upstream response handling into focused modules refactor: separate upstream error classification and logging Nov 20, 2026
@lpcox
lpcox marked this pull request as ready for review November 20, 2026 18:00
Copilot AI adaptive review requested due to automatic review settings November 20, 2026 18:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The model-routing smoke workflow omits the extracted classification and logging modules from its push paths, so changes limited to those modules on main skip validation.

1 open issue
What changed in this PR

Refactors API-proxy upstream response handling into focused classification and logging modules, keeping the response orchestrator smaller while preserving its existing interfaces.

Changes:

  • Extracts model-error predicates and isolates logging, audit routing, request metadata, and credential-redacted stream-error handling.
  • Adds focused module tests and export-compatibility checks.
  • Includes both new runtime modules in the Docker image.
File Description
containers/​api-proxy/​upstream-response.test.js Adds public-export and testing-helper compatibility checks.
containers/​api-proxy/​upstream-response.js Delegates classification and logging to the extracted modules.
containers/​api-proxy/​upstream-error-logging.test.js Tests audit routing, redaction, cancellation, and request metadata.
containers/​api-proxy/​upstream-error-logging.js Centralizes logging setup and stream-error handling.
containers/​api-proxy/​upstream-error-classification.test.js Tests model-error classification patterns.
containers/​api-proxy/​upstream-error-classification.js Provides dependency-free model-error predicates.
containers/​api-proxy/​Dockerfile Copies both extracted modules into the image.

Review effort: Max (adaptive)

Comment on lines +3 to +5
parseModelNotSupportedFromBody,
parseModelEndpointBlockedFromBody,
} = require('./upstream-error-classification');
@lpcox

lpcox commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot address review feedback

@github-actions

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@lpcox Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

Copilot AI commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

@copilot address review feedback

Added both extracted modules to the model-routing smoke workflow’s push paths. Commit: 23f7fa5.

@lpcox
lpcox merged commit 366b142 into main Nov 20, 2026
38 of 39 checks passed
@lpcox
lpcox deleted the copilot/refactor-upstream-response-modules branch November 20, 2026 20:36
@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test

  • refactor: separate upstream error classification and logging
  • Split API-proxy body handling into focused modules
  • GitHub PR reads: ✅
  • Build: ✅
  • File write/read: ✅
  • Playwright title check: ❌
  • Overall: FAIL

🔮 The oracle has spoken through Smoke Codex
Add label ready-for-aw to run again

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.

[Refactoring] Split containers/api-proxy/upstream-response.js into focused modules

3 participants