Skip to content

fix(cos): skip investigation task creation for API access errors#96

Merged
atomantic merged 3 commits intomainfrom
cos/task-mmtkwxmx/agent-2a788a91
Mar 19, 2026
Merged

fix(cos): skip investigation task creation for API access errors#96
atomantic merged 3 commits intomainfrom
cos/task-mmtkwxmx/agent-2a788a91

Conversation

@atomantic
Copy link
Owner

When an agent fails due to auth-error, forbidden, or usage-limit, the task is moved to blocked without creating an investigation agent task that would also fail for the same reason.

When an agent fails due to auth-error, forbidden, or usage-limit,
the task is moved to blocked without creating an investigation agent
task that would also fail for the same reason.
Copilot AI review requested due to automatic review settings March 19, 2026 04:47
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates failure-handling in the CoS sub-agent spawner so tasks blocked due to specific API access failures (auth/forbidden/usage limit) do not also create an internal “investigation” task that would be expected to fail for the same underlying access reason.

Changes:

  • Introduces API_ACCESS_ERROR_CATEGORIES to identify access-related failures.
  • Adds maybeCreateInvestigationTask() wrapper to skip investigation task creation for those categories and centralize error handling.
  • Routes blocked-task flows through maybeCreateInvestigationTask() instead of calling createInvestigationTask() directly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

- Reword comment to say "access blocked/denied" instead of "unavailable"
- Add debug log when skipping investigation for API access errors
- Add tests for API_ACCESS_ERROR_CATEGORIES skip behavior
@atomantic atomantic requested a review from Copilot March 19, 2026 04:55
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates CoS task-failure handling so that when an agent fails due to LLM API access being denied/blocked (auth/forbidden/usage-limit), the task is moved to blocked without spawning a follow-on investigation task that would likely fail for the same reason.

Changes:

  • Add an allowlist of API-access failure categories and a maybeCreateInvestigationTask() helper to skip investigation task creation for those categories.
  • Route existing “blocked -> create investigation task” paths through the new helper.
  • Add unit tests intended to cover the skip logic for the new categories.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
server/services/subAgentSpawner.js Introduces API-access category skip logic and applies it when blocking failed tasks.
server/services/subAgentSpawner.test.js Adds tests around category-based skipping behavior (currently via a local helper).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

- Integrate skip logic into resolveFailedTaskStatus test helper (no separate duplicate)
- Update inline comment to reflect conditional investigation creation
- Add taskId and category to investigation task failure warning log
@atomantic atomantic requested a review from Copilot March 19, 2026 05:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the CoS task-failure handling to avoid creating follow-up “investigation” tasks when the underlying failure is due to LLM API access being denied/blocked (auth, forbidden, or usage-limit), since an investigation agent would likely fail for the same reason.

Changes:

  • Add an explicit allow/deny list (API_ACCESS_ERROR_CATEGORIES) to gate investigation task creation for access-related failures.
  • Route investigation task creation through a new helper (maybeCreateInvestigationTask) to centralize skip + logging behavior.
  • Update and extend unit tests to validate “skip investigation” behavior for the targeted categories.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
server/services/subAgentSpawner.js Introduces maybeCreateInvestigationTask and skips investigation task creation for access-denied error categories in failure handling.
server/services/subAgentSpawner.test.js Updates actionable-error tests and adds coverage ensuring investigation is skipped for auth-error, forbidden, and usage-limit.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@atomantic atomantic merged commit b085644 into main Mar 19, 2026
6 checks passed
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.

2 participants