Repository navigation
feat: add ACP session runtime and transcripts - #30835
Conversation
184e24c to
0c2622c
Compare
0c2622c to
7f87146
Compare
7f87146 to
91eda3a
Compare
998ba37 to
96d1b2e
Compare
7f5886e to
e2dc8a6
Compare
7fdd5d7 to
c9df05b
Compare
4eb4426 to
5a06a9d
Compare
d062169 to
6ca2e11
Compare
6ca2e11 to
16838d9
Compare
4c592d3 to
35d1c89
Compare
35d1c89 to
881d061
Compare
| HarnessDisplayName: cfg.displayName, | ||
| Status: workspacesdk.ACPSessionStatusInitializing, | ||
| Cursor: workspacesdk.ACPCursor{ | ||
| Epoch: uuid.New(), |
There was a problem hiding this comment.
Is this official ACP spec? Feels weird to have an epoch with UUID.
There was a problem hiding this comment.
No, this is for our own use. We need ids for turns that are unique even across workspace agent restarts.
There was a problem hiding this comment.
How about GenerationID instead of Epoch? I feel like epoch carries the wrong connotation.
| } | ||
|
|
||
| func (s *SessionFSM) updateStatusLocked(operation sessionOperation) error { | ||
| target, ok := sessionTransitions[s.info.Status][operation] |
There was a problem hiding this comment.
If we enter error state (s.info.Status), the map above has no recovery path. So any consecutive Message would return !ok here? Oversight or intentional? Don't harnesses produce recoverable error states too? I don't know what classifies, but e.g. "over limit" or "model overloaded" are both recoverable states. Don't know if they'd produce error though.
There was a problem hiding this comment.
Intentional. A later PR introduces recovery.
| // replaces permissionCtx, allowing an interrupted turn's request. The SDK | ||
| // dispatches callbacks asynchronously without turn identity, so capturing the | ||
| // context before locking cannot reliably bind it to the original turn. | ||
| // We'd need a change in the SDK to resolve this. |
There was a problem hiding this comment.
Sounds like this TODO shouldn't be deferred?
There was a problem hiding this comment.
I don't think deferring this is a problem. We approve all requests automatically. The ACP spec says that if a turn gets interrupted then we must send a "cancelled" response instead of "approved" for the requests sent during that turn. So the problem here is that we now have a small race condition: if you interrupt a turn, then right away start a new turn, and then get a late permission request, we'll send "approved" instead of "cancelled". I don't know what the consequences of doing that would be, but I don't think it's worth handling right now. The race window is really hard to hit.
There was a problem hiding this comment.
Sounds reasonable to defer, thanks for creating the ticket. This behavior and our SDK piqued my curiosity so I dug into it a bit with my agent and had it write comments on these tickets with a suggestion for a slightly adjusted approach.
| var message struct { | ||
| Method string `json:"method"` | ||
| } | ||
| if json.Unmarshal(raw, &message) == nil && message.Method != "" { |
There was a problem hiding this comment.
Since the timer is still running, we may end up closing after a successful write while doing this post-processing.
cb403d2 to
7082100
Compare
7082100 to
d4e261a
Compare
mafredri
left a comment
There was a problem hiding this comment.
Pre-approving for when the 3 remaining issues are fixed.
Create dedicated harness sessions and keep their operations, status, and transcripts in a session runtime. Attach callbacks during initialization, retain ordered output, support cancellation and event watching, and close manager-owned processes on shutdown. Unknown sessions return not found. Runtime and lifecycle tests follow in the next change. Restoration and agent API transport are separate changes.
d4e261a to
07fdbd3
Compare
Create and run agent-local ACP sessions with configurable harnesses, prompt submission, interruption, and ordered transcripts. Track session status and failures, scope permission grants to running turns, and stop session processes when the manager shuts down.
Tests are in the next PR in the stack.
Depends on #31128.
Generated with Codex, carefully reviewed by Hugo.