Skip to content

Reject invalid automation executions before persistence - #2454

Open
ymichael wants to merge 1 commit into
mainfrom
bb/post-merge-fix-reject-invalid-automation-writes-thr_m2n27yx45d
Open

Reject invalid automation executions before persistence#2454
ymichael wants to merge 1 commit into
mainfrom
bb/post-merge-fix-reject-invalid-automation-writes-thr_m2n27yx45d

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

The automation CLI constructs create and update requests in-process, so TypeScript types were the only protection before the shared data writer serialized an execution. A runtime-invalid value such as an empty prompt was committed first; only the response/stored-row decoder then rejected it. That poisoned project listing and made an ordinary repair update decode and fail on the invalid row before it could write. This is the residual write-before-validation invariant behind #2166 after #2431 correctly removed the arbitrary prompt-length cap.

What changed

The shared execution serializer now parses the final execution with the existing persisted-row schema before converting it to JSON and issuing SQL. Both production writers use that seam, so CLI create, full replacement, and partial agent updates cannot persist an execution that later reads would reject. The stored schema remains unbounded for prompt length, preserving valid long prompts and recovery of older over-cap rows.

Focused server-harness regressions prove that rejected create leaves the project list empty and rejected full/partial updates preserve their previously valid rows. There is no server/daemon wire change, no HOST_DAEMON_PROTOCOL_VERSION bump, and no CLI/guide/doc surface change; the same invalid input still fails, now before persistence.

How you verified

  • New create regression failed before the fix because listing decoded the committed empty prompt, then passed after the persistence guard.
  • New full/partial update regression failed before the fix because both valid rows became unreadable, then passed after the persistence guard.
  • pnpm exec turbo run test typecheck build lint --filter=bb-plugin-automations --force (5 test files, 69 tests passed; all 6 Turbo tasks succeeded, including long-prompt and scheduler coverage)
  • pnpm exec oxfmt plugins/automations/src/data.ts plugins/automations/src/server-harness.test.ts --check
  • pnpm exec oxlint plugins/automations/src/data.ts plugins/automations/src/server-harness.test.ts
  • git diff --check 1f064e5a0b11d0a1e84b5fe6b3600ffc66ad9445

Fixes #2166

AGENT GENERATED

CLI callers can construct invalid runtime values despite TypeScript types. Parse with the persisted schema at the serialization seam so rejected create and update operations cannot commit poison rows.
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.

automation update writes an over-cap prompt despite rejecting it, then no read of that project's automations succeeds

1 participant