Repository navigation
feat(agents): Merge the root kind into thread - #4377
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Okay, but it doesn't make sense to call it a root if it's a child. That's why I was suggesting we rename it |
0a97831 to
0dea706
Compare
|
Let's just rename root to thread. I think it makes more sense for what we're doing |
Done in b17a499. The merged kind is now |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b17a499. Configure here.
| RETURN NEW; | ||
| END | ||
| $function$;--> statement-breakpoint | ||
| CREATE TRIGGER "junior_conversations_kind_root_to_thread" BEFORE INSERT OR UPDATE ON "junior_conversations" FOR EACH ROW WHEN (NEW."kind" = 'root') EXECUTE FUNCTION "junior_conversations_kind_root_to_thread"(); |
There was a problem hiding this comment.
Rollout rewrites roots as child threads
High Severity
The new trigger and backfill store every former root as thread, but a worker still on the previous deploy treats thread as a child Thread. During overlap those workers apply child-thread prompts, tools, and parent reporting to ordinary top-level conversations. conversationKindFromRow also throws on leftover root instead of mapping it, so the two deploys have no compatible dual-read window.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit b17a499. Configure here.
There was a problem hiding this comment.
This is a hard cutover on purpose, so I'm leaving it as merged.
- No
rootrow stays behind to makeconversationKindFromRowthrow. The trigger rewrites eachrootwrite from the previous deploy tothread, and the backfill moves the stored rows. - The overlap is real: while the deploy runs, a worker still on the previous release reads a top-level
threadas a child Thread. That window lasts only for the length of the deploy, and we accepted it instead of a dual-read release and a cleanup.
|
How are you looking in here? The build still failing |
Steps 2 and 3 of #4275. turnBehavior decides from the parent edge and the sender, not from a separate thread kind. The thread kind is merged into root, and stored rows move to root. Co-Authored-By: David Cramer <[email protected]>
Co-Authored-By: David Cramer <[email protected]>
A top-level Conversation and a child Thread now share the kind `thread`. The migration backfills stored `root` rows. A trigger stores a `root` that a writer of the previous deploy sends as `thread`, and both kind checks accept both values until every writer stores `thread`. Co-Authored-By: David Cramer <[email protected]>
Chain the kind migration after drop_versions_notify, and name the release for its constraint drops, as the migration-locks check now requires. Co-Authored-By: David Cramer <[email protected]>
b17a499 to
45d3464
Compare
| UPDATE "junior_conversations" | ||
| SET "kind" = 'thread' | ||
| WHERE "kind" = 'root'; |
There was a problem hiding this comment.
Root-to-thread backfill does not invalidate cached detail reports
The backfill changes the detail report’s kind without changing its revalidation token, so clients polling with a pre-backfill token can receive 304 and keep using a report whose kind is root, contrary to the new thread contract.
Evidence
- The backfill updates only
kind; it does not advancedetail_version. conversationVersionsQueryderives its token from subtreedetail_versiontotals and other state that does not includekind;readConversationDetailEtaghashes that token for the detail validator.- The detail route returns 304 when the sent validator matches. The dashboard’s
readRevalidatedthen returns its cached report without parsing a new response. - The current
conversationKindSchemaexcludesroot, whileconversationSummaryFromStoredConversationprojects the stored kind into the report.
Identified by Warden · code-review · NXB-2HN
…ead design (#4428) States where Spaces and the Lead are heading. A Space uses the core Conversation tree (parents, roots, Participants, access, stops, archives, Watches, updates), and only a few Space-specific layers sit on top of it. - `design/spaces.md` is rewritten. The Lead is the root of the Space's tree. Every Space Conversation, whether the Lead starts it, a person starts it in the Space, or a person moves it in, is a child of the Lead and has the Lead as its root. Children inherit the Lead's Participants. Archive and snooze act per child. The file lists the Space layers explicitly: metadata, membership, configuration, the Lead's prompt and tools, moves, and rendering (the sidebar, the Threads panel, and top-level lists). - `design/lead.md` is new. It covers the Lead's role, its curated manager tool set (it runs Threads, reads, plans, and asks people, and it never writes or runs code), and the Turn gates: explicit reply on child and Event Turns, quiet `done` updates, and child results as claims. Gaps record what is not on main yet. - `design/agent-teams.md`: a Lead's team is its Space, and the Lead gaps move to `lead.md`. - `design/child-agents.md`: removes contradictions with Spaces. A move changes a child's parent, a moved Conversation delivers to its own Location, and the 8-child limit does not apply to a Lead's children. - `TERMINOLOGY.md`: updates Lead, Space, Thread, Team, Delivery, and Participant, and adds Top-level Conversation (derived, not stored). Related: #4377 (`thread` kind), #4411 and #4414 (moves), #4416 (Threads panel). #4413 edits some of the same lines. After this merges, it should drop those doc changes and delete only the gaps it closes. <!-- junior-request-attribution:start --> via @dcramer. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:local%3Aweb%3A56172fc7761dc3a4c09f6bc7 --> -- [View Session](https://junior-prod.sentry.dev/conversations/local%3Aweb%3A56172fc7761dc3a4c09f6bc7) [[Sentry]](https://sentry.sentry.io/explore/conversations/local%3Aweb%3A56172fc7761dc3a4c09f6bc7/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: David Cramer <[email protected]>
This prepares `main` for a merge queue. Two PRs that each add a migration off the same parent both pass CI on their own, then leave two migration leaves on `main`. That happened with #4377 and #4120, and before them with #4224, #4290, #4313 and #4279. A merge queue tests each PR merged on top of the ones ahead of it, but only if `ci / required` reports on `merge_group` runs. That's what this adds. On `merge_group`, `getsentry/action-filter-paths` matches every filter, as on a push, so every path-gated job that `ci / required` needs runs. Two jobs still skip, as they do on a push to `main`, and a skipped job passes `ci / required`: - `pack-release-artifacts` runs only on push. - `ios` runs only on pull requests, because `ios.yml` runs on its own for pushes to `main`. Frameshift doesn't save or report screenshots on queue runs. Turning on the merge queue itself is a separate change to the `main` ruleset. "Require branches to be up to date" stays off. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A9ec51d25699838a155f2ddc2f0ffb45f --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A9ec51d25699838a155f2ddc2f0ffb45f) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A9ec51d25699838a155f2ddc2f0ffb45f/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: BYK <[email protected]>
![Fix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-light-v2-3x.png)


Steps 2 and 3 of #4275 (step 1 landed in #4278 and #4292), with the merged kind named
threadinstead ofroot.A child Thread differed from a top-level Conversation only by having a parent, so both are now one kind,
thread. This lets a later move between Spaces change only the parent, never the kind.root_conversation_idand "tree root" keep their names.ConversationKindis nowthread,automation,lead, ortask. Athreadmay have a parent.taskstays its own kind.turnBehaviortakeshasParentwith the kind and the sender. Athreadwith a parent gets the Thread behavior and thethreadPrompt mode: the top-level rules for a person's input, plus the rules for its parent's input.copiesRootVisibilityand the store's kind check read the parent edge.kindAllowsParentreplacesisTopLevelKind: athreadmay have a parent, ataskmust, and anautomationorleadnever does.startAgent,listAgents, andsearchConversationsalready usethread, so the stored kind is the tool kind. The mapping helpers (childConversationKind,childAgentKind,toolConversationKind) are gone.kinddropsroot. The dashboard labels and the Move to Space item readthread, and treat only a parentless one as top-level.TERMINOLOGY.mdand thekind-behaviorbaseline are updated.Migrations, as a hard cutover:
NOT VALID(no scan under lock), and both acceptrootandthread. This way an update to a row that still storesrootpasses before the backfill runs. It also adds thejunior_conversations_kind_root_to_threadtrigger, which stores arootthat a writer of the previous deploy sends asthread. So no reader needs arootfallback.rootrows tothreadin its own transaction.rootfrom the checks, once every deployed writer storesthread(TODO indb/schema/conversations.ts).No
design/text changes here.via @dcramer.
--
View Session [Sentry]