Context
This is low priority for the intended single-user, sequential workflow, but the session protocol currently breaks under parallel callers or a stop/restart during a long command.
Reproduced behavior
bash test_wait_issues.sh reproduced:
- T7: simultaneous
run calls race on shared cmd.py.tmp; one command can be lost or misdelivered.
- T8:
stop returns while a long exec() is still running, removes the PID file, and a subsequent start can launch a second daemon for the same session.
- T10: concurrent
start calls can launch two daemons.
Expected
A session has exactly one live daemon and accepts at most one command at a time. stop must not report success or release the session while the original daemon remains alive.
Suggested direction
Use a per-session owner lock and readiness marker; atomically claim the idle state before publishing a uniquely named request; preserve the PID file until termination is confirmed, or expose an explicit forced-stop behavior.
Context
This is low priority for the intended single-user, sequential workflow, but the session protocol currently breaks under parallel callers or a stop/restart during a long command.
Reproduced behavior
bash test_wait_issues.shreproduced:runcalls race on sharedcmd.py.tmp; one command can be lost or misdelivered.stopreturns while a longexec()is still running, removes the PID file, and a subsequentstartcan launch a second daemon for the same session.startcalls can launch two daemons.Expected
A session has exactly one live daemon and accepts at most one command at a time.
stopmust not report success or release the session while the original daemon remains alive.Suggested direction
Use a per-session owner lock and readiness marker; atomically claim the idle state before publishing a uniquely named request; preserve the PID file until termination is confirmed, or expose an explicit forced-stop behavior.