Skip to content

feat(build-notes): draft workflow builds in hidden, agent-only build notes - #10193

Open
myxamediyar wants to merge 7 commits into
stagingfrom
feat/build-notes
Open

myxamediyar wants to merge 7 commits into
stagingfrom
feat/build-notes

Conversation

@myxamediyar

@myxamediyar myxamediyar commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • New build-notes feature flag (off by default; global and per-organization rollout)
  • Chat drafts a workflow build in build-notes/<workflowId>.md before it changes the graph; Sim keeps the sanitized graph of its last build beside it in build-notes/<workflowId>.baseline.json
  • New workflow_build_notes table owns both files (owned-file context build_notes): never listed in Files, reachable only by Copilot (people and API keys get not found), archived and restored with the workflow, never copied by duplicate, fork or export
  • build_notes Copilot service: create, status, evaluate (dry-runs the notes' operations block and lists open <<open:…>> placeholders, [gather]/[ask] items, skipped operations, input errors, and lint the batch adds), apply (builds from the evaluated block, atomically), changes (redacted diff since the baseline, ignoring layout), rebase
  • On a workflow with notes, a Copilot operations apply or state replace is refused unless it is the evaluated batch, from notes unchanged since evaluation, on a graph unchanged since the baseline; each build spends the evaluation and moves the baseline. A person's edit (editor or API) is never refused; it shows up in changes
  • The chat inventory marks workflows with notes, and whether they were saved since the baseline
  • Migration 0461 adds workflow_build_notes and lets the file ownership functions admit the build_notes context (reconcile-file-ownership replays them for push-provisioned databases)
  • listWorkflowLintFindings lets evaluation compare a batch's lint with the saved graph's

Type of Change

  • New feature

Testing

  • lib/build-notes/build-notes.integration.ts (10 checks, real Postgres): hidden files and person access, baseline write refusal, evaluation, exact-batch builds, edited-notes refusal, a person's edit and its reconciliation, lint the batch adds vs. lint already in the graph, content-gate refusal, flag off, archive and restore with file history. Disabling the agent-only access check and the apply guard turns their checks red
  • lib/build-notes/agent-path.integration.ts: the whole loop through sim_cli as Chat sends it (24 calls: workflows create, build-notes create/evaluate/apply/status/changes/rebase, files read/edit), with a JSON transcript in test-results/build-notes-agent.json. It caught two bugs fixed here: the template's own example placeholder blocked every evaluation, and lint from a person's unfinished edit blocked the agent's builds
  • bun run test (3777 files pass), bun run lint, bun run type-check, bun run check:audits, bun run check:migrations origin/staging, block registry check, drizzle-kit generate (no drift)

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Nov 19, 2026 1:42am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

Adds hidden workflow build notes so Copilot can draft, check, and apply a planned build while tracking edits made by people.

  • Copilot builds workflows from notes that Sim checks before applying.
  • Build notes and their graph baseline stay in hidden, agent-only files.
  • Copilot can use build-note tools and see which workflows have notes.

No new actionable issues found.

Diagram

sequenceDiagram
    participant C as Copilot
    participant N as Hidden notes
    participant W as Saved workflow
    C->>N: Draft operations
    C->>W: Evaluate operations without saving
    N-->>C: Record approval when checks pass
    C->>W: Apply approved batch
    W->>N: Spend approval under the write lock
    W->>W: Check baseline and save graph
    W->>N: Record committed graph as baseline
Loading

Reviews (8) · Last reviewed commit: "fix(build-notes): carry the notes' layou..." · Reviewed by Greptile

Comment thread apps/sim/lib/build-notes/guard.ts Resolved

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 48 files

This PR changes authentication, authorization, or input validation. Ultrareviews find 2.4x more serious bugs than standard reviews. Comment @cubic-dev-ai ultrareview to run one.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/workflows/lifecycle.ts Resolved
Comment thread apps/sim/lib/build-notes/guard.ts Resolved
Comment thread apps/sim/lib/build-notes/baseline.ts Resolved
Comment thread apps/sim/lib/build-notes/files.ts Resolved
Comment thread apps/sim/lib/workflows/editing/lint.ts Resolved
Comment thread apps/sim/lib/build-notes/notes.ts Resolved
@myxamediyar

Copy link
Copy Markdown
Contributor Author

@greptile

@myxamediyar

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@myxamediyar I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 48 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/build-notes/guard.ts Resolved
Comment thread apps/sim/lib/build-notes/baseline.ts Resolved
@myxamediyar

Copy link
Copy Markdown
Contributor Author

@greptile

@myxamediyar

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@myxamediyar I have started the AI code review. It will take a few minutes to complete.

Comment thread apps/sim/lib/build-notes/guard.ts Resolved

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 50 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/build-notes/content.ts Resolved
Comment thread apps/sim/lib/build-notes/baseline.ts Resolved
Comment thread apps/sim/lib/build-notes/guard.ts Resolved
Comment thread apps/sim/lib/build-notes/guard.ts Resolved
@myxamediyar

Copy link
Copy Markdown
Contributor Author

@greptile

@myxamediyar

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@myxamediyar I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 50 files

Confidence score: 4/5

  • In apps/sim/lib/build-notes/content.ts, notes can be written with notes.baselineFileId null, leaving an incomplete row that can be evaluated without a baseline. Reject the write and direct callers to run build-notes rebase first.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/sim/lib/build-notes/content.ts">

<violation number="1" location="apps/sim/lib/build-notes/content.ts:21">
P2: A notes write is accepted while `notes.baselineFileId` is null. Refuse it and direct the caller to run `build-notes rebase` before editing notes, so an incomplete notes row cannot be evaluated without a baseline.

(Based on your team's feedback about requiring a baseline before guarded writes.)</violation>
</file>

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/build-notes/content.ts Resolved
Comment thread apps/sim/lib/build-notes/files.ts Resolved
Comment thread apps/sim/lib/build-notes/repository.ts Resolved
Comment thread apps/sim/lib/build-notes/files.ts Resolved
@myxamediyar

Copy link
Copy Markdown
Contributor Author

@greptile

@myxamediyar

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@myxamediyar I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 50 files

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/build-notes/files.ts Resolved
@myxamediyar

Copy link
Copy Markdown
Contributor Author

@greptile

@myxamediyar

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@myxamediyar I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 50 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Turn on auto-fix | Re-trigger cubic

@myxamediyar

Copy link
Copy Markdown
Contributor Author

@greptile

@myxamediyar

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@myxamediyar I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 50 files

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/build-notes/files.ts Resolved
…notes

Behind the build-notes feature flag, Chat drafts a workflow build in
build-notes/<workflowId>.md before it changes the graph, and Sim keeps the
sanitized graph of its last build beside it as build-notes/<workflowId>.baseline.json.

- workflow_build_notes owns both files; they never appear in Files and only
  Copilot reaches them
- build_notes service: create, status, evaluate (dry-run of the notes' operations
  block plus open placeholders and items), apply, changes, rebase
- a Copilot apply or state replace on a workflow with notes must be the evaluated
  batch, from unchanged notes, on a graph unchanged since the baseline; a person's
  edit is never refused and shows up in changes
- evaluation holds a build only for lint its batch adds
- archive and restore carry the notes; the file ownership functions admit the
  build_notes context
…ghten review findings

- spend the evaluation and re-check the baseline inside the write transaction;
  notes writes spend it too, so a build racing a notes edit is refused
- record the baseline from the build's own commit (afterWrite hook)
- refuse a Copilot whole-graph replace on a workflow with notes, and a build
  with no baseline
- detect credential switches through salted hashes of withheld values
- compare lint findings by block id, as counts
- restore build notes with a restored folder; skip the archive step on a schema
  that predates the table
- read the baseline in one snapshot, refuse oversize baselines, anchor the
  operations fence, accept any list marker for open items
…s monotonic

- archive the workflow rows, then build-notes files, then notes rows: the order
  builds (workflow, notes) and notes writes (file, notes) already take
- record a baseline only if it is not older than the recorded one, rolling back
  its file write otherwise
- a failing evaluation withdraws an earlier pass
- refuse NUL bytes in notes; hash cleared block data values too
…nt builds and archives

- record a passing evaluation only while its baseline is still the recorded one
- create notes and baseline files under a shared lock on the live workflow row
- hand build-notes files to the workspace when their creator's account goes
@myxamediyar

Copy link
Copy Markdown
Contributor Author

@greptile

@myxamediyar

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@myxamediyar I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 50 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Turn on auto-fix | Re-trigger cubic

This branch was successfully deployed

1 active deployment
Preview — b11250dd Deployed Nov 19, 2026 by vercel[bot]
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