Skip to content

armgit / ODS

Public Imported from GitHub
0

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.

fix(pixel): tell the owner that previews keep no saved data (#8282)

Mike Bradley7e602fd688f7
diff --git a/ods/extensions/services/dashboard/src/lib/portalDeliveryNotes.js b/ods/extensions/services/dashboard/src/lib/portalDeliveryNotes.js
index 07857c257..7f3640818 100644
--- a/ods/extensions/services/dashboard/src/lib/portalDeliveryNotes.js
+++ b/ods/extensions/services/dashboard/src/lib/portalDeliveryNotes.js
@@ -16,6 +16,7 @@ export const DELIVERY_NOTES = Object.freeze([
"Portal published your page but couldn't finish checking it automatically. Try it, and tell Portal if something isn't right.",
'Portal stopped before it finished, so this page may not have everything you asked for yet. Send a message to continue.',
"The next step above hasn't started yet. Send a message to continue.",
+ "Portal's previews run isolated, so anything the page saves resets when it reloads. To keep data between visits, ask Portal to add export and import.",
"Portal saved the website files in your workspace but couldn't publish a preview of them, so they haven't been checked and there is no preview to open yet. Ask Portal to publish the preview.",
"Portal didn't create the website files for this request, so there is no preview to open yet. Ask Portal to try the build again.",
"Portal stopped before it finished because it wasn't making progress.",
diff --git a/ods/extensions/services/pixel-agent/plugin/preview-explanation.mjs b/ods/extensions/services/pixel-agent/plugin/preview-explanation.mjs
index 2faffed66..118c4b5b7 100644
--- a/ods/extensions/services/pixel-agent/plugin/preview-explanation.mjs
+++ b/ods/extensions/services/pixel-agent/plugin/preview-explanation.mjs
@@ -60,9 +60,14 @@ export const PREVIEW_INCOMPLETE_NOTE =
'Portal stopped before it finished, so this page may not have everything you asked for yet. Send a message to continue.';
// The run has ended: a step the reply announces will not start on its own.
export const PREVIEW_CONTINUE_NOTE = "The next step above hasn't started yet. Send a message to continue.";
+// The owner asked for data that outlasts a reload (requestsReloadPersistence).
+// Portal's previews cannot keep it, whatever the page does or the reply says.
+// Downloads and file inputs still work there, so export and import do.
+export const PREVIEW_STORAGE_NOTE =
+ "Portal's previews run isolated, so anything the page saves resets when it reloads. To keep data between visits, ask Portal to add export and import.";
export const PREVIEW_NOTES = Object.freeze([PREVIEW_CONTROLS_NOTE, PREVIEW_UNCONFIRMED_NOTE, PREVIEW_RUNNING_NOTE,
PREVIEW_SCRIPT_NOTE, PREVIEW_MISSING_NOTE, PREVIEW_EARLIER_NOTE, PREVIEW_STOPPED_NOTE, PREVIEW_UNFINISHED_NOTE,
- PREVIEW_INCOMPLETE_NOTE, PREVIEW_CONTINUE_NOTE]);
+ PREVIEW_INCOMPLETE_NOTE, PREVIEW_CONTINUE_NOTE, PREVIEW_STORAGE_NOTE]);
// The combined reply is host verification text (ingress limit: 32 KiB). Leave
// room for the extension and progress-lane notes that can follow it.
diff --git a/ods/extensions/services/pixel-agent/plugin/preview-interaction-assurance.mjs b/ods/extensions/services/pixel-agent/plugin/preview-interaction-assurance.mjs
index 203c9662c..be1d7f101 100644
--- a/ods/extensions/services/pixel-agent/plugin/preview-interaction-assurance.mjs
+++ b/ods/extensions/services/pixel-agent/plugin/preview-interaction-assurance.mjs
@@ -37,6 +37,23 @@ export function requestsVisibilityInteraction(text) {
});
}
+// The owner wants the page's data to outlast a reload or a later visit. Portal
+// shows previews with an opaque origin, in its card and in a new tab alike
+// (the relay's CSP sandbox), so storage reads and writes throw and a guarded
+// page keeps its data only in memory. No check can establish it (Workstation06,
+// 2026-10-27: "make the ticks survive a page reload" ended "Everything checks out").
+const KEEPS = /\b(?:survives?|surviving|keeps?|kept|saves?|saved|stores?|stored|retains?|retained|remembers?|remembered|persists?|persisted)\b/i;
+const LATER = /\b(?:reloads?|reloading|refresh(?:es|ed|ing)?|restarts?|sessions?|visits?|re-?open(?:s|ed|ing)?|clos(?:e|es|ed|ing)|come\s+back|tomorrow|next\s+time)\b/i;
+export function requestsReloadPersistence(text) {
+ return String(text ?? '').split(/[!?;\n]+|\.(?=\s|$)/).some(clause => {
+ if (/^\s*(?:please\s+)?(?:do\s+not|don['’]t|never|avoid|skip|explain|describe|example)\b/i.test(clause) ||
+ /\b(?:do\s+not|don['’]t|never|without|no)\s+(?:use\s+)?(?:any\s+)?(?:local\s*storage|session\s*storage|indexed\s*db|persistence)\b/i.test(clause)) return false;
+ return /\b(?:local|session)\s*storage\b|\bindexed\s*db\b|\bpersist(?:ent|ence)\b/i.test(clause) ||
+ /\bremembers?\s+(?:my|our|your|their|the|them|it|everything|all)\b/i.test(clause) ||
+ (KEEPS.test(clause) && LATER.test(clause));
+ });
+}
+
// The owner's own wording of a requested show/hide change, used only to name
// the likely affected element and control in an inspection's corrective steps
// (laptop round 100: the model asserted the button and a post-click class,
diff --git a/ods/extensions/services/pixel-agent/plugin/tool-loop-guard.mjs b/ods/extensions/services/pixel-agent/plugin/tool-loop-guard.mjs
index 9e7f23e79..3d8f24047 100644
--- a/ods/extensions/services/pixel-agent/plugin/tool-loop-guard.mjs
+++ b/ods/extensions/services/pixel-agent/plugin/tool-loop-guard.mjs
@@ -50,12 +50,13 @@ import { PREVIEW_INSPECTION_TOOL, requestsVisibilityInteraction, requestsBehavio
boundInspectionPageErrors, boundInspectionControls, boundRenderedPreviewInspection, renderedInspectionInstruction,
pageErrorRepairInstruction, visibilityInspectionMatches,
visibilityInspectionInstruction, requestedVisibilityTransition, inheritedVisibilityTransition,
- attemptedPreviewBehavior, boundPreviewBehavior, previewBehaviorInstruction, unassertedBehaviorStep } from './preview-interaction-assurance.mjs';
+ attemptedPreviewBehavior, boundPreviewBehavior, previewBehaviorInstruction, unassertedBehaviorStep,
+ requestsReloadPersistence } from './preview-interaction-assurance.mjs';
import { workspaceRevalidationCandidate, workspaceReadOnlyCall, settledRevalidationReceipt, boundedPreviewVerification } from "./preview-revalidation.mjs";
import { boundedPreviewDelivery } from './preview-delivery-recovery.mjs';
import { PREVIEW_CONTINUE_NOTE, PREVIEW_EARLIER_NOTE, PREVIEW_INCOMPLETE_NOTE, PREVIEW_MISSING_NOTE, PREVIEW_SCRIPT_NOTE,
- PREVIEW_STOPPED_NOTE, PREVIEW_UNFINISHED_NOTE, announcesMoreWork, explainedPreviewDelivery, ownerPreviewText,
- previewCheckNote } from './preview-explanation.mjs';
+ PREVIEW_STOPPED_NOTE, PREVIEW_STORAGE_NOTE, PREVIEW_UNFINISHED_NOTE, announcesMoreWork, explainedPreviewDelivery,
+ ownerPreviewText, previewCheckNote } from './preview-explanation.mjs';
import { extractRequestedLiterals, requestedTextCheck, requestedTextInstruction, requestedTextRevisionInstruction,
requestedTextDeliveryNote, publishedElementOutline, extractRequestedControlNames, requestedControlSources,
requestedControlNameCheck, requestedControlNameInstruction, requestedControlNameRevisionInstruction,
@@ -10910,6 +10911,9 @@ export function createToolLoopGuard({
inheritedVisibility.sessionKey === state.currentSessionKey && inheritedVisibility.ownerIntent === ownerIntent;
state.workspaceVisibilityInteractionRequired = workspacePreviewInspectionAvailable &&
state.workspacePreviewRequired && (requestsVisibilityInteraction(ownerLaneText(ownerIntent)) || inheritsVisibility);
+ // Read only where a published preview's outcome is built, so it needs no
+ // preview gate of its own; it adds Portal's storage line and gates nothing.
+ state.workspaceReloadPersistenceRequested = requestsReloadPersistence(ownerLaneText(ownerIntent));
// Checked only against a successful publication; never gates publishing.
state.requestedLiterals = extractRequestedLiterals(ownerIntent);
// Checked only against a browser inspection's load-time names.
@@ -14149,11 +14153,11 @@ export function createToolLoopGuard({
kind: "ods-pixel-workspace-preview",
...state.workspacePreview,
},
- }, {text, rest: receipt, note: status === "passed" ? undefined : previewCheckNote({
+ }, {text, rest: receipt, note: [status === "passed" ? undefined : previewCheckNote({
pending: status === "pending", testFailed: checkStatus === "failed", missing: Boolean(requestedTextMissing),
pageErrors: visibilityInspectionMatches(state.workspaceInspectionPageErrors, state.workspacePreview),
controls: interactionUnverified || behaviorUnverified,
- })});
+ }), state.workspaceReloadPersistenceRequested && PREVIEW_STORAGE_NOTE].filter(Boolean).join("\n\n") || undefined});
}
if (state.exactDownloadRequested) {
const terminalText = exactDownloadTerminalText(state.exactDownloadTerminalOutcome);
diff --git a/ods/extensions/services/pixel-agent/tests/preview_explanation_delivery.test.mjs b/ods/extensions/services/pixel-agent/tests/preview_explanation_delivery.test.mjs
index 1290fbc55..549f90f0e 100644
--- a/ods/extensions/services/pixel-agent/tests/preview_explanation_delivery.test.mjs
+++ b/ods/extensions/services/pixel-agent/tests/preview_explanation_delivery.test.mjs
@@ -24,7 +24,7 @@ import {PREVIEW_INSPECTION_TOOL} from '../plugin/preview-interaction-assurance.m
import {INSPECTION_KIND, PAINT_INSPECTION_SCOPE, PRESS_INSPECTION_SCOPE, STEP_INSPECTION_SCOPE, createWorkspacePreviewInspectTool,
inspectionPlanHash} from '../plugin/workspace-preview-inspect.mjs';
import {PREVIEW_CONTINUE_NOTE, PREVIEW_CONTROLS_NOTE, PREVIEW_EARLIER_NOTE, PREVIEW_MISSING_NOTE, PREVIEW_NOTES,
- PREVIEW_RUNNING_NOTE, PREVIEW_SCRIPT_NOTE, PREVIEW_STOPPED_NOTE, PREVIEW_UNCONFIRMED_NOTE, explainedPreviewDelivery,
+ PREVIEW_RUNNING_NOTE, PREVIEW_SCRIPT_NOTE, PREVIEW_STOPPED_NOTE, PREVIEW_STORAGE_NOTE, PREVIEW_UNCONFIRMED_NOTE, explainedPreviewDelivery,
foldedText, openFence, ownerPreviewText, previewCheckNote} from '../plugin/preview-explanation.mjs';
import {DELIVERY_NOTES} from '../../dashboard/src/lib/portalDeliveryNotes.js';
@@ -342,6 +342,21 @@ test('passing checks keep the appended delivery: the receipt alone, without the
`${EXPLANATION}\n\n${delivery.text}\n${SCOPE}`);
});
+test('a request to keep data across reloads gets Portal\'s storage line, whatever the checks or the reply say', async () => {
+ // Workstation06 (2026-10-27): the reply to "make the ticks survive a page reload" was "Everything checks out", but
+ // Portal shows previews with an opaque origin, in its card and in a new tab, so the page keeps its data only in memory.
+ const prompt = `${OWNER} Also make the best score survive a page reload.`;
+ const passed = await elfTurn({painted: true, prompt, reply: 'Everything checks out: the score now survives a reload.'});
+ assert.equal(passed.delivery.status, 'passed');
+ assert.equal(passed.delivery.text, `${PREVIEW_STORAGE_NOTE}\n\n${receiptText(passed.preview)}`);
+ const failed = await elfTurn({prompt});
+ assert.equal(failed.delivery.status, 'failed');
+ assert.equal(failed.delivery.text, `${PREVIEW_CONTROLS_NOTE}\n\n${PREVIEW_STORAGE_NOTE}\n\n${receiptText(failed.preview)}`);
+ assert.doesNotMatch(failed.delivery.text, ALARM);
+ const plain = await elfTurn({painted: true});
+ assert.equal(plain.delivery.text, receiptText(plain.preview), 'no storage line without the request');
+});
+
test('a still-running check keeps the explanation and says the checks were still running', async () => {
const pending = ({invoke}) => invoke('exec', {command: 'python3 -m unittest -v', background: true},
{details: {status: 'running', sessionId: 'elf-check-session'}});
diff --git a/ods/extensions/services/pixel-agent/tests/preview_interaction_assurance.test.mjs b/ods/extensions/services/pixel-agent/tests/preview_interaction_assurance.test.mjs
index 1847bb3c9..64e8a2a91 100644
--- a/ods/extensions/services/pixel-agent/tests/preview_interaction_assurance.test.mjs
+++ b/ods/extensions/services/pixel-agent/tests/preview_interaction_assurance.test.mjs
@@ -3,7 +3,7 @@ import assert from 'node:assert/strict';
import {createHash} from 'node:crypto';
import {createToolLoopGuard, userMessageRequestsWorkspaceVerificationContinuation, WORKSPACE_PREVIEW_COMPLETE_REASON} from '../plugin/tool-loop-guard.mjs';
import {PREVIEW_INSPECTION_TOOL, PAGE_ERROR_REPAIR_INSTRUCTION, requestsVisibilityInteraction, requestsBehaviorPreservation, boundVisibilityInspection,
- boundStaticPreviewInspection} from '../plugin/preview-interaction-assurance.mjs';
+ boundStaticPreviewInspection, requestsReloadPersistence} from '../plugin/preview-interaction-assurance.mjs';
import {INSPECTION_KIND, INSPECTION_SCOPE, inspectionPlanHash, normalizeWorkspacePreviewInspectionParams, createWorkspacePreviewInspectTool} from '../plugin/workspace-preview-inspect.mjs';
import {PREVIEW_STORAGE_DISCLOSURE} from '../plugin/workspace-preview.mjs';
@@ -178,6 +178,28 @@ test('visibility gate only requests checks supported by the installed capability
}
});
+test('a request for data that outlasts a reload or a later visit is recognized, and nothing else is',()=>{
+ // Workstation06 visitor round 2 (2026-10-27) and the owner phrasings Portal sees for stateful pages.
+ for(const text of [
+ 'In the habit tracker, make the ticks survive a page reload, and add a way to delete a habit.',
+ 'Build a to-do list that saves my tasks so they are still there next time.',
+ 'Keep the scores after a refresh.',
+ 'It should remember my books.',
+ 'Store the settings in localStorage.',
+ 'The list must be persistent.',
+ 'Make the notes persist between sessions.',
+ ]) assert.equal(requestsReloadPersistence(text),true,text);
+ for(const text of [
+ 'Build a reading list as a new project: I add books with their author, mark them read, and filter between read and unread.',
+ 'Add a refresh button that reloads the quotes.',
+ 'Save the file as index.html.',
+ 'Remember to add a delete button.',
+ 'Do not use localStorage.',
+ 'Build it without any local storage.',
+ 'Reload the page and check the counter.',
+ ]) assert.equal(requestsReloadPersistence(text),false,text);
+});
+
test('static page contents beside form controls do not request show/hide inspection',()=>{
const prompt='Create a tiny reading-list webpage in a new Playground/fleet-reading-list folder. It should show the title Fleet Reading List, a text box for a book title, and an Add book button that adds the title to the visible list. Save it as index.html, publish a workspace preview, and give me the preview link. Keep everything local; no external services.';
for (const text of [prompt,