Repository navigation
fix(conversation): Parse details envelope instead of bare span array - #1365
Conversation
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]>
Co-authored-by: Cursor <[email protected]>
There was a problem hiding this comment.
looks solid. envelope schema swap is clean and the title threading through api → formatter → command is consistent.
verified locally on the branch:
vitest runon the three conversation suites: 75/75 passbiome checkclean 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
titlefrom 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.
…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]>
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]>
|
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.
|
merged. addressed the one open review note by switching |
Summary
sentry conversation viewwas 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
Reproduction: https://sentry.sentry.io/explore/conversations/project_metadata_summary-317e47d
These endpoints are
PRIVATEand are not published in@sentry/api/ sentry-api-schema, so the CLI owns local Zod schemas for them.Changes
{ conversationId, title, spans }details envelope and extractspansfor transcript buildingtitlein human/JSON transcript output when presentTesting
conversationsAPI,conversation viewcommand, conversation formatterspnpm run cli -- conversation view sentry/project_metadata_summary-317e47d(no longer errors); conversation with spans renders title + transcript headerMade with Cursor