Skip to content

Commit 6bd5ce3

Browse files
committed
fix: session_search nil store panic — graceful error instead of crash
The sessionSearchTool is created with a nil store when builtinTools is called without --session (odek run, subagent). Any invocation of the session_search tool panics with nil pointer dereference. Fix: add an early nil-check in Call() that returns a clear error message: "session store is not available (use --session to enable session persistence)" instead of panicking and being caught by the defer/recover. This was discovered when the agent tried to use session_search to look up past audit findings.
1 parent c350740 commit 6bd5ce3

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

cmd/odek/session_search_tool.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ func (t *sessionSearchTool) Call(argsJSON string) (result string, err error) {
8787
}
8888
}()
8989

90+
// Guard: store must be initialized (nil when --session is not used).
91+
if t.store == nil {
92+
return jsonError("session store is not available (use --session to enable session persistence)")
93+
}
94+
9095
var args sessionSearchArgs
9196
if err := json.Unmarshal([]byte(argsJSON), &args); err != nil {
9297
return jsonError("invalid arguments: " + err.Error())

0 commit comments

Comments
 (0)