Skip to content

feat: native session/message/part IDs + Console rehydration#812

Draft
jorgeraad wants to merge 4 commits into
canaryfrom
feat/native-execution-ids
Draft

feat: native session/message/part IDs + Console rehydration#812
jorgeraad wants to merge 4 commits into
canaryfrom
feat/native-execution-ids

Conversation

@jorgeraad
Copy link
Copy Markdown
Collaborator

Makes session/message/part identity native and consistent end-to-end.

  • Prefixed-ULID IDs (`ses_`/`msg_`/`prt_`): subagent on-disk dirs keyed by child session id; bus events carry `sessionId`/`messageId`/`partId`; open-message + open-tool-part tracking in the agent loop.
  • `Session.rehydrateFromConsole(sessionId, fetchTree)` — re-materializes on-disk session state (messages/subagents) from injected rows on resume; orphan tool-call repair via `normalizeMessages`.
  • Per-step billing context: usage callback now carries `{ sessionId, stepSeq }` (ALS step counter).

`tsc --noEmit` clean; full vitest suite green (1024 passing).

jorgeraad added 4 commits June 2, 2026 21:14
Mint a native ses_ session id for each coding subagent (mirroring
spawnPentestAgent) and carry sessionId/parentSessionId on subagent-spawn
and subagent-complete events, so coding-agent subagents persist as
first-class child sessions under the execution data model instead of
relying on slot-label remaps in the Console translator.
…tream end

Apply PR #779 (pensarai/apex) onto feat/native-execution-ids. When consume()'s
stream ends with tool calls still in flight — abort, idle-timeout, or a
tool-result dropped across a mid-stream resume — emit a synthetic error-text
tool-result for each so no tool-call is left without a matching result, and
append the reconstructed step to messages.json for resume correctness.

Applied via 3-way merge against the branch's native-execution-id consume()
(StreamIdContext / per-step message+part id minting): the in-flight tracking +
synthetic emission are folded into the existing chunk switch, and the synthetic
tool-result carries this agent's canonical sessionId (busSessionId) so the
execution translator routes it to this subagent's session, not the root.

Fixes the stuck "response" tool spinner (a completed session left a running
tool part because its tool-result was lost on resume). tsc + biome + 22 tests green.
@jorgeraad jorgeraad force-pushed the feat/native-execution-ids branch from 17a4bab to bc3e3b1 Compare June 3, 2026 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant