Skip to content

Commit bb405d3

Browse files
daniel-lxsclaude
andcommitted
Merge origin/develop: regenerate Discord migration as 0014 after #384's 0013
SQL unchanged, renumbered only. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2 parents 0e8e971 + 55aa93e commit bb405d3

66 files changed

Lines changed: 12671 additions & 1887 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@roomote/web": minor
3+
---
4+
5+
Environments now track 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, then it becomes Verified; runtime-affecting edits reset it to Configured while name/description-only edits keep it verified. Onboarding can finish while verification runs, the Environments settings page shows the verification status with a Retry verification action and a link to the related task, and agents record the outcome through the new `manage_environments` `record_verification` action.

apps/api/src/handlers/environments/__tests__/recordVerification.test.ts

Lines changed: 208 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/api/src/handlers/environments/createEnvironment.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,32 @@ export async function attachEnvironmentIdToTaskRun(
172172
.where(eq(taskRuns.id, taskRun.id));
173173
}
174174

175+
/**
176+
* Resolve the calling task run's Roomote task id, if the write is driven by a
177+
* run-token task. Used to atomically register that task as the current
178+
* verification attempt for the environment it just created or applied a
179+
* runtime-affecting update to. The environment-setup skill runs verification
180+
* from this same setup task and records the outcome through
181+
* `record_verification`; registering the caller's taskId means that recording
182+
* matches server-side without the agent having to hand-pass any task id.
183+
*/
184+
export async function resolveCallingVerificationTaskId(
185+
auth: McpAuth,
186+
): Promise<string | undefined> {
187+
const runId = extractRunId(auth);
188+
189+
if (!runId) {
190+
return undefined;
191+
}
192+
193+
const taskRun = await db.query.taskRuns.findFirst({
194+
where: eq(taskRuns.id, runId),
195+
columns: { taskId: true },
196+
});
197+
198+
return taskRun?.taskId ?? undefined;
199+
}
200+
175201
/**
176202
* POST /api/mcp/environments
177203
*
@@ -266,6 +292,8 @@ export async function createEnvironment(
266292
return c.json({ error: missingRepositoryError }, 400);
267293
}
268294

295+
const verificationTaskId = await resolveCallingVerificationTaskId(auth);
296+
269297
const created = await db.transaction(async (tx) => {
270298
const inserted = await tx
271299
.insert(environments)
@@ -275,6 +303,13 @@ export async function createEnvironment(
275303
name: config.name,
276304
description: config.description,
277305
config,
306+
// New environments start configured but not yet verified. A
307+
// follow-up verification task confirms the runtime works. Registering
308+
// the calling task here means its record_verification matches
309+
// server-side without the agent hand-passing a task id.
310+
isVerified: false,
311+
verificationTaskId: verificationTaskId ?? null,
312+
verificationError: null,
278313
})
279314
.returning({ id: environments.id });
280315

apps/api/src/handlers/environments/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ import { createEnvironment } from './createEnvironment';
55
import { getEnvironment } from './getEnvironment';
66
import { updateEnvironment } from './updateEnvironment';
77
import { listEnvironments } from './listEnvironments';
8+
import { recordVerification } from './recordVerification';
89

910
export const environmentsRouter = new Hono<{ Variables: Variables }>();
1011

1112
environmentsRouter.post('/', createEnvironment);
1213
environmentsRouter.patch('/:id', updateEnvironment);
14+
environmentsRouter.post('/:id/verification', recordVerification);
1315
environmentsRouter.get('/:id', getEnvironment);
1416
environmentsRouter.get('/', listEnvironments);

0 commit comments

Comments
 (0)