diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/acpx_sidecar_transport.rs b/packages/paperclip-runner/runner/crates/runner-core/src/acpx_sidecar_transport.rs index 8444b049094..731227117e4 100644 --- a/packages/paperclip-runner/runner/crates/runner-core/src/acpx_sidecar_transport.rs +++ b/packages/paperclip-runner/runner/crates/runner-core/src/acpx_sidecar_transport.rs @@ -694,6 +694,9 @@ fn response_error_classification(error: &ResponseError) -> &'static str { "AGENT_STARTUP_FAILED.OTHER" => return "agent_startup_other", "AGENT_DISCONNECTED" => return "agent_disconnected", "AUTH_REQUIRED" => return "authentication_required", + "COPILOT_AUTH_REQUIRED" => return "authentication_required", + "COPILOT_ENTITLEMENT_DENIED" => return "provider_entitlement_denied", + "COPILOT_MODEL_UNAVAILABLE" => return "requested_model_unsupported", "SESSION_RESUME_REQUIRED" => return "session_resume_required", "SESSION_MODE_REPLAY_FAILED" => return "session_mode_replay_failed", "SESSION_MODEL_REPLAY_FAILED" => return "session_model_replay_failed", @@ -804,6 +807,30 @@ mod tests { } } + #[test] + fn candidate_auth_diagnostics_use_only_closed_codes_and_never_provider_text() { + for (code, expected) in [ + ("COPILOT_AUTH_REQUIRED", "authentication_required"), + ("COPILOT_ENTITLEMENT_DENIED", "provider_entitlement_denied"), + ("COPILOT_MODEL_UNAVAILABLE", "requested_model_unsupported"), + ("COPILOT_AUTH_REQUIRED_EXTRA", "unclassified"), + ("COPILOT_REQUEST_FAILED", "unclassified"), + ("UNKNOWN_CANDIDATE_FAILURE", "unclassified"), + ] { + let error = ResponseError { + code: code.to_owned(), + message: + "private-token-canary COPILOT_AUTH_REQUIRED https://user:secret@example.invalid" + .to_owned(), + retryable: false, + }; + let classification = response_error_classification(&error); + assert_eq!(classification, expected); + assert!(!classification.contains("canary")); + assert!(!classification.contains("secret")); + } + } + #[test] fn classifies_only_allowlisted_internal_sidecar_failures() { let error = |code: &str, message: &str| ResponseError {