Skip to content

Add the work analytics database migration - #5477

Open
brsbl wants to merge 13 commits into
bb/core-capability-use-main-thr_a4mhd93zjifrom
bb/work-analytics-migration-thr_ch8epzf42x
Open

brsbl wants to merge 13 commits into
bb/core-capability-use-main-thr_a4mhd93zjifrom
bb/work-analytics-migration-thr_ch8epzf42x

Conversation

@brsbl

@brsbl brsbl commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Anonymous work records needed persistent tables. The migration also conflicted with newer migrations.

What changed

  • Database upgrades create the tables needed to link work anonymously.
  • Migration rewinds remove analytics tables before clearing migration history.

Stack order: #5947 → #5437 → #5477 → #5469 → #5470 → #5471 → #5472 → #5473 → #5439.

How you verified

  • Remote CI: database migration checks passed. Run
  • End-to-end: a fresh database started successfully with the regenerated migration.

BB-Thread-ID: thr_ch8epzf42x

BB-Thread-ID: thr_nq42ntdw95

BB-Thread-ID: thr_k4ic49de34

AGENT GENERATED

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T05:00:44.904560Z 11c8315 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

brsbl and others added 10 commits October 21, 2026 00:41
… an off-by-default flag

Adds work_origin (person, agent, automation, plugin, system) to thread_created
and user_message_sent when BB_FF_WORK_ORIGIN_TELEMETRY is on, so retention reads
can separate person-started work from scheduled automation runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… flag in parsed configs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follows PostHog and Segment naming guidance and bb's snake_case event fields:
the property says who started the work. The internal initiator system maps to
the value bb.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Matches bb's domain initiator (user | agent | system) and avoids PostHog's
reserved person term, per the shared analytics schema vocabulary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…or telemetry

Plugin SDK sends now carry originPluginId, so automation runs into an existing
thread report automation. bb thread spawn sends BB_THREAD_ID as senderThreadId,
and the new thread reports agent when that sender has a turn running.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without it the plugin SDK's attribution was dropped before the request left,
so automation runs into an existing thread still reported initiator user.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@brsbl
brsbl force-pushed the bb/work-analytics-migration-thr_ch8epzf42x branch from ee08e78 to 870bf85 Compare October 21, 2026 04:38
@brsbl
brsbl removed this pull request from stack #5478 October 21, 2026 04:40
@brsbl
brsbl added this pull request to stack #5984 October 21, 2026 04:40
@brsbl
brsbl force-pushed the bb/work-analytics-migration-thr_ch8epzf42x branch from 870bf85 to 156aa54 Compare October 21, 2026 04:48

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant