#1741 - enhancement: improve agent registration failure messages and empty shell listing. - #1786
Conversation
… empty shell listing. Signed-off-by: Slava Imeshev <imeshev@yahoo.com>
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #1741 by improving user-facing output when listing agents in the shell (including an empty state) and by making agent auto-registration failures more explicit and actionable through clearer warnings and stricter validation.
Changes:
- Add an explicit empty-state response for the
agentsshell command and preserve detailed output + a concise summary when agents exist. - Improve agent registration failure warnings and enforce non-registration on GOAP validation failures, with new regression tests covering these cases.
- Adjust logging severity when an agent process runs with no goals (where goals are required).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| embabel-agent-shell/src/test/kotlin/com/embabel/agent/shell/ShellCommandsAgentsTest.kt | Adds regression tests for agents command empty-state and detailed/summary output. |
| embabel-agent-shell/src/main/kotlin/com/embabel/agent/shell/ShellCommands.kt | Implements empty-state handling and uses a Summary section for agents/actions listings. |
| embabel-agent-api/src/test/kotlin/com/embabel/agent/api/annotation/support/testTypes.kt | Adds new annotated test agent types to exercise registration/validation failure cases. |
| embabel-agent-api/src/test/kotlin/com/embabel/agent/api/annotation/support/AgentMetadataReaderMetadataTest.kt | Adds OutputCapture-based assertions ensuring explicit “not registered” warnings are logged. |
| embabel-agent-api/src/main/kotlin/com/embabel/agent/core/support/AbstractAgentProcess.kt | Raises log level to error when a goals-required process has no goals. |
| embabel-agent-api/src/main/kotlin/com/embabel/agent/api/annotation/support/AgentMetadataReader.kt | Improves warning messages for registration failures and returns null on GOAP validation failure. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…puts Nullable domain params skip the input precondition, so path validation failed with NO_PATH_TO_GOAL and createAgentMetadata returned null. Keep planner=GOAP; fix RetryActionAnnotationTest and ActionRetryPolicyPropertiesTest fixtures only. Signed-off-by: Slava Imeshev <imeshev@yahoo.com>
…lorPalette implementation via an anonymous ColorPalette object. Using DefaultColorPalette directly avoids duplication and keeps the test aligned if the default palette changes." Signed-off-by: Slava Imeshev <imeshev@yahoo.com>
|
@deleSerna - can it be closed, as you opened the issue? thanks. |
| @AchievesGoal(description = "Process the input") | ||
| @Action(actionRetryPolicyExpression = "\${retry-twice}") | ||
| fun perform(input: JavaRetryTestInput?): JavaRetryTestOutput { | ||
| fun perform(input: JavaRetryTestInput): JavaRetryTestOutput { |
There was a problem hiding this comment.
Guaranteed not null?
What prompted this change?
azanux
left a comment
There was a problem hiding this comment.
Thanks @simeshev , everything looks good, just one small blocker to check.
Nothing to do with your PR but it could impact the PR, so it would be nice to fix it at the same time:
AgentMetadataReader.kt:84:+instead of+=returns a new list and the result is discarded, so the error is never added. A blank@Agent(description = "")produces no warning at all:validationErrors()comes back empty and the agent registers silently.
| agent.name, | ||
| validationResult.errors.joinToString("\n"), | ||
| ) | ||
| return null |
There was a problem hiding this comment.
Agents whose goal action takes no input (or only a nullable one) silently stop registering.
agents that failed validation used to register with a warning, now they don't register at all.
Not sure but the bug seems to be in GoapPathToCompletionValidator.kt:215:
if (plan == null || plan.actions.isEmpty()) { // → NO_PATH_TO_GOALThere was a problem hiding this comment.
@simeshev @azanux - good point, for pointing to GoapPathToCompletionValidator ==> so it will be at the very end, properly reported, if there are no actions, per my understanding; rather than updating half a dozen log statements with the same PREFIX, it actually gets accommodated in a single place, correct?
There was a problem hiding this comment.
@igordayen It depends on how @simeshev resolve the behaviour change first: this PR uncommented the return null at line 313 : Agents whose goal action takes no input (or only a nullable one) used to register with a warning, and now don't register at all
On your point: partially right. Line 309 is the only warn fed by the validator, so that path is centralised. But lines others are early return nulls - validate() is only called at line 306, so they exit before it and never reach GoapPathToCompletionValidator.
There was a problem hiding this comment.
There was a problem hiding this comment.
Agents whose goal action takes no input (or only a nullable one) used to register with a warning, and now don't register at all
I can reduce the scope of thange and comment return null for now because this PR is supposed to be about improving error messaging. Would it do it?
There was a problem hiding this comment.
I can reduce the scope of the change and comment return null
Make sense to me. I assumed that would not have much impact. But it's better to leave that untouched for now.
I could look at the impact of that uncommenting null and raise a PR later.
There was a problem hiding this comment.
t depends on how @simeshev resolve the behaviour change first: this PR uncommented the return null at line 313 : Agents whose goal action takes no input (or only a nullable one) used to register with a warning, and now don't register at all
@simeshev - could you please comment on the behavior changes?
@azanux - per my understanding, the only open item as of now.
thanks.
| @AchievesGoal(description = "Process the input") | ||
| @Action(actionRetryPolicyExpression = "\${retry-twice}") | ||
| fun firstAction(input: RetryTestInput?): RetryTestOutput { | ||
| fun firstAction(input: RetryTestInput): RetryTestOutput { |
There was a problem hiding this comment.
This test covers retry behaviour, not sure that input nullability have to do with it.
maybe this needed because the new return null in AgentMetadataReader stops the agent registering, rather than because the fixture was wrong?
There was a problem hiding this comment.
What prompted this change?
…(name = "star-wars-fan")), not the class, so the log gives no clue which file to open - and this is the path where the agent gets removed, so we need it most." Signed-off-by: Slava Imeshev <imeshev@yahoo.com>
… returns a new list and the result is discarded, so the error is never added. A blank @agent(description = "") produces no warning at all: validationErrors() comes back empty and the agent registers silently." Signed-off-by: Slava Imeshev <imeshev@yahoo.com>
|
|
@simeshev - Slava, could you please tag the addressed comments as "Resolved"? Thank you |
igordayen
left a comment
There was a problem hiding this comment.
Changing behavior on failing validation requires re-validation itself:)
| agenticInfo.agentName(), | ||
| validationResult.errors.joinToString("\n"), | ||
| ) | ||
| return null |
There was a problem hiding this comment.
Changes current behavior...
There was a problem hiding this comment.
@igordayen Is it Ok if I create a separate ticket for failing validation. IMO, the API doc of DefaultAgentStructureValidator clearly states that invalid agents should not be used in the system. Therefore, we should just fail it. But I agree that behavior change should not be part of this PR but it's own.
Reports detailed validation errors for structural issues, helping ensure that only well-formed agents are registered or used in the system.
There was a problem hiding this comment.
@deleSerna - should be fine, post-release 1.0.0. The current PR then needs to change logging statements accordingly and also elaborate on changes in Retry. thanks
igordayen
left a comment
There was a problem hiding this comment.
The second commit had to change RetryTestInput? →
RetryTestInput (nullable → non-nullable) because nullable action params cause GOAP path validation to return
NO_PATH_TO_GOAL. That means any existing agent with intentionally nullable params will now silently not register after
this PR.
| @AchievesGoal(description = "Process the input") | ||
| @Action(actionRetryPolicyExpression = "\${retry-twice}") | ||
| fun firstAction(input: RetryTestInput?): RetryTestOutput { | ||
| fun firstAction(input: RetryTestInput): RetryTestOutput { |
There was a problem hiding this comment.
What prompted this change?



No description provided.