Repository navigation
Description
Summary
session.PendingAsk (engine/session/session.go:181) carries AskID, Tool,
Args, Reason, and two governance booleans — but not the id of the tool call
the ask gates. A host that pauses on a PendingAsk and needs the gated
tool-call id recovers it today by splitting the AskID string on : and taking
the third field.
Why this is wrong
The verdict-side value object already exposes this. session.ApprovalPayload
carries Call ToolCallID as a first-class field (engine/session/event.go),
and its own doc says the id is "already implicitly encoded inside AskID." The
pause-side value object should be symmetric.
Forcing the host to parse the AskID grammar couples it to a format the engine
treats as partly internal. newAskID (engine/agent/dispatch.go:1122)
documents only the leading <sessionID>: prefix as a consumed contract; the
<n> and :r<serial> components are implementation detail. A host that reads
field 3 breaks silently if the layout ever changes.
Evidence (consumer)
Atrium does exactly this in its engine adapter. gatedToolCallID in
internal/modules/agentloop/app/engine/driver.go runs
strings.Split(ask.AskID, ":")[2] to recover the gated call id
(stacklok/atrium#552).
Proposed change
Add Call ToolCallID to session.PendingAsk, populated where the ask is minted
(dispatch.go, alongside AskID). Additive, non-breaking — a minor bump per
COMPATIBILITY.md.
Implementation notes (verified against current main)
- Mint site (the core change).
engine/agent/dispatch.go:508builds the
PendingAsk. AddCall: c.ID—cis thesession.ToolCallin scope, and
the siblingEvApprovalemit atdispatch.go:551already usesCall: c.ID,
so this just makes the pause side symmetric with the verdict side. - Second surfaced-ask site.
engine/agent/dispatch.go:943builds a
PendingAskfor the surfaced child/subagent ask. PopulateCallthere too
from that scope's gated call id. - Leave the retract sites alone.
engine/agent/childregistry.go:731and
:807buildPendingAsk{AskID: ...}forEvPermissionRetract, which by
contract carries the AskID only. Do not addCallthere. - Snapshot round-trip. The snapshot DTO serialises the whole struct
(engine/adapter/sessnap/sessnap.go:41—Pending *session.PendingAsk,
json:"pending,omitempty").Callis durable correlation data, unlike the
run-scopedConfiguredAsk/FlooredConfiguredAllow, so it should round-trip.
Give it a normal json tag (follow the neighbouring fields), notjson:"-",
and confirm the sessnap round-trip test covers it.
Acceptance
session.PendingAskhas aCall ToolCallIDfield, populated on every pause
on both the main-agent path and the surfaced-child path.- A test asserts the field equals the
ToolCall.IDthe dispatch gated. task api:updateregeneratedengine/api/session.txt(the field appears);
task api:checkpasses.- A CHANGELOG entry lands under
[Unreleased] → Added(additive = minor per
COMPATIBILITY.md).
Context
Surfaced reviewing the engine import (stacklok/atrium#552). The broader question
— that the askID is not reconstructable across processes because of a
process-global serial — is tracked separately in #117 and is out of scope
here. This issue is the small, independently-shippable half: expose the field
the host actually needs so it stops parsing the grammar.
Paired Atrium cleanup that removes the parse once this lands: stacklok/atrium#581.
Activity
JAORMX commentedon Jun 22, 2026
Paired Atrium cleanup that removes the grammar-parse once this lands: stacklok/atrium#581. Design question on cross-process reconstructability: #117.
chore(release): prep engine/v0.1.0 — CHANGELOG stamp