Skip to content

flake: TestSubagentLifecycleToolsIncludePersistedSubagentTypeAcrossVariants/ComputerUse #1486

@flake-investigator

Description

@flake-investigator

CI Failure Information

Failure Details

  • Package: coderd/x/chatd
  • Failing test: TestSubagentLifecycleToolsIncludePersistedSubagentTypeAcrossVariants/ComputerUse
  • File: coderd/x/chatd/subagent_internal_test.go

Log excerpt:

=== FAIL: coderd/x/chatd TestSubagentLifecycleToolsIncludePersistedSubagentTypeAcrossVariants/ComputerUse (0.27s)
... processor: failed to process chat ...
error= resolve computer use model:
   ... chatd.go:6254
 - ANTHROPIC_API_KEY is not set:
   ... chatprovider.go:1276
subagent_internal_test.go:1016:
    Error: Not equal:
        expected: false
        actual  : true
    Messages:   unexpected tool error state: {"error":"task complete","type":"computer_use"}

Root Cause Analysis

This appears to be a deterministic regression rather than a flaky timing issue. The test sets ProviderAPIKeys{Anthropic: "test-anthropic-key"} for the ComputerUse variant, but resolveUserProviderAPIKeys prunes provider keys that are not enabled in DB. The test fixture (seedInternalChatDeps) only inserts an OpenAI provider, so the Anthropic key is dropped. When the computer-use subagent resolves its model, ModelFromConfig returns ANTHROPIC_API_KEY is not set, which flips resp.IsError to true and fails the assertion.

Likely fix: ensure the test config inserts/enables an Anthropic provider (or relax pruning for internal test/provider key overrides).

Assignment Analysis

  • git log --oneline -10 --follow coderd/x/chatd/subagent_internal_test.go
  • Most recent substantive change to this file is f073323c (Michael Suchacz) which refactored subagent spawn tooling. Assigning to @ibetitsmike as the most recent modifier of the failing test area.

Related Issues

  • No matching issues found after searching coder/internal for:
    • TestSubagentLifecycleToolsIncludePersistedSubagentTypeAcrossVariants
    • subagent_internal_test.go
    • ANTHROPIC_API_KEY is not set

Reproduction

go test ./coderd/x/chatd -run TestSubagentLifecycleToolsIncludePersistedSubagentTypeAcrossVariants/ComputerUse -count=1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions