Skip to content

refactor(pi): type action ids with Pi's branded id types - #343

Merged
eersnington merged 1 commit into
chore/sandbox-env-optionsfrom
chore/pi-branded-ids
Oct 8, 2026
Merged

eersnington merged 1 commit into
chore/sandbox-env-optionsfrom
chore/pi-branded-ids

Conversation

@eersnington

@eersnington eersnington commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Pi's ids are numbers with a compile-time brand (Id<"conversation">, Id<"submission">, ...). Our actions already returned branded ids, but took number and cast it back 13 times. A client could pass a SubmissionId where a ConversationId belongs and still compile.

-abortSubmission: (c, id: number, conversationId?: number) =>
-	harness.abortSubmission(id as SubmissionId, context, conversationId as ConversationId | undefined)
+abortSubmission: (c, id: SubmissionId, conversationId?: ConversationId) =>
+	harness.abortSubmission(id, context, conversationId)
  • Every action takes ConversationId, SubmissionId, TaskId, or EntryId, and every id cast is gone, also in requireConversation, requireSubmission, and requireTask.
  • PiPromptOptions.conversationId, the stored WatchSpec, and the pi.events, pi.view, and pi.doc frames carry a ConversationId.
  • Nothing changes on the wire. Clients pass back the ids they get from responses; a literal number needs ROOT_CONVERSATION_ID or an id from a response.

This is part 6 of 9 in a stack:

@eersnington
eersnington force-pushed the chore/pi-branded-ids branch from 217f68a to 58e87d5 Compare October 8, 2026 15:40
@eersnington
eersnington added this pull request to stack #347 October 8, 2026 16:05
@eersnington
eersnington merged commit 10762dc into main Oct 8, 2026
0 of 6 checks passed
@eersnington
eersnington deleted the chore/pi-branded-ids branch October 8, 2026 16:08
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