Skip to content

Conversation

@Pnkcaht
Copy link
Contributor

@Pnkcaht Pnkcaht commented Feb 2, 2026

What I did

  • Prevented a panic when elicitation (e.g. user_prompt / OAuth authorization) is triggered during non-interactive cagent exec sessions
  • Added defensive checks for elicitation metadata to avoid unsafe type assertions
  • Gracefully skipped elicitation when user interaction is not possible, resuming the runtime with a declined response
  • Ensured non-interactive executions fail safely instead of crashing

Related issue

Before

  • cagent exec could invoke elicitation tools in non-interactive sessions
  • The CLI assumed cagent/server_url was always present and a valid string
  • Missing or nil metadata caused a panic:
    • interface conversion: interface {} is nil, not string
  • The process crashed instead of exiting cleanly

After

  • Elicitation metadata is validated before use
  • Non-interactive sessions no longer trigger unsafe type assertions
  • Elicitation is safely skipped when user input is not possible
  • cagent exec exits cleanly without panicking

Test

Screenshot Yaml (test)

dgbsbs

Commands

  • go test ./...
  • cagent exec ./agent.yml "it's not working"
  • echo "it's not working" | cagent exec ./agent.yml -

Result

  • Verified no panic occurs when using a YAML config with a non-existent model (model: fake)
  • Verified the command exits gracefully and prints a controlled error message

Screenshot Result (test)

image

…essions

Signed-off-by: pnkcaht <samzoovsk19@gmail.com>
@Pnkcaht Pnkcaht requested a review from a team as a code owner February 2, 2026 20:58
Signed-off-by: pnkcaht <samzoovsk19@gmail.com>
@Pnkcaht Pnkcaht requested a review from krissetto February 3, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

user_prompt panic in noninteractive mode

2 participants