From e4c84acf29840c4be29a2cff1607ef0e6948c4af Mon Sep 17 00:00:00 2001 From: saravanakumardb1 Date: Mon, 1 Jun 2026 00:58:45 -0700 Subject: [PATCH] fix(fleet): bump the M0 queue gate when a draft/queued job is edited MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updateDraft changes caps/deps/priority (and body) without a stage change, so it did not bump fleet_queue_state — gated factories (AQ_FLEET_GATE=1) would not re-evaluate claimability until the safety interval. Bump the gate on edit so an edit that makes a job claimable wakes factories promptly. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../platform-service/src/modules/fleet/coordinator.test.ts | 3 +++ services/platform-service/src/modules/fleet/coordinator.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/services/platform-service/src/modules/fleet/coordinator.test.ts b/services/platform-service/src/modules/fleet/coordinator.test.ts index c97cf485..25bb383e 100644 --- a/services/platform-service/src/modules/fleet/coordinator.test.ts +++ b/services/platform-service/src/modules/fleet/coordinator.test.ts @@ -1342,6 +1342,7 @@ describe('fleet coordinator — draft lifecycle (save / edit / submit)', () => { it('updateDraft edits the prompt + config while draft (content hash changes)', async () => { const { job } = await coord.submitJob(PID, input({ draft: true })); const before = (await repo.getJob(job.id, PID))!.contentHash; + const verBefore = await repo.getQueueVersion(PID); const res = await coord.updateDraft(job.id, PID, { bodyMd: '# edited prompt', repo: 'learning_ai_notes', @@ -1357,6 +1358,8 @@ describe('fleet coordinator — draft lifecycle (save / edit / submit)', () => { expect(res.doc.contentHash).not.toBe(before); expect(res.doc.stage).toBe('draft'); // editing doesn't submit it } + // the edit bumps the M0 queue gate so gated factories re-evaluate promptly + expect(await repo.getQueueVersion(PID)).toBeGreaterThan(verBefore); }); it('submitDraft promotes draft → queued, then it is claimable', async () => { diff --git a/services/platform-service/src/modules/fleet/coordinator.ts b/services/platform-service/src/modules/fleet/coordinator.ts index 593f54e5..d79dbdc1 100644 --- a/services/platform-service/src/modules/fleet/coordinator.ts +++ b/services/platform-service/src/modules/fleet/coordinator.ts @@ -346,6 +346,9 @@ export async function updateDraft( const updated = await repo.updateJob(jobId, productId, updates); if (!updated) return { ok: false, reason: 'not_found' }; + // Editing caps/deps/priority changes what's claimable, so bump the M0 gate to + // wake gated factories now instead of waiting for the safety interval. + await repo.bumpQueueVersion(productId); await repo.appendEvent({ jobId, productId,