sessions: require workdir on new session creation

No sensible default exists server-side. Clients must pass workdir=<path>
explicitly. The TUI uses $PWD of the ollie process; shell users should
pass workdir=$PWD or use a wrapper.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-04-11 16:43:18 +02:00
parent 088c43e4aa
commit db7a1aa42d
1 changed files with 6 additions and 2 deletions

View File

@ -793,8 +793,8 @@ func (s *Server) handleRootCtl(input string) {
}
// createSession parses key=value options and starts a new agent session.
// Recognised keys: backend, model, agent, workdir. Unknown keys are rejected.
// Example: new backend=ollama model=qwen3:8b agent=myagent workdir=/home/lkn/src/myproject
// Recognised keys: backend, model, agent, workdir. workdir is required.
// Example: new workdir=/home/lkn/src/myproject backend=ollama model=qwen3:8b agent=myagent
func (s *Server) createSession(args []string) error {
backendOverride := ""
modelOverride := ""
@ -820,6 +820,10 @@ func (s *Server) createSession(args []string) error {
}
}
if workdir == "" {
return fmt.Errorf("workdir is required (e.g. new workdir=/path/to/project)")
}
var (
be backend.Backend
err error