What happened?
If you run pi --session-id <id> and no session with that id exists, pi quietly creates a new session with that id. No error, no warning. In --mode rpc there is also nothing in the protocol that tells you "this is not your old chat, this is a fresh one".
The other flags don't do this. --session and --fork print No session found matching '<arg>' and exit. Only --session-id falls through: createSessionManager looks up the id, doesn't find it, and lands on the SessionManager.create(cwd, sessionDir, { id: parsed.sessionId }) at the end (packages/coding-agent/src/main.ts, main @ 351efc8).
Why it matters to us: we drive pi --mode rpc from another program. It saves the session id and reuses it after restarts. If the session file is gone (cleanup, volume swap), pi silently starts fresh, and the agent answers as if the past conversations never happened. We catch it today by calling get_state after start and checking for messageCount === 0 — an extra round-trip, and it still can't tell "old chat lost" from "new chat on purpose".
Steps to reproduce
pi --session-id 00000000-aaaa-bbbb-cccc-000000000000 -p "what did we discuss?"
# → new session created under that id, no warning, answer with no memory
Also with -ne.
Expected behavior
Creating a session with an id you picked is a real feature (#6070 asked for it), so an error is probably wrong. We just need a way to know. Any of these would do:
- print a warning when the id wasn't found and a new session was created;
- a flag that says "the session must already exist" (fail like
--session does);
- a "this session is new" marker in the session header / RPC state.
We would use option 2, but any of the three makes the failure visible. Happy to implement the one you pick.
Version
0.80.3
What happened?
If you run
pi --session-id <id>and no session with that id exists, pi quietly creates a new session with that id. No error, no warning. In--mode rpcthere is also nothing in the protocol that tells you "this is not your old chat, this is a fresh one".The other flags don't do this.
--sessionand--forkprintNo session found matching '<arg>'and exit. Only--session-idfalls through:createSessionManagerlooks up the id, doesn't find it, and lands on theSessionManager.create(cwd, sessionDir, { id: parsed.sessionId })at the end (packages/coding-agent/src/main.ts, main @351efc8).Why it matters to us: we drive
pi --mode rpcfrom another program. It saves the session id and reuses it after restarts. If the session file is gone (cleanup, volume swap), pi silently starts fresh, and the agent answers as if the past conversations never happened. We catch it today by callingget_stateafter start and checking formessageCount === 0— an extra round-trip, and it still can't tell "old chat lost" from "new chat on purpose".Steps to reproduce
Also with
-ne.Expected behavior
Creating a session with an id you picked is a real feature (#6070 asked for it), so an error is probably wrong. We just need a way to know. Any of these would do:
--sessiondoes);We would use option 2, but any of the three makes the failure visible. Happy to implement the one you pick.
Version
0.80.3