[Feat] Add persisted environment verification state#384
Merged
brunobergher merged 23 commits intoJul 15, 2026
Conversation
Contributor
Author
|
No new code issues found. See task
Reviewed 5f666c9 |
Contributor
Author
|
All review findings addressed; branch merged up to current develop. Verification-attempt claiming (
Earlier fixes retained: atomic registration inside the row-locked config update on create/edit; the retry lock uses Real-DB regression tests cover the attempt-claiming, onboarding-active guard, and env-var fulfillment paths. |
625e31d to
1d074af
Compare
… env-var fulfillment on follow-up failure
…erification-state-0t2zdpugqvr9h # Conflicts: # packages/db/drizzle/meta/0011_snapshot.json # packages/db/drizzle/meta/_journal.json
…erification-state-0t2zdpugqvr9h # Conflicts: # packages/db/drizzle/meta/0012_snapshot.json # packages/db/drizzle/meta/_journal.json
brunobergher
approved these changes
Jul 15, 2026
daniel-lxs
added a commit
that referenced
this pull request
Jul 15, 2026
…s 0013 SQL unchanged, renumbered only. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue
Internal Roomote work.
Why this PR exists
What changed
Environments now carry a persisted verification state that is separate from "a definition exists". A new environment is Configured until a follow-up verification task confirms it works, at which point it becomes Verified; onboarding stays finishable as soon as configuration completes and verification continues asynchronously.
isVerified(NOT NULL DEFAULT true),verificationTaskId,verifiedAt, andverificationErrortoenvironments(migration0012). Existing environments stay verified via the default; newly created environments start unverified.updateEnvironmentDefinitionhelper, while name/description-only edits preserve it, so the API, Settings, agent, and declarative write paths cannot drift. Declarative (file-managed) environments opt out of the reset.manage_environmentsMCP tool gains arecord_verificationaction. The recording task's identity is derived server-side from its run token and matched against the environment's currentverificationTaskId, so a stale or superseded attempt cannot overwrite a newer one, and only the active verification flow for that environment can record. Failure messages are sanitized before persistence (no secrets or environment YAML).environments.retryVerificationmutation confirms edit access, rejects a concurrent active verification, resets the environment to unverified, enqueues a normal standard task marked to verify that environment, and stores the returned task id. Verification tasks appear in normal task history with no special badge.record_verification(success only when the environment explicitly looks ready, otherwise a user-safe failure), and treats a superseded recording as a stop signal.verificationTaskActiveflag. The onboarding widget distinguishes configured / verification-in-progress / verified / failed states, still lets you finish setup while verification runs, and offers Retry verification / Edit environment / View task actions. The Settings Environments page shows a per-environment verification badge, the last failure message, a Retry verification button, and a link to the related task, polling while a verification task is active. "Verification in progress" only shows while the task actually has an active run, so a crashed/unreported attempt falls back to Configured.Concurrency hardening
registerVerificationTaskIdoption on the shared update helper; create sets it directly in the insert), so a concurrent edit can no longer associate an older setup task with a newer configuration.enqueueTask'sbeforeEnqueuehook, so the environment points at the new task id before the run is eligible to start and the run'srecord_verificationcannot be rejected as a mismatched attempt. The active-attempt guard also recognizes an in-flight initial onboarding verification (asetup_onboardingrun marked withenvironmentDefinitionId).taskEnvVarRequests.markFulfilled), so a reconnect or history refetch does not resurface an already-handled variable request.How it was tested
record_verificationhandler, therecord_verificationAPI endpoint (authorization, stale/superseded 409, and error sanitization including lowercase/YAML secret lines), theretryEnvironmentVerificationcommand (enqueue + registration, concurrent-verification rejection, serialized-retry concurrency, missing environment), the active-verification guard against a real DB (retry marker, onboarding-setup marker, cross-environment isolation), and the env-var fulfillment persistence.definitionfield.pnpm lint,pnpm check-types, andpnpm knippass locally.Screenshots
Checklist
[Fix],[Feat],[Improve],[Refactor],[Docs], or[Chore]followed by a user-facing descriptionpnpm lintandpnpm check-typespass locallypnpm changeset