Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Conversation

@mattjohnsonpint
Copy link
Contributor

Add proper error handling for checking when an agent id is not found

@mattjohnsonpint mattjohnsonpint requested review from a team and Copilot July 14, 2025 21:09

This comment was marked as outdated.

mattjohnsonpint and others added 2 commits July 14, 2025 14:10
Co-authored-by: Copilot <[email protected]>
@mattjohnsonpint mattjohnsonpint requested a review from Copilot July 14, 2025 21:12
Copy link
Contributor

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 adds proper error handling for cases where an agent ID is not found in the database. The changes standardize error handling across both ModusDB and PostgreSQL database backends by introducing a specific error type and consistent error checking patterns.

  • Introduces a new ErrAgentNotFound error variable for consistent error handling
  • Updates both database backend functions to return the specific error when no agent is found
  • Replaces nil state checks with proper error type checking in the agent message handling logic

Reviewed Changes

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

File Description
runtime/db/agentstate.go Adds ErrAgentNotFound variable and updates both database functions to return this error when agent is not found
runtime/actors/agents.go Replaces nil state check with proper error type checking using ErrAgentNotFound
CHANGELOG.md Documents the bug fix in the changelog
Comments suppressed due to low confidence (1)

runtime/actors/agents.go:228

  • [nitpick] The error message format is inconsistent. The previous message was "agent not found" but now includes the agent ID. Consider using a consistent format like "agent not found" or always include the ID for better debugging.
				return newAgentMessageErrorResponse(fmt.Sprintf("agent %s not found", agentId)), nil

@mattjohnsonpint mattjohnsonpint merged commit edf87db into main Jul 14, 2025
33 checks passed
@mattjohnsonpint mattjohnsonpint deleted the mjp/agent-not-found branch July 14, 2025 21:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants