Repository navigation
feat(platform): draft replies on conversations, and add the Jev decisions connector - #3425
Merged
Merged
Conversation
Jev is a decisions model, not a chat one. It takes a piece of state and named questions, and returns typed answers carrying their probability distribution — a choice from a fixed set, a score against ordered levels, or the probability a yes/no statement is true. It cannot go in a `model:` field. The openrouter provider is pinned to apiFormat openai on /api/v1, while decisions answer at /api/alpha/decisions with their own body shape; posting a decisions model to chat/completions answers 400 and says so. A connector is the way a workflow reaches it. A decision returns no text and cannot draft, so it pairs with an llm node rather than replacing one. What it adds is a number: a workflow can gate an action on confidence instead of on a sentence. Input tokens are billed and output tokens are free, so it costs a fraction of the chat call it takes the decision away from.
Israeltheminer
force-pushed
the
feat/conversation-drafts-and-jev
branch
from
September 19, 2026 20:10
0414233 to
44903b2
Compare
An agent-drafted reply is an approval on the conversation — resource_type of conversations, resource_id the conversation id. Both halves around it were already built: loadPendingApprovals joins the newest pending row onto the list and the panel renders metadata.emailBody as a pending message, and sendMessageViaConnectorInTx completes that row when a human sends. Only the producer was missing, so nothing outside the integration check ever minted one. It writes no message. A draft is a proposal, so nothing reaches a customer until a person sends it — and for a mirrored conversation that human send is also what puts the reply on the API delivery queue. Migration 0108 carries a partial unique index for pending conversation rows, the same contract the connector gate already has. Two runs racing one inbound message would otherwise each mint a card, and the panel shows the newest while a send completes the oldest it finds — marking a draft the reader never saw as the one they sent. The loser now reads the winner's card back instead. No backfill: rows of this type were never minted in production, so there are no duplicates to supersede.
The producer is only reachable from a workflow once it is an action, so conversation.draft_reply joins the connector on the native backend beside the mailbox actions, with the store method and rim binding it needs. Its effects are write even though nothing leaves the building: a draft changes what a person sees in the Inbox, and the approvals gate should be able to hold it like any other write. The shipped-catalog, dispatcher and registry counts are pinned so that losing a connector fails loudly; they move with the two new actions. CONV-F12 covers the behaviour a person actually sees — the pending message in the reading pane, the send that resolves it, and the second draft that must not produce a twin.
Israeltheminer
force-pushed
the
feat/conversation-drafts-and-jev
branch
from
September 19, 2026 20:17
44903b2 to
a6e181d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two capabilities that work together: a model that decides whether to act, and a way for what it decides to reach a person.
The conversation draft producer
An agent-drafted reply is an approval on the conversation —
resource_typeofconversations,resource_idthe conversation id. Both halves around it were already built:loadPendingApprovals(domains/conversations/service.ts:451) joins the newest pending row onto the list, andconversation-panel.tsxrenders itsmetadata.emailBodyas a pending message.sendMessageViaConnectorInTx(send.ts:352) completes that row when a human sends, stampingsentContent/sentTo/sentAt.Only the producer was missing.
'conversations'is a declaredApprovalResourceTypeand the app contract carries it, but the soleINSERTwith that type lived in the integration check. This adds the writer those two were written against.It writes no message. A draft is a proposal, so nothing reaches a customer until a person sends it — and for a mirrored conversation, that human send is also what puts the reply on the API delivery queue.
Migration 0108
A partial unique index for pending conversation rows, the same contract
0074already gives connector operations. Without it, two runs racing one inbound message each mint a card; the panel shows the newest while a send completes the oldest it finds, marking a draft the reader never saw as the one they sent. The loser now reads the winner's card back (created: false) instead.No backfill — rows of this type were never minted in production, so there are no duplicates to supersede. If a deployment acquired some by hand the index creation fails loudly rather than choosing a survivor on its own.
The Jev connector
Jev takes a piece of state and named questions and returns typed answers carrying their probability distribution — a choice from a fixed set, a score against ordered levels, or the probability a yes/no statement is true.
It cannot go in a
model:field: theopenrouterprovider is pinned toapiFormat: openaion/api/v1, while decisions answer at their own path with their own body shape, and posting a decisions model to chat/completions answers 400 and says so. A connector is how a workflow reaches it.It returns no text and cannot draft, so it pairs with an
llmnode rather than replacing one. What it adds is a number — a workflow can gate an action on confidence rather than on a sentence. Input tokens are billed and output tokens are free, so it costs a fraction of the chat call it takes the decision away from.Proof
bun run --filter @tale/platform backend:integrationagainst throwaway Postgres + MinIO. The send-lane probe now drives the real producer instead of hand-inserting the approval, and asserts the new rule:First draft created; the racing second returns the winner's card; exactly one pending row survives; the human send still completes it.
A caveat on the full run. The suite truncates at lane 95 (
checkConversationApi,201 !== 403) before reaching this lane. I verified that against a stashed clean tree: same lane, same assertion, same 454/462 tally — pre-existing, unrelated to this branch. To reach lane 96 I temporarily swallowed that throw locally (not committed), which let all 150 lanes run: 676/682 checks passed, and every one of the 6 failures also appears in the clean-tree baseline (object-store seeding, robots crawler ×2, video/whisper ×3 — this host has no ffmpeg).That
checkConversationApifailure is worth someone's attention on its own; it is blocking 55 lanes from ever running in CI or locally.Also
conversation.draft_replyis awriteeffect even though nothing leaves the building — a draft changes what a person sees, and the approvals gate should be able to hold it like any other write.CONV-F12covers what a person actually sees: the pending message in the reading pane, the send that resolves it, and the second draft that must not produce a twin.bun run lint:manual,lint:sast(0 findings),oxfmt,tscand 8,785 server tests all green.🤖 Generated with Claude Code