Skip to content

Commit 9e49f30

Browse files
committed
fix: improve preflight auth check and remove incorrect BYOK skip guards
- Enhanced preflight check to catch 401/authorization/authentication errors (previously only caught 402/quota), ensuring BYOK tests with expired API keys are properly skipped instead of producing false positive passes - Removed all 14 incorrect BYOK skip guards that were skipping harness-level features (tool calling, streaming, file attachments, reasoning effort) that work fine with any BYOK provider - Reverted debug logging (stderr thread, request dumps) added during investigation - Log level restored to 'info' from 'debug'
1 parent 0de2402 commit 9e49f30

1 file changed

Lines changed: 5 additions & 29 deletions

File tree

tests/test_e2e.cpp

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,11 @@ class E2ETest : public ::testing::Test
225225
c = static_cast<char>(std::tolower(static_cast<unsigned char>(c)));
226226

227227
if (lower.find("quota") != std::string::npos ||
228-
lower.find("402") != std::string::npos)
228+
lower.find("402") != std::string::npos ||
229+
lower.find("401") != std::string::npos ||
230+
lower.find("authorization") != std::string::npos ||
231+
lower.find("authentication") != std::string::npos ||
232+
lower.find("unauthorized") != std::string::npos)
229233
{
230234
copilot_can_run_ = false;
231235
copilot_skip_reason_ =
@@ -379,8 +383,6 @@ TEST_F(E2ETest, CreateSessionWithModel)
379383

380384
TEST_F(E2ETest, CreateSessionWithTools)
381385
{
382-
if (is_byok_active())
383-
GTEST_SKIP() << "BYOK model does not support tool calling";
384386
test_info("Tool execution test: Register custom tool, ask AI to use it, verify tool called with correct args.");
385387
auto client = create_client();
386388
client->start().get();
@@ -603,8 +605,6 @@ TEST_F(E2ETest, SendMessage)
603605

604606
TEST_F(E2ETest, StreamingResponse)
605607
{
606-
if (is_byok_active())
607-
GTEST_SKIP() << "BYOK model does not support streaming deltas";
608608
test_info("Streaming response: Enable streaming, send prompt, verify multiple AssistantMessageDelta events.");
609609
auto client = create_client();
610610
client->start().get();
@@ -812,8 +812,6 @@ TEST_F(E2ETest, ResumeSession)
812812

813813
TEST_F(E2ETest, ResumeSessionWithTools)
814814
{
815-
if (is_byok_active())
816-
GTEST_SKIP() << "BYOK model does not support tool calling";
817815
test_info("Resume with tools: Create session, stop, resume with new tool, invoke tool successfully.");
818816

819817
// BYOK/OpenAI doesn't support resuming sessions with new tools
@@ -1697,8 +1695,6 @@ TEST_F(E2ETest, SystemMessageReplaceMode)
16971695

16981696
TEST_F(E2ETest, MessageWithFileAttachment)
16991697
{
1700-
if (is_byok_active())
1701-
GTEST_SKIP() << "BYOK model does not support file attachments";
17021698
test_info("File attachment: Attach temp file to message, verify AI reads file content.");
17031699
auto client = create_client();
17041700
client->start().get();
@@ -1770,8 +1766,6 @@ TEST_F(E2ETest, MessageWithFileAttachment)
17701766

17711767
TEST_F(E2ETest, MessageWithMultipleAttachments)
17721768
{
1773-
if (is_byok_active())
1774-
GTEST_SKIP() << "BYOK model does not support file attachments";
17751769
test_info("Multiple attachments: Attach two files, verify AI references content from both.");
17761770
auto client = create_client();
17771771
client->start().get();
@@ -1855,8 +1849,6 @@ TEST_F(E2ETest, MessageWithMultipleAttachments)
18551849

18561850
TEST_F(E2ETest, ToolCallIdIsPropagated)
18571851
{
1858-
if (is_byok_active())
1859-
GTEST_SKIP() << "BYOK model does not support tool calling";
18601852
test_info("Tool call ID propagation: Verify tool_call_id is passed to handler and matches events.");
18611853
auto client = create_client();
18621854
client->start().get();
@@ -2044,8 +2036,6 @@ TEST_F(E2ETest, ResumeSessionWithPermissionCallback)
20442036

20452037
TEST_F(E2ETest, ResumeSessionWithToolsAndPermissions)
20462038
{
2047-
if (is_byok_active())
2048-
GTEST_SKIP() << "BYOK model does not support tool calling";
20492039
test_info("Resume with tools+perms: Resume with both tools and permission callback, invoke tool.");
20502040

20512041
// BYOK/OpenAI doesn't support resuming sessions with new tools
@@ -2236,8 +2226,6 @@ TEST_F(E2ETest, PermissionDenialWithMessage)
22362226

22372227
TEST_F(E2ETest, FluentToolBuilderIntegration)
22382228
{
2239-
if (is_byok_active())
2240-
GTEST_SKIP() << "BYOK model does not support tool calling";
22412229
test_info("Fluent ToolBuilder: Use ToolBuilder API for calc+echo tools, verify both work.");
22422230
auto client = create_client();
22432231
client->start().get();
@@ -2820,8 +2808,6 @@ TEST_F(E2ETest, SessionWithHooksConfigCreatesSuccessfully)
28202808

28212809
TEST_F(E2ETest, PreToolUseHookInvokedOnToolCall)
28222810
{
2823-
if (is_byok_active())
2824-
GTEST_SKIP() << "BYOK model does not support tool calling";
28252811
test_info("Pre-tool-use hook: Register preToolUse hook with a tool, verify hook fires.");
28262812
auto client = create_client();
28272813
client->start().get();
@@ -2908,8 +2894,6 @@ TEST_F(E2ETest, PreToolUseHookInvokedOnToolCall)
29082894

29092895
TEST_F(E2ETest, PreToolUseHookDeniesToolExecution)
29102896
{
2911-
if (is_byok_active())
2912-
GTEST_SKIP() << "BYOK model does not support tool calling";
29132897
test_info("Hook deny: preToolUse hook denies tool execution via decision='deny'.");
29142898
auto client = create_client();
29152899
client->start().get();
@@ -3005,8 +2989,6 @@ TEST_F(E2ETest, PreToolUseHookDeniesToolExecution)
30052989

30062990
TEST_F(E2ETest, PostToolUseHookInvokedAfterToolExecution)
30072991
{
3008-
if (is_byok_active())
3009-
GTEST_SKIP() << "BYOK model does not support tool calling";
30102992
test_info("Post-tool-use hook: Register postToolUse hook, verify fires after tool runs.");
30112993
auto client = create_client();
30122994
client->start().get();
@@ -3136,8 +3118,6 @@ TEST_F(E2ETest, SessionWithUserInputHandlerCreates)
31363118

31373119
TEST_F(E2ETest, SessionWithReasoningEffort)
31383120
{
3139-
if (is_byok_active())
3140-
GTEST_SKIP() << "BYOK model does not support reasoning effort";
31413121
test_info("Reasoning effort: Create session with reasoning effort set, verify it's accepted.");
31423122
auto client = create_client();
31433123
client->start().get();
@@ -3396,8 +3376,6 @@ TEST_F(E2ETest, SessionWithWorkingDirectory)
33963376

33973377
TEST_F(E2ETest, ResumeSessionWithNewConfigFields)
33983378
{
3399-
if (is_byok_active())
3400-
GTEST_SKIP() << "BYOK model does not support reasoning effort";
34013379
test_info("Resume with new fields: Create session, then resume with v0.1.23 config fields.");
34023380
auto client = create_client();
34033381
client->start().get();
@@ -3488,8 +3466,6 @@ TEST_F(E2ETest, ModelInfoReasoningEffortFields)
34883466

34893467
TEST_F(E2ETest, FullFeaturedSessionWithAllNewConfig)
34903468
{
3491-
if (is_byok_active())
3492-
GTEST_SKIP() << "BYOK model does not support tool calling";
34933469
test_info("Full config: Create session with all v0.1.23 features combined.");
34943470
auto client = create_client();
34953471
client->start().get();

0 commit comments

Comments
 (0)