Skip to content
This repository was archived by the owner on Oct 23, 2026. It is now read-only.

fix(conversation): Parse details envelope instead of bare span array - #1365

Merged
jared-outpost[bot] merged 5 commits into
mainfrom
cursor/fix-conversation-view-envelope
Aug 5, 2026
Merged

jared-outpost[bot] merged 5 commits into
mainfrom
cursor/fix-conversation-view-envelope

Conversation

@MathurAditya724

Copy link
Copy Markdown
Member

Summary

sentry conversation view was failing with a Zod validation error after the conversation details API started always returning an envelope object instead of a bare span array (getsentry/sentry#121143).

Problem

Error: Unexpected response format from /organizations/sentry/ai-conversations/<id>/
Expected array, received object

Reproduction: https://sentry.sentry.io/explore/conversations/project_metadata_summary-317e47d

These endpoints are PRIVATE and are not published in @sentry/api / sentry-api-schema, so the CLI owns local Zod schemas for them.

Changes

  • Accept the { conversationId, title, spans } details envelope and extract spans for transcript building
  • Surface title in human/JSON transcript output when present
  • Update API and formatter tests for the new shape (including a regression that rejects the old bare-array response)

Testing

  • Unit tests: conversations API, conversation view command, conversation formatters
  • Manual: pnpm run cli -- conversation view sentry/project_metadata_summary-317e47d (no longer errors); conversation with spans renders title + transcript header

Made with Cursor

MathurAditya724 and others added 4 commits August 5, 2026 12:27
The conversation details API now always returns
`{ conversationId, title, spans }` (getsentry/sentry#121143). The CLI still
validated a bare span array, so `conversation view` failed with
"Expected array, received object".

Co-authored-by: Cursor <[email protected]>
Always put the ID in the transcript heading (and empty-state message),
show title only as a table row, tighten TranscriptResult.title typing,
and surface title in the list table so the schema field is not unused.

Co-authored-by: Cursor <[email protected]>
@MathurAditya724 MathurAditya724 added jared Trigger the Jared agent to work on stuff and removed jared Trigger the Jared agent to work on stuff labels Aug 5, 2026
@MathurAditya724 MathurAditya724 added jared Trigger the Jared agent to work on stuff and removed jared Trigger the Jared agent to work on stuff labels Aug 5, 2026
@MathurAditya724 MathurAditya724 added jared Trigger the Jared agent to work on stuff and removed jared Trigger the Jared agent to work on stuff labels Aug 5, 2026

@jared-outpost jared-outpost Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks solid. envelope schema swap is clean and the title threading through api → formatter → command is consistent.

verified locally on the branch:

  • vitest run on the three conversation suites: 75/75 pass
  • biome check clean on the four touched src files

things i checked and liked:

  • the regression test rejecting the bare-array response (rejects a bare span array) locks in the fix so a schema regression can't silently pass
  • taking title from page 0 only is the right call — later pages carry the same conversation metadata, no need to re-read it
  • keeping the conversation id in the heading while surfacing title as a table row avoids duplication and keeps the id copy-pasteable for re-running conversation view

one minor note, not blocking: AIConversationDetailsSchema uses a bare z.object (strict-ish) while AIConversationSpanSchema is .passthrough(). if the details envelope grows top-level fields later, this'll reject them. probably fine to keep strict for now since you own the schema, but worth a .passthrough() if you expect the envelope to gain metadata.

no changes requested — ready to un-draft once you're happy with manual verification.

@MathurAditya724 MathurAditya724 added jared Trigger the Jared agent to work on stuff and removed jared Trigger the Jared agent to work on stuff labels Aug 5, 2026
@MathurAditya724 MathurAditya724 added the jared Trigger the Jared agent to work on stuff label Aug 5, 2026
MathurAditya724 added a commit to getsentry/outpost that referenced this pull request Aug 5, 2026
…122)

Flip FLUE_NATIVE=1 and the container to the thin Dockerfile so the agent
brain and conversation live in the FlueJaredAgent Durable Object. The
container becomes a disposable git/gh sandbox that Cloudflare tears down
~10m after its last exec (sleepAfter 2h -> 10m, centralized in
SANDBOX_SLEEP_AFTER). Because the DO persists the conversation, the next
event resumes context and re-clones the repo into a fresh sandbox — so we
get delete-when-idle + resume-on-next-event without a fragile in-container
session restore.

Trade-off: Lore only runs in-container (Phase 1). In Phase 2 model traffic
goes direct to OpenRouter until a standalone Lore gateway is deployed
(LORE_GATEWAY_URL). Instant rollback: set FLUE_NATIVE=0 and flip the image
back to Dockerfile.phase1.

Validated live on getsentry/cli#1365: dispatch -> DO -> skills + gh/bash
tool exec in the thin sandbox -> correct SKIPPED decision, history synced
from the DO to D1, no exceptions.

Co-authored-by: Cursor <[email protected]>
@MathurAditya724 MathurAditya724 added jared Trigger the Jared agent to work on stuff and removed jared Trigger the Jared agent to work on stuff labels Aug 5, 2026
MathurAditya724 added a commit to getsentry/outpost that referenced this pull request Aug 5, 2026
Webhook turns are prepped by the Worker (ensureSandboxReady) before dispatch,
but DO-initiated turns bypass that path: scheduled auto-merge/fix-ci follow-ups
(via scheduleFollowUp) and post-teardown resumes reach the FlueJaredAgent DO
with a possibly-empty container. With the 10m idle teardown, the auto-merge
quiet period (~10m) lands right when the container is gone, so git/gh would run
against an empty, unauthenticated sandbox.

Add a useAgentStart hook that ensures the thin sandbox is prepped before the
model's first turn: derive owner/repo from the entity key (agent_sessions row
keyed by the conversation id), mint a fresh installation token, and reuse
ensureSandboxReady(thinSandbox) to clone + re-auth. Idempotent and best-effort
(never throws into the turn). Webhook ('user') turns with an existing clone are
skipped; non-user deliveries force a re-prep so the ~1h GitHub token is also
refreshed for long-delayed follow-ups.

Not mirrored to container/flue (Phase 1 in-container Flue already owns the repo).
Validated live on getsentry/cli#1365: normal turn unaffected, no prep errors.

Co-authored-by: Cursor <[email protected]>
@BYK
BYK marked this pull request as ready for review August 5, 2026 19:58
@BYK

BYK commented Aug 5, 2026

Copy link
Copy Markdown
Member

Jared, take over this PR. Address all bot review comments, apply any suggestions you might have, then merge once all done and CI is green.

…uture extensibility

My review note on the PR: the envelope schema was strict; if the API
adds top-level metadata later it would reject. Switching to .passthrough()
keeps the required fields enforced while allowing unknown keys.

All conversation tests still pass (75/75) and biome clean.
@MathurAditya724 MathurAditya724 added jared Trigger the Jared agent to work on stuff and removed jared Trigger the Jared agent to work on stuff labels Aug 5, 2026
@jared-outpost
jared-outpost Bot merged commit b0f75c1 into main Aug 5, 2026
34 checks passed
@jared-outpost
jared-outpost Bot deleted the cursor/fix-conversation-view-envelope branch August 5, 2026 20:24
@jared-outpost

jared-outpost Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

merged. addressed the one open review note by switching AIConversationDetailsSchema to .passthrough() so future top-level envelope fields won't break parsing — conversation suites still 75/75, biome clean. all required checks green, rbro112's approval in place. squashed 223 lines across 9 files onto main and deleted the branch.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

jared Trigger the Jared agent to work on stuff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants