Observe native Claude automations and preserve pending timers

This commit is contained in:
2026-11-08 15:52:22 +00:00
parent 9d3358be47
commit 3fbfb85ace
17 changed files with 757 additions and 34 deletions
+6 -4
View File
@@ -288,7 +288,7 @@ func (c *Chat) reapIdleAt(now time.Time) {
sort.Slice(live, func(i, j int) bool { return live[i].used.Before(live[j].used) })
for _, entry := range live {
entry.s.mu.Lock()
busy := entry.s.running
busy := entry.s.running || entry.s.hasAutomationsLocked()
for _, task := range entry.s.shells {
if task.shell.Status == protocol.ChatShellRunning {
busy = true
@@ -352,8 +352,10 @@ type session struct {
shellTranscriptMtime int64
shellTranscriptTargets map[string]bool
usage *protocol.ChatEventFrame
compaction *protocol.ChatEventFrame
usage *protocol.ChatEventFrame
compaction *protocol.ChatEventFrame
automations *claudehost.AutomationSnapshot
automationProcess *process
// account is the signed-in account the live process reported.
account accountIdentity
prompts []promptRecord
@@ -471,7 +473,7 @@ func (s *session) unsubscribe(ch chan protocol.ChatEventFrame) {
// an explicit operator close remains the hard-close path below.
func (s *session) releaseIdleProcess() {
s.mu.Lock()
if s.running || len(s.subs) > 0 {
if s.running || len(s.subs) > 0 || s.hasAutomationsLocked() {
s.mu.Unlock()
return
}