Skip to content

improvement(workflow-code): server hardening, flaky test root causes, and agent DX across the source loop - #10287

Merged
waleedlatif1 merged 88 commits into
stagingfrom
fix/workflow-code-final
Nov 21, 2026
Merged

waleedlatif1 merged 88 commits into
stagingfrom
fix/workflow-code-final

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Server

  • Dry runs (workflow and workspace) are charged to the plan budget and take a plan slot. The Code tab's source read has a slot lane of its own. A source create refused for lack of a slot answers 429 with Retry-After, not 500.
  • Staged blobs count against the payer's storage quota. An apply marks the blobs it wrote as consumed (migration 0469 adds the nullable consumed_at), so they stop counting twice. A quota that can't be read answers 503, not SOURCE_STAGING_FULL. A batch the quota refuses still renews the blobs it re-sent.
  • A file delete is guarded by the revision its plan saw. A managed rows write counts the keyless rows it keeps, and is refused for the row limit only when it grows the table. A write that joins a table transaction keeps that transaction's timeouts. Table plan reads run 4 at a time.
  • Load order: blocks and subflows tie-break on ctid, as edges already do, and a save stamps the rows it inserts a microsecond apart. Tied legacy rows still load in physical order.
  • Tables: every {tableId} route accepts a name, dispatches and exports included. Restore takes the id only. A name missing from a workspace and one the caller cannot reach now get the same 404 body. A bulk action acts once on a table named twice.
  • Self-hosting: Compose starts realtime only after migrations finish. The upgrade runbook notes that Helm does not do this.

DX (CLI and docs)

  • New exit 15: a workspace apply or promotion wrote part of its plan and held the rest back. This used to exit 1.
  • workspaces source status matches the dry run: it filters only compile and lint findings for folders sent by base, and keeps plan refusals.
  • GitHub Actions: findings become ::error annotations with paths relative to the repo root, and a workspace apply writes its plan to the step summary.
  • run --dir maps a failed block to its source file and line. It is refused with --follow and --async.
  • Also: group help for the edit loop, primer additions (renames, retries, test runs, exit 15), webhook URLs after a deploy, --stop-after/--from-block accept block names, failed runs record their input, blocks get starter, and quieter output by default.

Flaky tests

  • Docs API-samples loopback (ECONNRESET): the fixture closes its connections after each response. The extension e2e routes every API call through one fresh-connection helper.
  • workspace-files hook tests wait for the client to settle instead of sleeping. That exposed a real bug: the content read retried a superseded storage key, and now it doesn't.

Docs

  • The scripting CI recipe commits the directory after exit 15 or 8 (!cancelled()). The apply exit table lists 14 and the change to 15. The CLI reference keeps column-aligned help (the operations handle table) in a fence.

Not done, deliberately

  • Flaky: the e2e (markdown-viewer) WebKit keyboard selection and the shared-file 409 are not addressed here.
  • Server: a 304 on the source read still loads and prints, because the ETag needs the canonical keys. A read-role plan can still trigger MCP discovery writes. The no-op dry-run redeploy check now runs after the plan instead of beside it; it is a cheap check, so this is accepted.
  • Row cursors are scoped to the table reference the first page used. This is documented rather than reworked.
  • Redesigns left for follow-ups:
    • an orchestration rate_limited error code, so slot refusals need no per-policy wiring;
    • a running staged-bytes counter on the payer;
    • a structured error line in the run payload;
    • an explicit sort column for load order.
  • Product decisions not taken here: the default output following the terminal, three-way merge, all-or-nothing --to, a webhook token in the CLI, workspace create, and the const-swap rule.

…r, as edges already do

A full replace wrote every block with one created_at, so the id tie-break
shuffled their order against the unordered index scan before it. Ties now
break on ctid, and a save stamps the rows it inserts together a microsecond
apart in the state's order, so a later diff save that rewrites a row in
place cannot move it either.
… replying with a Response the caller never sees
…slot, on every source write route

A workflow dry run spent the source-write budget, and every dry run took an
apply slot, so a dry-run loop could 429 real applies. A create from source is
charged and admitted the same way, and its route now takes a slot too.
…block's name or key, and an unknown one lists the blocks
The internal read ran the same load, canonicalize and print as the v2 get with
no slot. It now shares the read lane and answers 429 with Retry-After when the
server is full. Its ETag stays after the read: the printed keys are known only
once the graph is canonicalized, so no earlier tag is sound.
… an env name instead of claiming the workspace lacks it
…yment only when it leaves the draft as it is

The check started beside every plan and was discarded whenever the dry run
would change the draft, which then compares what it would write instead.
…, naming its replacement first (blocks get starter)
…lan saw, under the row lock

The apply compared the revision and then deleted with no precondition, so a
Files tab edit landing in between was deleted with the file. The delete use
case now takes expectedRevision, as content updates do, and refuses with a
conflict when the content moved.
… edge removal and rename rewrites, and its example wires source
…inst the row limit

The reshape checked capacity as if the declared rows replaced every stored
row, but a keyed write keeps stored rows with no key value, so a table could
end over its plan limit. The keyed write now checks the rows it leaves under
the lock, once it has read them.
…plan and held the rest back exits 15, apart from nothing written
…tion's timeouts

withLockedTable reset the 10s statement and 5s idle defaults each time a write
joined a TableWriteTx, dropping a scaled timeout an earlier step set. Only a
transaction it opens itself gets the defaults now.
…ith --output json, the starter's next step included
… a time

The column-rename check loaded each using workflow's draft, source and live
version one after another, and the allow-delete check read each undeclared
table's rows version in turn. Both now run at a bounded concurrency of 4, with
findings kept in the same order.
…hook the workflow serves, promotions included
…ions and a workspace apply writes its plan to the step summary
…y under the lock, so an over-limit table can still be edited or shrunk
… before acting, so a table named twice is not reported missing after its delete
… runner sets, and a JSON check in a job still annotates on stderr
…n a GitHub Actions job, as a display one does
… row lock, reports an unreadable staged total as unavailable, and an apply consumes only the staged copy it read
…ck for a deployment-only write, strip escapes from a read failure, and a cancelled read fails the command
…by name; only a reference shaped like a minted id skips the name lookup
…elete guards, and the README lists exits 14 and 15
…nsumption for every write, one fallback completion shape, a shared cancellation check
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review

@waleedlatif1 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 145 files

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

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review

@waleedlatif1 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 145 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

@waleedlatif1
waleedlatif1 merged commit 293ec1b into staging Nov 21, 2026
88 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/workflow-code-final branch November 23, 2026 00:04

This branch was previously deployed

1 inactive deployment
Preview — b35d94be Deployed Nov 21, 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