Release native chat runtimes on lifecycle changes
Ensure /new and chat close stop native foreground and background work before changing registry state. Preserve transcripts while surfacing release and recovery cleanup failures instead of reporting false success, with focused adapter and server regressions.
This commit is contained in:
@@ -44,6 +44,8 @@ type fakeChat struct {
|
||||
promptCalls int
|
||||
promptFiles []opencode.PromptFile
|
||||
interrupts int
|
||||
releases []string
|
||||
releaseErr error
|
||||
replies int
|
||||
replyRequest protocol.ChatReplyRequest
|
||||
replyErr error
|
||||
@@ -209,6 +211,19 @@ func (f *fakeChat) Interrupt(context.Context, string) error {
|
||||
return f.interruptErr
|
||||
}
|
||||
|
||||
func (f *fakeChat) ReleaseSession(_ context.Context, sessionID string) error {
|
||||
f.mu.Lock()
|
||||
defer f.mu.Unlock()
|
||||
f.releases = append(f.releases, sessionID)
|
||||
return f.releaseErr
|
||||
}
|
||||
|
||||
func (f *fakeChat) releaseQuery() ([]string, error) {
|
||||
f.mu.Lock()
|
||||
defer f.mu.Unlock()
|
||||
return append([]string(nil), f.releases...), f.releaseErr
|
||||
}
|
||||
|
||||
func (f *fakeChat) Messages(_ context.Context, sessionID string, limit int, cursor string) (protocol.ChatHistoryPage, error) {
|
||||
f.mu.Lock()
|
||||
defer f.mu.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user