Skip to content

feat: restore and recover agent-local ACP sessions - #30857

Merged
hugodutka merged 1 commit into
hugodutka/acp-session-watchfrom
hugodutka/acp-session-recovery
Oct 26, 2026
Merged

hugodutka merged 1 commit into
hugodutka/acp-session-watchfrom
hugodutka/acp-session-recovery

Conversation

@hugodutka

@hugodutka hugodutka commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Restore missing or failed agent-local ACP sessions using load or resume, preferring load to replay the latest turn's history. Share concurrent recovery attempts and preserve failed transcripts without automatically retrying messages.

Depends on #30903.

Generated with Codex, carefully reviewed by Hugo.

@hugodutka
hugodutka added this pull request to stack #30859 October 15, 2026 16:13
@hugodutka
hugodutka force-pushed the hugodutka/acp-session-recovery branch from c1cc5b0 to 553d69c Compare October 15, 2026 17:31
@hugodutka
hugodutka force-pushed the hugodutka/acp-session-recovery branch from 553d69c to 2788039 Compare October 16, 2026 15:19
@hugodutka
hugodutka removed this pull request from stack #30859 October 16, 2026 15:20
@hugodutka
hugodutka changed the base branch from hugodutka/acp-session-runtime-tests to hugodutka/acp-session-watch October 16, 2026 15:21
@hugodutka
hugodutka added this pull request to stack #30904 October 16, 2026 15:21
@hugodutka
hugodutka force-pushed the hugodutka/acp-session-recovery branch from 2788039 to 0004e7b Compare October 16, 2026 16:51
@hugodutka
hugodutka force-pushed the hugodutka/acp-session-recovery branch 2 times, most recently from e8b05b1 to a861b12 Compare October 19, 2026 12:06
@hugodutka
hugodutka force-pushed the hugodutka/acp-session-recovery branch from a861b12 to 755599c Compare October 19, 2026 12:58
@hugodutka
hugodutka removed this pull request from stack #30904 October 19, 2026 14:05
@hugodutka
hugodutka added this pull request to stack #31024 October 19, 2026 14:05
@hugodutka
hugodutka force-pushed the hugodutka/acp-session-recovery branch from 755599c to 14631da Compare October 20, 2026 15:23
@hugodutka
hugodutka force-pushed the hugodutka/acp-session-recovery branch 2 times, most recently from 4e1c3fe to aff2a66 Compare October 20, 2026 17:25
@hugodutka
hugodutka force-pushed the hugodutka/acp-session-recovery branch from aff2a66 to 8971ab5 Compare October 20, 2026 17:51
@hugodutka
hugodutka removed this pull request from stack #31024 October 20, 2026 17:52
@hugodutka
hugodutka force-pushed the hugodutka/acp-session-recovery branch 2 times, most recently from eeece49 to 16e9a22 Compare October 20, 2026 18:35
@hugodutka
hugodutka force-pushed the hugodutka/acp-session-recovery branch from 447152f to 20ebca1 Compare October 21, 2026 13:20
@hugodutka
hugodutka force-pushed the hugodutka/acp-session-recovery branch from 20ebca1 to e2cc39f Compare October 21, 2026 13:36
@hugodutka
hugodutka force-pushed the hugodutka/acp-session-recovery branch 2 times, most recently from 12ca7ea to a5b2e3e Compare October 21, 2026 14:19
@hugodutka
hugodutka force-pushed the hugodutka/acp-session-recovery branch 2 times, most recently from 4c7177b to 4c7c646 Compare October 21, 2026 16:12
@hugodutka
hugodutka added this pull request to stack #31131 October 21, 2026 16:34
@hugodutka
hugodutka marked this pull request as ready for review October 21, 2026 16:36
@hugodutka
hugodutka force-pushed the hugodutka/acp-session-recovery branch from 4c7c646 to cd88e18 Compare October 21, 2026 16:56
@mafredri
mafredri self-requested a review October 22, 2026 09:44
Comment thread agent/x/agentacp/manager_sessions.go Outdated
return nil, err
}
if s != nil {
s.Close()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method already mutates s in e.g. s.proc.close(), but an init error above abandons it without calling s.Close.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's intentional. A session that failed won't access s.proc again, so it's safe to close. But if we fail to initialize a new session in its place then we want to retain the old session so it's still available for inspection.

It'd be clearer if we closed the process the moment it enters the Error state, so I did that now.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more thing: I'm going to rename s to oldSession

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@hugodutka
hugodutka force-pushed the hugodutka/acp-session-recovery branch from cd88e18 to 275aa34 Compare October 22, 2026 20:30
@hugodutka
hugodutka force-pushed the hugodutka/acp-session-recovery branch 2 times, most recently from 019b858 to f792afc Compare October 23, 2026 11:17
@hugodutka
hugodutka force-pushed the hugodutka/acp-session-recovery branch from f792afc to 4cae40c Compare October 23, 2026 11:34
Restore absent native sessions with load or resume, preferring load for
history replay. Collect replayed notifications before attachment, import
initial history through the session, and publish the initialized runtime
only after the handoff. Derive history completeness from the operation.

Share concurrent recovery attempts, preserve failed transcripts, and retry
messages only when callers resubmit them. Include restoration, recovery,
and callback handoff tests alongside these behaviors.
@hugodutka
hugodutka force-pushed the hugodutka/acp-session-recovery branch from 4cae40c to 481f38c Compare October 26, 2026 16:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants