refactor: brand the request id - #675
jakedipity wants to merge 2 commits into
Conversation
Greptile SummaryThe PR replaces bare request-ID strings with a dedicated
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| crates/aura/src/config.rs | Defines the branded request identifier and its transparent string representation. |
| crates/aura/src/mcp/client.rs | Separates Aura request identifiers from rmcp protocol request identifiers in MCP operations. |
| crates/aura/src/request_cancellation.rs | Migrates cancellation-registry keys and APIs from strings to RequestId. |
| crates/aura/src/tool_event_broker.rs | Migrates request-scoped tool-event broker keys and calls to the branded identifier. |
| crates/aura/src/session_store/record.rs | Stores RequestId directly and pins its enduring bare-string JSON contract with a focused test. |
| crates/aura-web-server/src/streaming/handlers.rs | Threads the branded request identifier through the web server’s streaming request lifecycle. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
HTTP[HTTP / A2A request] --> RID[RequestId newtype]
RID --> STREAM[Streaming and SSE routing]
RID --> HITL[HITL approval gates]
RID --> BROKERS[Progress and tool-event brokers]
RID --> CANCEL[Request and MCP cancellation]
RID --> STORE[Session and approval storage]
RID --> SCRATCH[Per-request scratchpad]
STORE -->|serde transparent| JSON[Bare-string persisted shape]
Reviews (4): Last reviewed commit: "refactor: brand the request id" | Re-trigger Greptile
14cb706 to
0de55be
Compare
d7cdb5a to
7d9cf2a
Compare
0a897b9 to
d3df8a6
Compare
7d9cf2a to
4827e82
Compare
Adds aura_events::agent, the event vocabulary a running agent emits, and aura::agent_events, which republishes it onto the request-scoped brokers so consumers are unaffected. A differential test asserts both paths produce identical SSE. The schema is typed with domain value types rather than bare primitives: ToolCallId, ToolName, TokenCount, TokenUsage, and Progress. The tool_event_broker's ToolCallId/ToolName aliases resolve to the newtypes, so publish_tool_requested and publish_tool_start no longer take interchangeable strings positionally, publish_tool_usage takes one TokenUsage instead of three bare u64s, and ProgressNotification carries the current/total pair as a single value that owns percent(). Scratchpad token counts move from usize to u64 with every other count. No producer emits the schema yet; agent_events_enabled reads AURA_AGENT_EVENTS and is the seam producers will gate on. Ref: #618 Signed-off-by: Jacob Hull <jacob@planethull.com>
d3df8a6 to
daccaa7
Compare
RequestId becomes a newtype over String instead of a type alias, so a bare string can no longer stand in for a request id. It threads through SSE routing, the tool-event broker, MCP cancellation, HITL approval gates, the session store, and the scratchpad's per-request directory. The brokers and the cancellation registry key their maps by RequestId rather than String. In mcp/client.rs, rmcp's own RequestId is imported as McpRequestId, so the HTTP request id and the MCP protocol request id are no longer the same type in signatures that take both. The webhook payload and stored approval records keep their bare-string shape, which serde(transparent) guarantees and a record test now pins. Signed-off-by: Jacob Hull <jacob@planethull.com>
4827e82 to
b78a932
Compare
daccaa7 to
55faa90
Compare
Shearerbeard
left a comment
There was a problem hiding this comment.
My only feedback here is that lib.rs is to general - if were starting to consolidate code around building our domain types and events lets just call it domain
Shearerbeard
left a comment
There was a problem hiding this comment.
This looks good - as we progress we might have to better module classify identifiers a cross application concerns (like RequestId) vs agent specific new types like AgentId. There are probably a few cross cutting concerns to belong in a root domain vs a specific one. Also a good place to start looking for duplicated construction and validation code if it exists (I don't see that here - just the kind of thing I like to think ahead on when designing by types)
30b2685 to
8c3a670
Compare
The base branch was changed.
RequestId becomes a newtype over String instead of a type alias, so a bare string can no longer stand in for a request id. It threads through SSE routing, the tool-event broker, MCP cancellation, HITL approval gates, the session store, and the scratchpad's per-request directory.
The brokers and the cancellation registry key their maps by RequestId rather than String. In mcp/client.rs, rmcp's own RequestId is imported as McpRequestId, so the HTTP request id and the MCP protocol request id are no longer the same type in signatures that take both.
The webhook payload and stored approval records keep their bare-string shape, which serde(transparent) guarantees and a record test now pins.