fix(cos): skip investigation task creation for API access errors#96
fix(cos): skip investigation task creation for API access errors#96
Conversation
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.
There was a problem hiding this comment.
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_CATEGORIESto 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 callingcreateInvestigationTask()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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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.