[codex] Structure missing provider command failures#3384
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Approved This PR refactors an error class to use structured fields (binaryPath, exitCode, stdout, stderr) instead of a plain message string, improving diagnostics for command-not-found failures. The change is self-contained with added unit tests and no behavioral impact beyond richer error information. You can customize Macroscope's approvability policy. Learn more. |
Summary
Tests
vp test apps/server/src/provider/providerSnapshot.test.tsvp checkvp run typecheckNote
Low Risk
Localized error-type change in provider spawn probing; behavior for callers using
isCommandMissingCausestays compatible, with richer failure data available.Overview
Replaces the generic
ProviderCommandExecutionError(message-only) withProviderCommandNotFoundError, a schema-backed tagged error that carriesbinaryPath,exitCode,stdout, andstderrwhen a provider CLI spawn fails with Windows “command not found” semantics.spawnAndCollectnow fails with that structured error instead of synthesizing an ENOENT-style message.isCommandMissingCausetreats the new error type as a missing command while still matching legacy message patterns (enoent/notfound).Adds a unit test asserting diagnostics and message formatting for a typical Windows 9009 failure.
Reviewed by Cursor Bugbot for commit 0b2b3d8. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Structure provider command-not-found failures with typed
ProviderCommandNotFoundErrorProviderCommandExecutionError(message-only) with aSchema.TaggedErrorClasscalledProviderCommandNotFoundErrorthat carriesbinaryPath,exitCode,stdout, andstderrfields.isCommandMissingCauseto detectProviderCommandNotFoundErrorvia a type guard first, falling back to substring checks on the error message.spawnAndCollectto emitProviderCommandNotFoundError(with structured diagnostics) on Windows command-not-found cases instead of the old generic error.ProviderCommandExecutionErroris removed; any callers that matched on that type will break.Macroscope summarized 0b2b3d8.