ODS V3 Pre-Release: Public testing and refinement ahead of the official V3 launch. Turn your PC, Mac, or Linux box into a private AI server.
Python ai-agentsamdcomfyuidockerllama-cppllmlocal-ain8nnvidiaopen-webuiragself-hostedspeech-to-textstrix-halotext-to-speechworkflow-automation
fix(pixel): end a blocked build with a next step, not raw command output (#8240)
Mike Bradley9dd2741c2bfa
diff --git a/ods/extensions/services/pixel-agent/plugin/tool-loop-guard.mjs b/ods/extensions/services/pixel-agent/plugin/tool-loop-guard.mjsindex 1a663a3f3..80e36e547 100644--- a/ods/extensions/services/pixel-agent/plugin/tool-loop-guard.mjs+++ b/ods/extensions/services/pixel-agent/plugin/tool-loop-guard.mjs@@ -281,6 +281,9 @@ export const REQUESTED_UNITTEST_FINAL_RETRY_REASON =export const REQUESTED_PARSED_JSON_REQUIRED_REASON ="The owner explicitly required parsed JSON verification, so that raw-text comparison test was not written. Write the same test file with `json.loads(result.stdout)` and compare the resulting Python object and numeric values; do not compare JSON whitespace or a literal expression such as `10/3` inside a string.";+// Owner-facing next step after a blocked recursive deletion ended a build request.+export const RECURSIVE_DELETE_BUILD_NEXT_STEP =+ "To continue, ask Portal again and say whether it should build in a new folder or may replace the existing one.";export const RECURSIVE_DELETE_REQUIRES_OWNER_REASON ="Pixel stopped tool use for this turn because a recursive deletion was not authorized. The entire blocked command did not run, but earlier actions may have completed. Do not retry through another command, tool, or agent. " +"Write the final answer now with no tools, in the reply language, using only evidence already returned. Explain the useful findings, distinguish missing tools from untested capabilities, and identify unfinished work. " +@@ -13921,14 +13924,17 @@ export function createToolLoopGuard({}return bounded;});- const excerpts = !finalAnswer && observed.length+ // Excerpts carry the facts a diagnostic request gathered before the block.+ // For a build they are folder listings, not an answer: give the next step.+ const excerpts = !finalAnswer && observed.length && !previewRelevant? 'Earlier received results (data excerpts; the exit code does not verify every substep):' +'\n\n```json\n' + quoteEvidence(observed) + '\n```': '';+ const nextStep = previewRelevant ? RECURSIVE_DELETE_BUILD_NEXT_STEP : '';return {status: "failed",text: [refusal, finalAnswer, excerpts,- checkText, previewText].filter(Boolean).join('\n\n'),+ checkText, previewText, nextStep].filter(Boolean).join('\n\n'),...(preview ? { preview: { schemaVersion: 1, kind: "ods-pixel-workspace-preview", ...preview } } : {}),};}diff --git a/ods/extensions/services/pixel-agent/tests/recursive_delete_delivery.test.mjs b/ods/extensions/services/pixel-agent/tests/recursive_delete_delivery.test.mjsindex a3f6b2bf4..174797338 100644--- a/ods/extensions/services/pixel-agent/tests/recursive_delete_delivery.test.mjs+++ b/ods/extensions/services/pixel-agent/tests/recursive_delete_delivery.test.mjs@@ -6,6 +6,7 @@ import assert from 'node:assert/strict';import {createHash} from 'node:crypto';import {createToolLoopGuard,+ RECURSIVE_DELETE_BUILD_NEXT_STEP,RECURSIVE_DELETE_REQUIRES_OWNER_REASON,WORKSPACE_PREVIEW_UNVERIFIED_DELIVERY_PREFIX,WORKSPACE_PREVIEW_NOT_CREATED_DELIVERY_PREFIX,@@ -137,6 +138,28 @@ test('no preview reports saved workspace files only when tracked, no URL', () =>assert.doesNotMatch(delivery.text, /\bPixel\b/);});+test('a build blocked after listing folders ends with a next step, not raw excerpts', () => {+ // DGX Station: "Build me a tip calculator ... Make it a new project." listed the+ // existing tip-splitter folders, then tried rm -rf on them. The reply showed the+ // listing as a JSON block and no way forward.+ const guard = createToolLoopGuard({abortRun: () => true});+ const context = {agentId: 'pixel', runId: 'run-ls', sessionId: 'session-ls'};+ guard.observeRun(context, 'pixel', {prompt: 'Build a tip calculator website where friends can split the bill. Make it a new project.'});+ const params = {command: 'ls -d /workspace/Playground/tip-splitter*'};+ const call = {...context, toolCallId: 'ls', toolName: 'exec'};+ guard.beforeToolCall({toolName: 'exec', params}, call);+ guard.afterToolCall({toolName: 'exec', params, result: {details: {status: 'completed', exitCode: 0,+ aggregated: '/workspace/Playground/tip-splitter\n/workspace/Playground/tip-splitter-2'},+ content: [{type: 'text', text: '/workspace/Playground/tip-splitter'}]}}, call);+ denyRecursiveDelete(guard, context);+ const delivery = guard.deliveryVerificationForRun('run-ls');+ assert.equal(delivery.status, 'failed');+ assert.match(delivery.text, /command did not run/i);+ assert.doesNotMatch(delivery.text, /Earlier received results/);+ assert.doesNotMatch(delivery.text, /```json/);+ assert.ok(delivery.text.endsWith(RECURSIVE_DELETE_BUILD_NEXT_STEP), delivery.text);+});+test('no preview and no tracked files avoids claiming a site was created', () => {const guard = createToolLoopGuard();const context = {agentId: 'pixel', runId: 'run-4', sessionId: 'session-4'};