mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-30 03:00:41 -04:00
fix(backend/copilot): address review comments cycle 1
- Replace redundant elif guard with plain else in service.py restore path - Use isinstance(…, Exception) instead of BaseException in gather error checks for upload_cli_session (BaseException swallows KeyboardInterrupt) - Use explicit list side_effect in test_returns_none_when_file_not_found to document the two-call contract of the concurrent retrieve gather
This commit is contained in:
@@ -2503,9 +2503,7 @@ async def stream_chat_completion_sdk(
|
||||
log_prefix,
|
||||
)
|
||||
transcript_covers_prefix = False
|
||||
elif (
|
||||
config.claude_agent_use_resume and user_id and len(session.messages) > 1
|
||||
):
|
||||
else:
|
||||
# No CLI session in GCS — reconstruct from DB messages as last-resort fallback.
|
||||
prior = session.messages[:-1]
|
||||
reconstructed = _session_messages_to_transcript(prior)
|
||||
|
||||
@@ -762,12 +762,12 @@ async def upload_cli_session(
|
||||
),
|
||||
return_exceptions=True,
|
||||
)
|
||||
if isinstance(session_result, BaseException):
|
||||
if isinstance(session_result, Exception):
|
||||
logger.warning(
|
||||
"%s Failed to upload CLI session file: %s", log_prefix, session_result
|
||||
)
|
||||
return
|
||||
if isinstance(meta_result, BaseException):
|
||||
if isinstance(meta_result, Exception):
|
||||
logger.warning(
|
||||
"%s Failed to upload CLI session meta: %s", log_prefix, meta_result
|
||||
)
|
||||
|
||||
@@ -982,7 +982,10 @@ class TestRestoreCliSession:
|
||||
from .transcript import restore_cli_session
|
||||
|
||||
mock_storage = AsyncMock()
|
||||
mock_storage.retrieve.side_effect = FileNotFoundError("not found")
|
||||
mock_storage.retrieve.side_effect = [
|
||||
FileNotFoundError("no session"),
|
||||
FileNotFoundError("no meta"),
|
||||
]
|
||||
|
||||
with patch(
|
||||
"backend.copilot.transcript.get_workspace_storage",
|
||||
|
||||
Reference in New Issue
Block a user