Commands like /compact arriving via ctl and prompts arriving via prompt both call Core.Submit in separate goroutines. handleCommand for mutating commands (compact, clear, agent, backend) modifies session state without setting currentAction, so IsRunning() returns false and a concurrent executeTurn can race. Add submitMu held during the serialized path of Submit. The fast path (inject/FIFO push while running) remains lock-free. Also fix pre-existing race in TestSessionFileStoreWritePrompt: replace time.Sleep synchronization with a channel signal. |
||
|---|---|---|
| .. | ||
| commands.go | ||
| core.go | ||
| core_test.go | ||
| fifo_test.go | ||
| hooks.go | ||
| loop.go | ||
| prompt_resolver.go | ||
| session.go | ||
| state.go | ||
| types.go | ||
| waitchange_test.go | ||