Repository navigation
Conversation
|
This PR has a migration; here is the generated SQL for for --
-- Add field embed to notebookblock
--
ALTER TABLE "notebooks_notebookblock" ADD COLUMN "embed" jsonb NULL;
--
-- Add field embed_source to notebookblock
--
ALTER TABLE "notebooks_notebookblock" ADD COLUMN "embed_source" text NULL;
--
-- Add field embed_summary to notebookblock
--
ALTER TABLE "notebooks_notebookblock" ADD COLUMN "embed_summary" text NULL;
--
-- Create model NotebookWorkflowRun
--
CREATE TABLE "notebooks_notebookworkflowrun" ("id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "date_updated" timestamp with time zone NOT NULL, "date_added" timestamp with time zone NOT NULL, "run_id" uuid NOT NULL, "delivered" jsonb DEFAULT '{}'::jsonb NOT NULL, "notebook_id" bigint NOT NULL, "organization_id" bigint NOT NULL, "writer_run_id" bigint NULL);
ALTER TABLE "notebooks_notebookworkflowrun" ADD CONSTRAINT "notebooks_notebookwo_notebook_id_c08a48c6_fk_notebooks" FOREIGN KEY ("notebook_id") REFERENCES "notebooks_notebook" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "notebooks_notebookworkflowrun" VALIDATE CONSTRAINT "notebooks_notebookwo_notebook_id_c08a48c6_fk_notebooks";
ALTER TABLE "notebooks_notebookworkflowrun" ADD CONSTRAINT "notebooks_notebookwo_organization_id_ee7a5194_fk_sentry_or" FOREIGN KEY ("organization_id") REFERENCES "sentry_organization" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "notebooks_notebookworkflowrun" VALIDATE CONSTRAINT "notebooks_notebookwo_organization_id_ee7a5194_fk_sentry_or";
ALTER TABLE "notebooks_notebookworkflowrun" ADD CONSTRAINT "notebooks_notebookwo_writer_run_id_4ab7d2a6_fk_seer_seer" FOREIGN KEY ("writer_run_id") REFERENCES "seer_seerrun" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "notebooks_notebookworkflowrun" VALIDATE CONSTRAINT "notebooks_notebookwo_writer_run_id_4ab7d2a6_fk_seer_seer";
CREATE UNIQUE INDEX CONCURRENTLY "notebook_unique_workflow_run" ON "notebooks_notebookworkflowrun" ("organization_id", "run_id");
ALTER TABLE "notebooks_notebookworkflowrun" ADD CONSTRAINT "notebook_unique_workflow_run" UNIQUE USING INDEX "notebook_unique_workflow_run";
CREATE INDEX CONCURRENTLY "notebooks_notebookworkflowrun_notebook_id_c08a48c6" ON "notebooks_notebookworkflowrun" ("notebook_id");
CREATE INDEX CONCURRENTLY "notebooks_notebookworkflowrun_organization_id_ee7a5194" ON "notebooks_notebookworkflowrun" ("organization_id");
CREATE INDEX CONCURRENTLY "notebooks_notebookworkflowrun_writer_run_id_4ab7d2a6" ON "notebooks_notebookworkflowrun" ("writer_run_id"); |
decision-model-linterapi
decision-model-linter: 132 calls on 28 files, 389,404 input tokens, $0.016, model typesafe/jev-1.13-20260917 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 75385bd. Configure here.
| orchestration.save(update_fields=["projection", "notebook_revision", "date_updated"]) | ||
| elif section == "metadata": | ||
| notebook.update( | ||
| title=notebook.title if binding.preserve_title else result["title"], |
There was a problem hiding this comment.
Existing notebook title overwritten on finalize
Medium Severity
Binding a workflow to an existing notebook never sets preserve_title. Metadata delivery then replaces that notebook's title unless someone happens to rename it after the bind. Opening onto a caller-selected notebook is a primary path, so a completed run can silently rename a notebook the user already titled.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 75385bd. Configure here.
| block.last_edited_by_id = user_id | ||
| if not created: | ||
| block.version += 1 | ||
| block.save() |
There was a problem hiding this comment.
Workflow text blocks omit markdown display
Medium Severity
Workflow text writes skip display validation and save the model default of {}. Every other text-block path stores {"type": "markdown"}, which the API documents as required. Readers that key off display.type will not treat these blocks as markdown.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 75385bd. Configure here.
| binding, _ = NotebookWorkflowRun.objects.get_or_create( | ||
| organization=organization, run_id=run_id, defaults={"notebook": destination_notebook} | ||
| ) |
There was a problem hiding this comment.
Low priority since nothing does this today. A rename only sets preserve_title on the bindings that exist at that point. So if someone renames the notebook and a second run then writes to it, the new binding starts at False and the metadata step replaces their title. Defaulting it from the destination here would cover that:
defaults={"notebook": destination_notebook, "preserve_title": destination is not None}| section = values["section"] | ||
| validator = MetadataWrite if section == "metadata" else StepsWrite |
There was a problem hiding this comment.
Small suggestion: FinalizerWrite could validate result for its section itself, with MetadataWrite and StepsWrite nested. Then errors come back keyed under result, and the next step items get checked before deliver_finalizer takes the locks.
| notebooks: QuerySet[Notebook] = Notebook.objects.filter( | ||
| organization=organization, status=requested_status | ||
| ).filter(Q(source_key__isnull=True) | ~Exists(newer_lineage_revision)) | ||
| if isinstance(request.access, ServiceAccountAccess) and not request.access.has_all_projects: |
There was a problem hiding this comment.
Heads up that this changes existing behaviour. A limited service account could read every notebook before, and now it loses the ones outside its projects and the ones with no projects selected. Just want to make sure that's intended.
| with notebook_writes(notebook) as writes: | ||
| require_workflow_writer(notebook, workflow_run_id, writer_run_id) | ||
| blocks = notebook.blocks | ||
| stored_key = f"workflow:{key}" |
There was a problem hiding this comment.
It might be helpful to include the run id in the stored key. Suggestions are scoped to the workflow run, but block keys are per notebook, so two runs writing to the same notebook share keys.
|
|
||
|
|
||
| @cell_silo_endpoint | ||
| class OrganizationNotebookWorkflowWriterEndpoint(OrganizationEndpoint): |
There was a problem hiding this comment.
This could extend OrganizationNotebooksBaseEndpoint like the endpoint above and keep its own auth and permission classes. That brings the notebooks feature check with it. It would need an extend_schema for the docs build.
75385bd to
098ce32
Compare


Second in the workflow notebook stack. Land the database schema in #131544 first.
A workflow needs to publish its findings incrementally, reuse the same notebook after a retry, and attach the Explorer run that wrote it. This adds the producer side of that contract behind the existing notebook feature and project access checks.
Sentry also owns the run and node checkpoint API, recovery scheduling, and retention. The organization endpoints start a workflow through Seer, read its progress from Sentry, and forward commands. A beta monitor launch binds the workflow to a Sentry notebook using the same breached-metric source snapshot as the legacy path.
Deploy this contract before enabling the notebook writer.
Verified the notebook and investigation orchestration test suites and ran the authenticated Seer client against the Django endpoints. The cross-service check exercised creation, attachment, editing, finalization, redelivery, reads, and removal.