Skip to content

ref(conversations)!: Make events the canonical transcript#916

Open
dcramer wants to merge 55 commits into
mainfrom
ref/conversation-event-pi-adapter
Open

ref(conversations)!: Make events the canonical transcript#916
dcramer wants to merge 55 commits into
mainfrom
ref/conversation-event-pi-adapter

Conversation

@dcramer

@dcramer dcramer commented Jul 15, 2026

Copy link
Copy Markdown
Member

Conversation history now has one ordered SQL ConversationEvent log as its sole authority. The Pi adapter reconstructs model context from those events, the API exposes a privacy-safe semantic projection, and the dashboard owns the event-to-view reduction. Visible messages, failures, compaction, handoffs, and child lifecycle share the stream; raw Pi payloads, tool-call IDs, and private runtime metadata stay internal. Correlated handoff and advisor events replace their generic tool row instead of rendering twice.

This is an intentional hard cutover. Runtime Redis/session-log history readers and the old transcript, activity, and special-subagent API shapes are removed. The conversation message table remains a rebuildable search and hydration projection, not another history source. Child conversations keep their own event histories with immutable parent lineage, while privacy and retention follow the root conversation.

Recoverable Slack delivery now keeps only delivery control data and canonical event cursors outside the event log. Model continuity is committed before the delivery intent; accepted replies publish visible facts, full rejection rolls back undelivered model output, and partial multipart rejection records only the accepted prefix while retaining tool and side-effect continuity. Local, Slack, dispatch, continuation, and OAuth resume paths all write first-terminal-wins lifecycle outcomes, so failures remain visible after process or provider errors.

Rollout must block ingress, drain and stop old workers, apply the consolidated schema migration, run the CLI import and visible-event backfill, verify the seal, then deploy and restart. The schema migration rewrites retained SQL Pi rows; the CLI imports external Redis and advisor history before visible events seal each conversation.

For review, start with the migration and event/Pi boundary, then lifecycle and Slack recovery, then the reporting API and dashboard reduction.

@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
junior-docs Ready Ready Preview Jul 17, 2026 4:06pm

Request Review

Comment thread packages/junior-dashboard/src/mock-conversations.ts
Comment thread packages/junior-dashboard/src/mock-conversations.ts
Comment thread packages/junior-dashboard/src/mock-conversations.ts Outdated
Comment thread packages/junior-dashboard/e2e/dashboard.spec.ts
Comment thread packages/junior-dashboard/src/client/eventTranscript.ts Outdated
Comment thread packages/junior-dashboard/src/client/eventTranscript.ts
Comment thread packages/junior-dashboard/src/mock-conversations.ts
dcramer and others added 15 commits July 15, 2026 14:30
Make ConversationEvent the sole application history contract and derive Pi context through an adapter. Rename the SQL table in place, version rows, and rewrite legacy Pi messages through a bounded upgrade migration.

Keep only rollout-scoped database and Redis import compatibility while removing the legacy application store and projection paths.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Move provider-neutral event reduction and runtime-context shaping into the conversations domain. Keep the Pi adapter responsible only for validating projected model messages.

Build reporting transcripts, activity, and child history from canonical events while preserving lazy legacy import, privacy gates, redaction, and the existing API contract.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Persist visible message, metadata, and reply facts in the canonical conversation event log while maintaining the SQL message table as an atomic hydration and search projection.

Add idempotent event keys, shared sequence locking, a bounded zero-gap backfill, and the stopped-worker schema cut that removes the legacy step compatibility view.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Project runtime hydration, reporting, and eval transcripts from canonical visible-message events while retaining safe terminal outcome and trace metadata.

Remove message-table transcript readers and make assistant message identities stable across persistence retries.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Add strict start and first-terminal-wins outcome facts, then wire the local runtime through durable input, delivery, and persistence boundaries.

Surface privacy-safe lifecycle failures in conversation detail, preserve incident correlation, and remove synthetic no-reply transcript messages.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Make the canonical delivery outbox own ordinary Slack reply completion across process crashes and ambiguous provider writes. Recover older deliveries before new input, reconcile exact Slack receipts, and keep terminal transcript facts authoritative when runtime-state repair fails.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Project canonical conversation history into a strict ordered API boundary. Keep visible content singular and omit internal payloads so reporting consumers can adapt one event stream safely.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Make canonical conversation events the only detail and dashboard history authority. Remove transcript and subagent compatibility APIs, inherit child privacy from the locked root, and make retention purge whole trees without append races.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Make SQL events the only live history source for Pi projection and visible hydration. Keep the Redis decoder and backfill writer available only through the explicit operator upgrade path.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Document canonical metadata, non-history aggregates, completed event reporting work, and the bounded migration and delivery follow-ups that remain intentionally open.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Persist the initiating Pi tool call on successful handoff epochs so reporting can later coalesce the generic tool row with the semantic transition. Keep deployed uncorrelated markers readable while requiring correlation for every new write.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Keep Pi continuity in the conversation event log while Slack recovery stores
only event cursors and delivery control state. Record lifecycle failures across
local, dispatch, and resumed turns so reporting cannot silently terminate.

Harden migration reruns and chronology. Correlate special tool rendering
without exposing private IDs, and document the required deployment drain.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
@dcramer dcramer changed the title ref(conversations)!: Make event history the canonical transcript ref(conversations)!: Make events the canonical transcript Jul 16, 2026
Preserve main API and archive changes while moving the conversation event cutover after the new 0004 migration.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Comment thread packages/junior-dashboard/src/client/format.ts
Comment thread packages/junior-dashboard/src/client/format.ts
Comment thread packages/junior-dashboard/src/client/format.ts
Preserve event-backed transcript authority while incorporating destination visibility, system metrics, and the latest dashboard and Slack changes.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Delete the orphaned formatBytes export after transcript size metadata and raw tool-result inspection were removed.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Preserve the canonical transcript cutover while incorporating the latest system dashboard and release metadata changes.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 741e059. Configure here.

Use loaded child conversation status to replace stale running rows while preserving terminal parent invocation failures.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Preserve canonical event and outbox ordering while incorporating completion callbacks for reaction-only Slack turns.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Keep only the durable schema entrypoint, upgrade ordering, generation workflow, and append-only migration rules.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
@dcramer
dcramer marked this pull request as ready for review July 17, 2026 15:21
@github-actions github-actions Bot added the risk: high PR risk score: high label Jul 17, 2026
dcramer and others added 4 commits July 17, 2026 08:49
Use the SQL-backed turn lifecycle across eval runtime, scheduled dispatch, and OAuth callback fixtures. Normalize actual scheduled Slack delivery and omit sendMessage when internal dispatch owns the final post.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Keep the route handler, SQL read, and response projection together now that both helper layers have a single consumer.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Keep the already-applied 0004 snapshot byte-identical to main. The appended 0005 snapshot remains the only migration metadata change.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Co-Authored-By: GPT-5 Codex <noreply@openai.com>

# Conflicts:
#	packages/junior/src/chat/runtime/slack-resume.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant