cli: `agentcube invoke` keeps sending an expired session ID and never recovers

Open Beginner friendly
#533 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
cli

Research direction

Start with cmd/cli/agentcube/runtime/invoke_runtime.py, especially the saved-session logic around lines 99-102 and 198-203. Find the existing invoke runtime unit tests and follow the established SDK behavior from #460. Done means a 404 SESSION_NOT_FOUND clears the stale session_id, retries once without the session header, and is covered by unit tests.

Written by the indexing model from the issue text.

Description

kind/bug

What happened:

After the first agentcube invoke, the CLI saves the session ID to agent_metadata.yaml and sends it on every later invoke. Once that session expires (15 min idle by default) and GC removes it, the router returns 404 SESSION_NOT_FOUND. The CLI doesn't clear the saved ID, so every later invoke from that workspace fails the same way:

Error invoking agent: Failed to invoke agent hello-agent: Agent returned error 404:
{"error": "sessions.agentcube.volcano.sh \"<id>\" not found", "code": "SESSION_NOT_FOUND"}

The only ways out are re-running agentcube publish (which happens to clear session_id) or editing the YAML by hand.

What you expected to happen:

On SESSION_NOT_FOUND, the CLI should drop the stale ID and start a new session, or at least clear it and tell the user. The Python SDK already does this since #460, but the CLI wasn't updated.

How to reproduce it (as minimally and precisely as possible):

  1. agentcube publish an agent, then run agentcube invoke. It works and session_id gets written to agent_metadata.yaml.
  2. Wait for the session to be garbage-collected (idle timeout, 15 min by default).
  3. Run agentcube invoke again. You get 404 SESSION_NOT_FOUND.
  4. Run it again. You get the same error, because session_id is still in the file.

Relevant code: cmd/cli/agentcube/runtime/invoke_runtime.py. Lines 99-102 always send the saved ID, and lines 198-203 only update it after a successful response.

Anything else we need to know?:

I'm happy to send a PR. The idea is to catch 404 + SESSION_NOT_FOUND, clear session_id, and retry once without the header, plus unit tests. A --new-session flag on invoke could also be useful.

Environment:

  • agentcube version: main @ 54e30e4
  • Kubernetes version: N/A (client-side bug in the CLI)
  • Others: Python 3.12. Running the CLI from source because the packaged version is missing agentcube.models (#325).
Dominant language
Go
Stars
176
Forks
95
Avg merge
5d 18h
Merged PRs (30d)
9

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from volcano-sh/agentcube

All issues in volcano-sh/agentcube

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.