refactor(agents): move error taxonomy to app/agents/shared/errors (slice 1)

First slice of promoting the shared agent toolkit out of the misnamed
`new_chat` package into the cross-agent `app/agents/shared` kernel.

`errors.py` is a leaf module (no intra-package deps) consumed by the
multi-agent chat, the chat streaming flows/monolith, and tests — i.e. it is
shared infrastructure, not single-agent code. Moved it verbatim to
`app.agents.shared.errors` and flipped all 12 importers. No re-export shim
remains since zero importers needed it.

Behavior-preserving: identical class/enum definitions; only the import path
changes. 1208 agent + chat-task tests green.
This commit is contained in:
CREDO23 2026-06-04 12:13:55 +02:00
parent a4010a357f
commit 0354f73f29
13 changed files with 13 additions and 13 deletions

View file

@ -4,7 +4,7 @@ from __future__ import annotations
import pytest
from app.agents.new_chat.errors import BusyError
from app.agents.shared.errors import BusyError
from app.agents.new_chat.middleware.busy_mutex import (
BusyMutexMiddleware,
end_turn,

View file

@ -93,7 +93,7 @@ class TestPermissionMiddlewareIntegration:
def test_middleware_raises_interrupt_for_rm_in_desktop_mode(self) -> None:
from langchain_core.messages import AIMessage
from app.agents.new_chat.errors import RejectedError
from app.agents.shared.errors import RejectedError
mw = PermissionMiddleware(rulesets=[SURFSENSE_DEFAULTS, DESKTOP_SAFETY_RULESET])
# Stub the interrupt to a "reject" decision so we can assert the

View file

@ -5,7 +5,7 @@ from __future__ import annotations
import pytest
from langchain_core.messages import AIMessage, ToolMessage
from app.agents.new_chat.errors import CorrectedError, RejectedError
from app.agents.shared.errors import CorrectedError, RejectedError
from app.agents.new_chat.middleware.permission import (
PermissionMiddleware,
_normalize_permission_decision,

View file

@ -16,7 +16,7 @@ from typing import Any
import pytest
from app.agents.new_chat.errors import BusyError
from app.agents.shared.errors import BusyError
from app.agents.new_chat.middleware.busy_mutex import request_cancel, reset_cancel
from app.tasks.chat.stream_new_chat import (
_classify_stream_exception as old_classify,

View file

@ -7,7 +7,7 @@ from pathlib import Path
import pytest
import app.tasks.chat.stream_new_chat as stream_new_chat_module
from app.agents.new_chat.errors import BusyError
from app.agents.shared.errors import BusyError
from app.agents.new_chat.middleware.busy_mutex import request_cancel, reset_cancel
from app.tasks.chat.stream_new_chat import (
StreamResult,