Restrict chat_sessions to server-owned sessions
chat_sessions now brokers GET /api/session but filters the global list to the sessions this server recorded in run_steps, deduped by session id, and fails closed to an empty list when no ownership source is configured. A session another client holds (in-server claim, released on stream end or disconnect) or an active run is marked busy; a second client's chat_prompt for a held session is rejected before any OpenCode call. chat_create stays unbrokered.
This commit is contained in:
@@ -21,6 +21,7 @@ func chatSamples() []struct {
|
||||
ID: "ses_1", Title: "demo", Agent: "build", Model: "deepseek-v4.1-flash",
|
||||
Directory: "/work", ParentID: "ses_0", CreatedAt: 1792112366711, UpdatedAt: 1792112367999,
|
||||
}},
|
||||
{"session_busy", ChatSession{ID: "ses_2", Title: "held", Busy: true}},
|
||||
{"create", ChatCreateRequest{Title: "demo", Directory: "/work"}},
|
||||
{"query", ChatQuery{SessionID: "ses_1", Limit: 50}},
|
||||
{"prompt", ChatPromptRequest{SessionID: "ses_1", Text: "hello", Model: "m", Agent: "build", Files: []string{"file:///tmp/a.png"}}},
|
||||
|
||||
Reference in New Issue
Block a user