diff --git a/apps/presentation/dashboard/smoke/execution-feedback-browser-smoke.mjs b/apps/presentation/dashboard/smoke/execution-feedback-browser-smoke.mjs new file mode 100644 index 0000000000..20719c1b31 --- /dev/null +++ b/apps/presentation/dashboard/smoke/execution-feedback-browser-smoke.mjs @@ -0,0 +1,98 @@ +// The same native Explore records cross HTTP, client decoding and both readers. +// Fault injection changes only transport; source state and authority stay intact. +import assert from "node:assert/strict"; +import {mkdir} from "node:fs/promises"; +import {resolve} from "node:path"; +import {startHistoryOwner} from "../../../../examples/personal-workspace-browser/research-history.mjs"; +import {launchBrowser, loadPlaywright} from "../../../../examples/dashboard-browser-smoke-support.mjs"; + +const root = resolve(import.meta.dirname, "../../../.."); +const output = resolve(root, ".local/feedback-qualification"); +await mkdir(output, {recursive: true}); +const missing = process.env.LOOPX_FEEDBACK_EXPECT_MISSING === "1"; +const browser = await launchBrowser(loadPlaywright().chromium); +try { + for (const provider of ["file", "sqlite"]) { + const owner = await startHistoryOwner(resolve(root, "apps/presentation/dashboard/src/data/fixtures/execution-feedback-readback.json"), + {provider, assetsDir: process.env.LOOPX_FEEDBACK_ASSETS}); + const page = await browser.newPage({viewport: {width: 1280, height: 900}, locale: "zh-CN"}); + let corrupt = false; + try { + await page.addInitScript(() => localStorage.setItem("loopx-pw-locale", "zh-CN")); + await page.route("**/api/chat/explore-results?*", async route => { + if (!corrupt || new URL(route.request().url()).searchParams.get("view") !== "findings") return route.continue(); + const response = await route.fetch(), packet = await response.json(); + const changed = packet.items.find(item => item.execution_observation); + changed.execution_observation.result_candidate_sha256 = "b".repeat(64); + return route.fulfill({response, json: packet}); + }); + const url = new URL("/chat/", owner.base); + url.search = new URLSearchParams({goalId: "feedback-readback", view: "research", research_goal: "feedback-readback", + research_reading: "history", research_node: "method-choice", research_finding: "result-11"}); + await page.goto(url.href); + const saved = page.locator(".research-saved-evidence"); + await saved.waitFor(); + const capturePrefix = missing ? "before" : "after"; + await page.screenshot({path: resolve(output, `${capturePrefix}-${provider}-default-desktop.png`), animations: "disabled"}); + await page.setViewportSize({width: 390, height: 844}); + assert(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1), "Narrow default page has no horizontal overflow"); + await page.screenshot({path: resolve(output, `${capturePrefix}-${provider}-default-mobile.png`), animations: "disabled"}); + await page.setViewportSize({width: 1280, height: 900}); + await saved.locator(":scope > summary").click(); + const evidence = saved.locator(".goal-explore-results"); + const reader = evidence.locator(".goal-team-result-reader"); + await reader.waitFor(); + const observation = reader.locator("details").filter({has: page.locator("summary", {hasText: "实际执行与资源观测"})}); + if (missing) { + assert.equal(await observation.count(), 0, "Baseline saved findings discarded execution observations"); + await reader.scrollIntoViewIfNeeded(); + await page.screenshot({path: resolve(output, `before-${provider}-desktop.png`), animations: "disabled"}); + continue; + } + assert.equal(await observation.count(), 1); + assert.equal(await observation.getAttribute("open"), null, "Execution detail stays on demand"); + await observation.locator(":scope > summary").click(); + const text = await observation.innerText(); + assert.match(text, /broad-search → targeted-check/); + assert.match(text, /counterexample ruled out/); + assert.match(text, /12\.5 \/ 60/); + assert.match(text, /未测量/); + assert.match(text, /input-v1/); + assert.match(text, /artifact:negative-result/); + assert.match(text, /不等于方法有效/); + await observation.scrollIntoViewIfNeeded(); + await observation.screenshot({path: resolve(output, `after-${provider}-detail.png`), animations: "disabled"}); + await page.screenshot({path: resolve(output, `after-${provider}-desktop.png`), animations: "disabled"}); + await page.screenshot({path: resolve(output, `after-${provider}-full-page.png`), fullPage: true, animations: "disabled"}); + await page.setViewportSize({width: 390, height: 844}); + await observation.scrollIntoViewIfNeeded(); + assert(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1), "Narrow reader has no horizontal overflow"); + await page.screenshot({path: resolve(output, `after-${provider}-mobile.png`), animations: "disabled"}); + // A taller reading viewport keeps the complete narrow detail visible in + // the guide image; the real 390x844 viewport remains qualified above. + await page.setViewportSize({width: 390, height: 1400}); + await observation.scrollIntoViewIfNeeded(); + await observation.screenshot({path: resolve(output, `after-${provider}-mobile-detail.png`), animations: "disabled"}); + await page.setViewportSize({width: 390, height: 844}); + await evidence.getByRole("combobox", {name: "选择结论"}).selectOption("result-0"); + assert.equal(await observation.count(), 0, "Missing observation adds no invented execution block"); + await evidence.getByRole("combobox", {name: "选择结论"}).selectOption("result-11"); + corrupt = true; + await evidence.getByRole("button", {name: "刷新证据"}).click(); + await evidence.getByRole("alert").waitFor(); + assert.equal(await reader.count(), 0, "Wrong-candidate evidence cannot leave old facts visible"); + corrupt = false; + await evidence.getByRole("button", {name: "刷新证据"}).click(); + await reader.waitFor(); + assert.equal(await observation.count(), 1, "Valid source recovers in place"); + const history = page.locator(".research-history-detail"); + const historicObservation = history.locator("details").filter({has: page.locator("summary", {hasText: "实际执行与资源观测"})}); + await historicObservation.first().locator(":scope > summary").click(); + assert.match(await historicObservation.first().innerText(), /broad-search → targeted-check/, "Append-only history shares the same reader"); + const readback = await (await fetch(`${owner.base}/fixture/readback`)).json(); + assert.equal(readback.source_unchanged, true); + assert.equal(readback.mutation_attempts, 0); + console.log(`${provider}: HTTP -> saved/history reader, missing/rejected/recovery, desktop/narrow PASS`); + } finally {await page.close(); await owner.close();} + } +} finally {await browser.close();} diff --git a/apps/presentation/dashboard/src/data/chat.ts b/apps/presentation/dashboard/src/data/chat.ts index 451aaebd1e..74c2172e4c 100644 --- a/apps/presentation/dashboard/src/data/chat.ts +++ b/apps/presentation/dashboard/src/data/chat.ts @@ -1,3 +1,4 @@ +import {normalizeExploreExecutionObservation} from "../../../../../loopx/control_plane/capabilities/explore_execution_observation.js"; import {normalizeWorkYardstickCapture} from "../../../../../loopx/control_plane/work_items/yardstick_decision.js"; import {sourceReadApiUrl} from "./local-status-query"; import type {OracleEvidence} from "./goal-acceptance-observation"; @@ -3354,6 +3355,7 @@ const exploreResultPageSchema = z.object({ evidence_refs: z.array(z.string()), last_updated_at: z.string(), measurements: z.unknown().transform(value => normalizeExploreMeasurements(value)).optional(), measurement_error: z.string().optional(), + execution_observation: z.unknown().transform(observation => normalizeExploreExecutionObservation({observation})).optional(), work_yardstick: z.unknown().transform(capture => normalizeWorkYardstickCapture({capture})).optional(), linked_todos_available: z.boolean().optional(), linked_todos: z.array(z.object({ diff --git a/apps/presentation/dashboard/src/data/fixtures/execution-feedback-readback.json b/apps/presentation/dashboard/src/data/fixtures/execution-feedback-readback.json new file mode 100644 index 0000000000..74e2c7121f --- /dev/null +++ b/apps/presentation/dashboard/src/data/fixtures/execution-feedback-readback.json @@ -0,0 +1,331 @@ +{ + "goal_id": "feedback-readback", + "display_name": "Method feedback", + "events": [ + { + "schema_version": "loopx_explore_result_event_v0", + "goal_id": "feedback-readback", + "event_kind": "node", + "recorded_at": "2026-01-01T00:00:00Z", + "title": "Compare a method and its actual execution", + "boundary": { + "raw_task_text_recorded": false, + "raw_logs_recorded": false, + "raw_trajectory_recorded": false, + "raw_session_transcript_recorded": false, + "credential_values_recorded": false, + "absolute_paths_recorded": false + }, + "summary": "Read the recorded method, deviation and result; acceptance stays independent.", + "result_id": "method-choice", + "node_kind": "area", + "status": "open", + "event_id": "8b0bf5d2d23f9d6f" + }, + { + "schema_version": "loopx_explore_result_event_v0", + "goal_id": "feedback-readback", + "event_kind": "finding", + "recorded_at": "2026-01-01T00:01:00Z", + "title": "Observation 0", + "boundary": { + "raw_task_text_recorded": false, + "raw_logs_recorded": false, + "raw_trajectory_recorded": false, + "raw_session_transcript_recorded": false, + "credential_values_recorded": false, + "absolute_paths_recorded": false + }, + "summary": "A negative result remains negative. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable.", + "agent_id": "reader-agent", + "evidence_refs": [ + "artifact:negative-result" + ], + "result_id": "result-0", + "node_id": "method-choice", + "status": "refuted", + "event_id": "fe63a49692bf13ca" + }, + { + "schema_version": "loopx_explore_result_event_v0", + "goal_id": "feedback-readback", + "event_kind": "finding", + "recorded_at": "2026-01-01T00:02:00Z", + "title": "Observation 1", + "boundary": { + "raw_task_text_recorded": false, + "raw_logs_recorded": false, + "raw_trajectory_recorded": false, + "raw_session_transcript_recorded": false, + "credential_values_recorded": false, + "absolute_paths_recorded": false + }, + "summary": "A negative result remains negative. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable.", + "agent_id": "reader-agent", + "evidence_refs": [ + "artifact:negative-result" + ], + "result_id": "result-1", + "node_id": "method-choice", + "status": "refuted", + "event_id": "4a83ea109c7241d1" + }, + { + "schema_version": "loopx_explore_result_event_v0", + "goal_id": "feedback-readback", + "event_kind": "finding", + "recorded_at": "2026-01-01T00:03:00Z", + "title": "Observation 2", + "boundary": { + "raw_task_text_recorded": false, + "raw_logs_recorded": false, + "raw_trajectory_recorded": false, + "raw_session_transcript_recorded": false, + "credential_values_recorded": false, + "absolute_paths_recorded": false + }, + "summary": "A negative result remains negative. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable.", + "agent_id": "reader-agent", + "evidence_refs": [ + "artifact:negative-result" + ], + "result_id": "result-2", + "node_id": "method-choice", + "status": "refuted", + "event_id": "28ab31ca7421ba95" + }, + { + "schema_version": "loopx_explore_result_event_v0", + "goal_id": "feedback-readback", + "event_kind": "finding", + "recorded_at": "2026-01-01T00:04:00Z", + "title": "Observation 3", + "boundary": { + "raw_task_text_recorded": false, + "raw_logs_recorded": false, + "raw_trajectory_recorded": false, + "raw_session_transcript_recorded": false, + "credential_values_recorded": false, + "absolute_paths_recorded": false + }, + "summary": "A negative result remains negative. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable.", + "agent_id": "reader-agent", + "evidence_refs": [ + "artifact:negative-result" + ], + "result_id": "result-3", + "node_id": "method-choice", + "status": "refuted", + "event_id": "42dd1e21cfdfd704" + }, + { + "schema_version": "loopx_explore_result_event_v0", + "goal_id": "feedback-readback", + "event_kind": "finding", + "recorded_at": "2026-01-01T00:05:00Z", + "title": "Observation 4", + "boundary": { + "raw_task_text_recorded": false, + "raw_logs_recorded": false, + "raw_trajectory_recorded": false, + "raw_session_transcript_recorded": false, + "credential_values_recorded": false, + "absolute_paths_recorded": false + }, + "summary": "A negative result remains negative. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable.", + "agent_id": "reader-agent", + "evidence_refs": [ + "artifact:negative-result" + ], + "result_id": "result-4", + "node_id": "method-choice", + "status": "refuted", + "event_id": "f6e4e52febefe975" + }, + { + "schema_version": "loopx_explore_result_event_v0", + "goal_id": "feedback-readback", + "event_kind": "finding", + "recorded_at": "2026-01-01T00:06:00Z", + "title": "Observation 5", + "boundary": { + "raw_task_text_recorded": false, + "raw_logs_recorded": false, + "raw_trajectory_recorded": false, + "raw_session_transcript_recorded": false, + "credential_values_recorded": false, + "absolute_paths_recorded": false + }, + "summary": "A negative result remains negative. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable.", + "agent_id": "reader-agent", + "evidence_refs": [ + "artifact:negative-result" + ], + "result_id": "result-5", + "node_id": "method-choice", + "status": "refuted", + "event_id": "437d3b06c356a3e4" + }, + { + "schema_version": "loopx_explore_result_event_v0", + "goal_id": "feedback-readback", + "event_kind": "finding", + "recorded_at": "2026-01-01T00:07:00Z", + "title": "Observation 6", + "boundary": { + "raw_task_text_recorded": false, + "raw_logs_recorded": false, + "raw_trajectory_recorded": false, + "raw_session_transcript_recorded": false, + "credential_values_recorded": false, + "absolute_paths_recorded": false + }, + "summary": "A negative result remains negative. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable.", + "agent_id": "reader-agent", + "evidence_refs": [ + "artifact:negative-result" + ], + "result_id": "result-6", + "node_id": "method-choice", + "status": "refuted", + "event_id": "e351ef2cb007f74e" + }, + { + "schema_version": "loopx_explore_result_event_v0", + "goal_id": "feedback-readback", + "event_kind": "finding", + "recorded_at": "2026-01-01T00:08:00Z", + "title": "Observation 7", + "boundary": { + "raw_task_text_recorded": false, + "raw_logs_recorded": false, + "raw_trajectory_recorded": false, + "raw_session_transcript_recorded": false, + "credential_values_recorded": false, + "absolute_paths_recorded": false + }, + "summary": "A negative result remains negative. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable.", + "agent_id": "reader-agent", + "evidence_refs": [ + "artifact:negative-result" + ], + "result_id": "result-7", + "node_id": "method-choice", + "status": "refuted", + "event_id": "8517c1d3e3b15aea" + }, + { + "schema_version": "loopx_explore_result_event_v0", + "goal_id": "feedback-readback", + "event_kind": "finding", + "recorded_at": "2026-01-01T00:09:00Z", + "title": "Observation 8", + "boundary": { + "raw_task_text_recorded": false, + "raw_logs_recorded": false, + "raw_trajectory_recorded": false, + "raw_session_transcript_recorded": false, + "credential_values_recorded": false, + "absolute_paths_recorded": false + }, + "summary": "A negative result remains negative. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable.", + "agent_id": "reader-agent", + "evidence_refs": [ + "artifact:negative-result" + ], + "result_id": "result-8", + "node_id": "method-choice", + "status": "refuted", + "event_id": "bf7613aaa94c7698" + }, + { + "schema_version": "loopx_explore_result_event_v0", + "goal_id": "feedback-readback", + "event_kind": "finding", + "recorded_at": "2026-01-01T00:10:00Z", + "title": "Observation 9", + "boundary": { + "raw_task_text_recorded": false, + "raw_logs_recorded": false, + "raw_trajectory_recorded": false, + "raw_session_transcript_recorded": false, + "credential_values_recorded": false, + "absolute_paths_recorded": false + }, + "summary": "A negative result remains negative. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable.", + "agent_id": "reader-agent", + "evidence_refs": [ + "artifact:negative-result" + ], + "result_id": "result-9", + "node_id": "method-choice", + "status": "refuted", + "event_id": "e2e4af3af1a5b077" + }, + { + "schema_version": "loopx_explore_result_event_v0", + "goal_id": "feedback-readback", + "event_kind": "finding", + "recorded_at": "2026-01-01T00:11:00Z", + "title": "Observation 10", + "boundary": { + "raw_task_text_recorded": false, + "raw_logs_recorded": false, + "raw_trajectory_recorded": false, + "raw_session_transcript_recorded": false, + "credential_values_recorded": false, + "absolute_paths_recorded": false + }, + "summary": "A negative result remains negative. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable.", + "agent_id": "reader-agent", + "evidence_refs": [ + "artifact:negative-result" + ], + "result_id": "result-10", + "node_id": "method-choice", + "status": "refuted", + "event_id": "9025be02e1a9ab01" + }, + { + "schema_version": "loopx_explore_result_event_v0", + "goal_id": "feedback-readback", + "event_kind": "finding", + "recorded_at": "2026-01-01T00:12:00Z", + "title": "Recorded method change", + "boundary": { + "raw_task_text_recorded": false, + "raw_logs_recorded": false, + "raw_trajectory_recorded": false, + "raw_session_transcript_recorded": false, + "credential_values_recorded": false, + "absolute_paths_recorded": false + }, + "summary": "A negative result remains negative. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable. The same long scope boundary remains readable.", + "agent_id": "reader-agent", + "evidence_refs": [ + "artifact:negative-result" + ], + "result_id": "result-11", + "node_id": "method-choice", + "status": "refuted", + "execution_observation": { + "candidate_sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "change_reason": "The counterexample ruled out the planned search.", + "elapsed_seconds": 12.5, + "evidence_refs": [ + "artifact:negative-result" + ], + "executed_method_id": "targeted-check", + "input_revision": "input-v1", + "limit_seconds": 60, + "planned_method_id": "broad-search", + "result_candidate_sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "result_ref": "artifact:negative-result", + "schema_version": "explore_execution_observation_v0", + "search_iterations": null, + "stop_reason": null + }, + "event_id": "686464f745c278cf" + } + ] +} diff --git a/apps/presentation/dashboard/src/features/personal-workspace/goal-explore-results.tsx b/apps/presentation/dashboard/src/features/personal-workspace/goal-explore-results.tsx index 9df6dead1e..f4028eae3b 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/goal-explore-results.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/goal-explore-results.tsx @@ -1,4 +1,4 @@ -import {WorkYardstickReadback} from "./work-yardstick-readback"; +import {ExecutionObservationReadback, WorkYardstickReadback} from "./work-yardstick-readback"; import {exploreFindingCopy} from "./explore-finding-copy"; import {useEffect, useRef, useState} from "react"; import {AlertTriangle, ChevronRight, RefreshCw} from "lucide-react"; @@ -153,6 +153,7 @@ export function GoalExploreResults({goalId, originalGoalId = goalId, zh, active : null)} : null} :

{selected.summary}

} + {selected.execution_observation ? : null} {selected.work_yardstick ? : null} {related.length ?
{zh ? "同一候选的其他测量(本页)" : "Other measurements of this candidate (this page)"} diff --git a/apps/presentation/dashboard/src/features/personal-workspace/goal-research-history.tsx b/apps/presentation/dashboard/src/features/personal-workspace/goal-research-history.tsx index 9196a2180a..e695ca134a 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/goal-research-history.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/goal-research-history.tsx @@ -1,4 +1,4 @@ -import {WorkYardstickReadback} from "./work-yardstick-readback"; +import {ExecutionObservationReadback, WorkYardstickReadback} from "./work-yardstick-readback"; import {GoalSourceStrategies, useGoalStrategyLocation} from "./goal-source-strategies"; import {exploreFindingCopy} from "./explore-finding-copy"; import {AlertCircle, ArrowLeft, ArrowRight, Circle, CircleHelp, FlaskConical, GitBranch, RefreshCw, Search} from "lucide-react"; @@ -183,19 +183,7 @@ export function GoalResearchHistory({goalId, originalGoalId = goalId, preferHist :

{finding.summary}

; }; const findingBody = (finding: ExploreHistoryEvent) => { - const execution = finding.execution_observation; - const measured = (value: unknown) => value === null ? (zh ? "未测量" : "Not measured") : String(value); - return <>{finding.measurements ? : null}{findingNarrative(finding)}{finding.work_yardstick ? : null}{execution ?
{zh ? "实际执行与资源观测" : "Execution and resource observations"}

{zh ? "来源记录的执行观测;不等于方法有效或当前候选已通过验收。" : "Source-recorded execution observations; not proof of method benefit or current-candidate acceptance."}

-
-
{zh ? "计划方法 → 实际方法" : "Planned → executed method"}
{String(execution.planned_method_id)} → {String(execution.executed_method_id)}
- {execution.change_reason ? <>
{zh ? "改向原因" : "Reason for change"}
{String(execution.change_reason)}
: null} -
{zh ? "运行秒数 / 上限秒数" : "Elapsed / limit seconds"}
{measured(execution.elapsed_seconds)} / {measured(execution.limit_seconds)}
-
{zh ? "搜索次数" : "Search iterations"}
{measured(execution.search_iterations)}
-
{zh ? "结束原因" : "Termination reason"}
{measured(execution.stop_reason)}
-
{zh ? "执行候选 SHA-256" : "Executed candidate SHA-256"}
{String(execution.candidate_sha256)}
- {execution.result_ref ? <>
{zh ? "该候选的结果引用" : "Result for this candidate"}
{String(execution.result_ref)}
: null} -
-
: null}; + return <>{finding.measurements ? : null}{findingNarrative(finding)}{finding.work_yardstick ? : null}{finding.execution_observation ? : null}; }; const findingMeta = (finding: ExploreHistoryEvent) => {timeLabel(finding.recorded_at)} · {stateLabel(finding.status)}{finding.confidence !== null ? ` · ${zh ? "来源自报置信度" : "Source-reported confidence"} ${finding.confidence}` : ""}; const findingElement = (finding: ExploreHistoryEvent) => { diff --git a/apps/presentation/dashboard/src/features/personal-workspace/work-yardstick-readback.tsx b/apps/presentation/dashboard/src/features/personal-workspace/work-yardstick-readback.tsx index 017cc0b494..aa5108cd6c 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/work-yardstick-readback.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/work-yardstick-readback.tsx @@ -22,3 +22,24 @@ export function WorkYardstickReadback({capture, zh}: {capture: WorkYardstickCapt

{zh ? "这是记录者的研究判断;代理有效性与成果验收仍需独立证据。" : "This records the author's research decision; proxy fidelity and outcome acceptance still require independent evidence."}

; } + +/** Both current findings and append-only history read the same recorded facts. */ +export function ExecutionObservationReadback({observation, zh}: { + observation: import("../../../../../../loopx/control_plane/runtime_decode.js").JsonObject; zh: boolean; +}) { + const measured = (value: unknown) => value === null ? (zh ? "未测量" : "Not measured") : String(value); + return
+ {zh ? "实际执行与资源观测" : "Execution and resource observations"} +
+
{zh ? "计划方法 → 实际方法" : "Planned → executed method"}
{String(observation.planned_method_id)} → {String(observation.executed_method_id)}
+ {observation.change_reason ? <>
{zh ? "改向原因" : "Reason for change"}
{String(observation.change_reason)}
: null} +
{zh ? "运行秒数 / 上限秒数" : "Elapsed / limit seconds"}
{measured(observation.elapsed_seconds)} / {measured(observation.limit_seconds)}
+
{zh ? "搜索次数" : "Search iterations"}
{measured(observation.search_iterations)}
+
{zh ? "结束原因" : "Termination reason"}
{measured(observation.stop_reason)}
+
{zh ? "输入版本" : "Input revision"}
{String(observation.input_revision)}
+
{zh ? "执行候选 SHA-256" : "Executed candidate SHA-256"}
{String(observation.candidate_sha256)}
+ {observation.result_ref ? <>
{zh ? "该候选的结果引用" : "Result for this candidate"}
{String(observation.result_ref)}
: null} +
+

{zh ? "来源记录的执行观测;不等于方法有效或当前候选已通过验收。" : "Source-recorded execution observations; not proof of method benefit or current-candidate acceptance."}

+
; +} diff --git a/docs/architecture/rfcs/mechanism-convergence-and-learning-loop-v0.md b/docs/architecture/rfcs/mechanism-convergence-and-learning-loop-v0.md index e422ebb68c..e081d47f37 100644 --- a/docs/architecture/rfcs/mechanism-convergence-and-learning-loop-v0.md +++ b/docs/architecture/rfcs/mechanism-convergence-and-learning-loop-v0.md @@ -353,6 +353,24 @@ read-only quota observation. It admits no ordinary host Turn. These service checks therefore do not qualify an ordinary PostgreSQL feedback Turn or justify adding another execution profile to this slice. +**Source checkpoint: product execution-observation readback (2026-11-19).** Saved +findings reuse Explore's execution-observation codec and retain the planned and +actual methods, deviation reason, candidate revision, costs and result reference. +The findings and history readers share one expandable view; the existing Lark +finding Summary presents the same recorded facts, keeping missing measurements +unknown. Findings without observations retain their existing display and +projection. Wrong-candidate result references are rejected, failed reads withhold +old contents, and valid sources recover in place. Isolated File/SQLite HTTP and +packaged desktop/narrow-browser checks qualify these paths without source-state +or execution-authority mutations. This delivers product transport and readback, +with an [illustrated App reading guide](../../../loopx/capabilities/explore/README.md#read-execution-evidence-in-the-app) +and separate default desktop/narrow and expanded-detail captures from populated +synthetic records. The guide also identifies the older saved-reader omission; +installed-client upgrade/readback remains unqualified. This source checkpoint is +not model adoption or method benefit. Execution convergence, cross-task adoption, +prediction calibration and matched-budget outcomes remain open. Formal evaluation +does not block independent implementation or migration. + **Source checkpoint: stateless read ownership (2026-11-20).** The stateless capture adapter delegates its normal-work initial navigation to the existing TypeScript Progressive owner through `context_select`; Python retains publication, byte diff --git a/docs/architecture/rfcs/mechanism-convergence-and-learning-loop-v0.zh-CN.md b/docs/architecture/rfcs/mechanism-convergence-and-learning-loop-v0.zh-CN.md index 21b8ca41b2..64f895a09d 100644 --- a/docs/architecture/rfcs/mechanism-convergence-and-learning-loop-v0.zh-CN.md +++ b/docs/architecture/rfcs/mechanism-convergence-and-learning-loop-v0.zh-CN.md @@ -329,6 +329,19 @@ Mapping 拒绝顺序、精确整数 IO、会话 ID 解码、轮询时钟及 pend host Turn。因此这些服务检查不能取得普通 PostgreSQL 反馈 Turn 资格, 也不构成本切片新增执行 profile 的理由。 +**源码 checkpoint:产品执行观察读回(2026-11-19)。** 已保存结论现在复用 +Explore 的执行观察 codec,保留原方法、实际方法、改向原因、候选版本、成本和 +结果引用。结论页与历史页复用同一展开式读回;现有 Lark finding Summary 同步 +展示这些源事实,缺失测量保持未知。没有执行观察的结论保持原展示与投影,错误 +候选结果关联被拒绝,失效读取不能留下旧内容,有效来源可在原页面重试。 +隔离 File/SQLite HTTP 和打包浏览器检查覆盖这些路径及桌面/窄屏,读回不改变源 +状态或执行权限。这只交付产品传输与读回,包含 +[App 图示读回指南](../../../loopx/capabilities/explore/README.md#read-execution-evidence-in-the-app), +并用填充的合成记录分别捕获默认桌面/窄屏和展开详情。指南也说明旧保存结论读回 +遗漏的识别方式;已安装客户端的升级与读回仍未资格化。此源码 checkpoint +不证明模型采用或方法收益;执行融合、 +跨任务采用、预测校准与可比预算结果仍开放。正式评测不阻塞独立的实现和迁移。 + **源码 checkpoint:无会话读回所有权(2026-11-20)。** 无会话捕获适配器通过 `context_select` 将正常工作初始导航交给既有 TypeScript Progressive owner, Python 保留发布、字节预算与 fallback。仅用于本次调用的选项保留通用选择及其 diff --git a/examples/personal-workspace-browser/research-history-backend.py b/examples/personal-workspace-browser/research-history-backend.py index 2e5cfac03b..c5b9daac45 100644 --- a/examples/personal-workspace-browser/research-history-backend.py +++ b/examples/personal-workspace-browser/research-history-backend.py @@ -48,6 +48,7 @@ def materialize_analysis(source_root: Path, analysis: dict) -> Path: def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--port", type=int, default=0) + parser.add_argument("--provider", choices=("file", "sqlite"), default="sqlite") parser.add_argument("--assets-dir", type=Path, help="Frozen packaged UI for before/after inspection.") parser.add_argument("--fixture", type=Path, action="append", help="Captured-event wrapper; repeat for independently selectable Goals.") @@ -92,7 +93,7 @@ def main(): log.parent.mkdir(parents=True) log.write_bytes("".join(json.dumps(event, ensure_ascii=False) + "\n" for event in capture["events"]).encode("utf-8")) initialize_canonical_authority(runtime, captured_goal, build_todo_runtime_shadow_projection( - goal_id=captured_goal, todos=capture.get("todos", []), handoff_mode="soft_claim"), state_path=state, provider="sqlite") + goal_id=captured_goal, todos=capture.get("todos", []), handoff_mode="soft_claim"), state_path=state, provider=args.provider) original.update({path: path.read_bytes() for path in (state, log)}) registry = root / "registry.json" registry.write_text(json.dumps({"schema_version": 1, "common_runtime_root": str(runtime), "goals": goals})) diff --git a/examples/personal-workspace-browser/research-history.mjs b/examples/personal-workspace-browser/research-history.mjs index 5a1d21abf3..bb1fb78a6d 100644 --- a/examples/personal-workspace-browser/research-history.mjs +++ b/examples/personal-workspace-browser/research-history.mjs @@ -94,11 +94,11 @@ function comparisonReadback() { return snapshot; } -export async function startHistoryOwner(fixture, {workspaceDirectory = false} = {}) { +export async function startHistoryOwner(fixture, {workspaceDirectory = false, provider = "sqlite", assetsDir} = {}) { const fixtures = Array.isArray(fixture) ? fixture : fixture ? [fixture] : []; const backendCommand = testPythonCommand(` import runpy -sys.argv = ${JSON.stringify(["examples/personal-workspace-browser/research-history-backend.py", ...fixtures.flatMap(path => ["--fixture", path]), ...(workspaceDirectory ? ["--workspace-directory"] : [])])} +sys.argv = ${JSON.stringify(["examples/personal-workspace-browser/research-history-backend.py", ...fixtures.flatMap(path => ["--fixture", path]), "--provider", provider, ...(assetsDir ? ["--assets-dir", assetsDir] : []), ...(workspaceDirectory ? ["--workspace-directory"] : [])])} runpy.run_path(sys.argv[0], run_name="__main__") `); const child = spawn(backendCommand.command, backendCommand.args, diff --git a/loopx/capabilities/explore/README.md b/loopx/capabilities/explore/README.md index 0717063e07..ed0c98a38d 100644 --- a/loopx/capabilities/explore/README.md +++ b/loopx/capabilities/explore/README.md @@ -16,6 +16,48 @@ When the observed execution used the finding's tested input revision, result attachments can bind it once and select the evidence to reuse. Readback and standalone observations keep the complete observation form. [Execution evidence authoring](../../../docs/reference/protocols/explore-result-from-path-delta-v0.md#execution-evidence-on-the-same-input) +## Read execution evidence in the App + +Open a Goal's **Research / 研究** view, select its question in the history, +then expand **Read saved findings / 阅读已保存的结论** and select the finding. Expand +**Actual execution and resource observations / 实际执行与资源观测** to compare +the planned and executed methods, read the change reason, elapsed time and +limit, iterations, stop reason, and the input, candidate and result references. +The history detail uses the same reader. + +![Research history and saved evidence entry](assets/execution-feedback-entry.png) + +Keep execution detail closed while browsing conclusions; open it when checking +whether a result belongs to the intended execution. The example below records +a change from `broad-search` to `targeted-check`. Its elapsed time is measured, +while the iteration count is unknown. **Not measured / 未测量** stays unknown; +a finding without an observation has no execution detail. A rejected response +shows an error and hides stale result facts; use **Refresh evidence / 刷新证据** +after the source or transport is repaired. + +![Execution detail with measured and unknown values](assets/execution-feedback-detail.png) + +On a narrow screen, references wrap within the reader. The same controls and +unknown-value distinctions remain available. + +![Execution evidence on a narrow screen](assets/execution-feedback-narrow.png) + +These illustrations use synthetic findings with a packaged App and isolated +SQLite backend. Reading evidence does not run a method or enable a capability. +Recorded execution alone does not prove model adoption, method effectiveness, +or an independently accepted outcome. + +### A saved finding has no execution detail + +First check whether that finding's source actually records an observation. +Omission is valid and must not be replaced with guessed values. Older App +builds can also omit recorded observations in saved findings while retaining +them in research history. If the same source has execution detail in history +but the saved finding looks like this earlier reader, update the App and +refresh the evidence. Updating a reader does not execute the method again. + +![Earlier saved-finding reader omitting recorded execution detail](assets/execution-feedback-legacy-reader.png) + ## Quantitative findings An ordinary result attachment can include `measurements`, saved on its existing diff --git a/loopx/capabilities/explore/assets/execution-feedback-detail.png b/loopx/capabilities/explore/assets/execution-feedback-detail.png new file mode 100644 index 0000000000..7ccfaf3fee Binary files /dev/null and b/loopx/capabilities/explore/assets/execution-feedback-detail.png differ diff --git a/loopx/capabilities/explore/assets/execution-feedback-entry.png b/loopx/capabilities/explore/assets/execution-feedback-entry.png new file mode 100644 index 0000000000..f4b01f6e7b Binary files /dev/null and b/loopx/capabilities/explore/assets/execution-feedback-entry.png differ diff --git a/loopx/capabilities/explore/assets/execution-feedback-legacy-reader.png b/loopx/capabilities/explore/assets/execution-feedback-legacy-reader.png new file mode 100644 index 0000000000..bcadc3c938 Binary files /dev/null and b/loopx/capabilities/explore/assets/execution-feedback-legacy-reader.png differ diff --git a/loopx/capabilities/explore/assets/execution-feedback-narrow.png b/loopx/capabilities/explore/assets/execution-feedback-narrow.png new file mode 100644 index 0000000000..508d2c0ff3 Binary files /dev/null and b/loopx/capabilities/explore/assets/execution-feedback-narrow.png differ diff --git a/loopx/extensions/lark/presentation/explore_record_values.py b/loopx/extensions/lark/presentation/explore_record_values.py index f6577a2f3e..66be419650 100644 --- a/loopx/extensions/lark/presentation/explore_record_values.py +++ b/loopx/extensions/lark/presentation/explore_record_values.py @@ -63,7 +63,7 @@ def _finding_summary(finding: Mapping[str, Any]) -> str: summary = str(finding.get("summary") or "") capture = finding.get("work_yardstick") if not isinstance(capture, Mapping): - return summary + return "\n".join(part for part in (summary, _execution_summary(finding)) if part) # Projection only: the canonical event/typed owner has validated this # declaration. A Lark row does not upgrade it to acceptance or authority. decision = capture["decision"] @@ -78,7 +78,34 @@ def _finding_summary(finding: Mapping[str, Any]) -> str: if decision["counterevidence_refs"]: details.append("Proxy counterevidence: " + ", ".join(decision["counterevidence_refs"])) details.append("Recorded research decision; fidelity and acceptance remain independently assessed.") - return "\n".join([summary, *details]) + recorded = "\n".join([summary, *details]) + execution = _execution_summary(finding) + return recorded + ("\n" + execution if execution else "") + + +def _execution_summary(finding: Mapping[str, Any]) -> str: + observation = finding.get("execution_observation") + if not isinstance(observation, Mapping): + return "" + # These source facts were validated by Explore. Missing quantities remain + # unknown; the projection neither certifies adoption nor assesses utility. + def measured(field: str) -> str: + value = observation[field] + return "not measured" if value is None else str(value) + details = [ + f"Planned -> executed method: {observation['planned_method_id']} -> {observation['executed_method_id']}", + f"Elapsed / limit seconds: {measured('elapsed_seconds')} / {measured('limit_seconds')}", + f"Search iterations: {measured('search_iterations')}", + f"Termination reason: {measured('stop_reason')}", + f"Input revision: {observation['input_revision']}", + f"Executed candidate SHA-256: {observation['candidate_sha256']}", + ] + if observation.get("change_reason"): + details.append(f"Reason for change: {observation['change_reason']}") + if observation.get("result_ref"): + details.append(f"Result for this candidate: {observation['result_ref']}") + details.append("Source-recorded execution; method benefit and acceptance remain independently assessed.") + return "\n".join(details) def _finding_record_values(finding: Mapping[str, Any], *, goal_id: str, source_id: str) -> dict[str, Any]: diff --git a/tests/test_chat_explore_results.py b/tests/test_chat_explore_results.py index e77ed30250..6472f52c75 100644 --- a/tests/test_chat_explore_results.py +++ b/tests/test_chat_explore_results.py @@ -301,3 +301,74 @@ def observe(operation, params): server.shutdown() worker.join(timeout=5) server.server_close() + + +@pytest.mark.parametrize("provider", ["file", "sqlite"]) +def test_execution_feedback_survives_http_and_lark_readback_after_disable(tmp_path, monkeypatch, provider): + """Recorded method deviations remain visible without certifying benefit.""" + from tests.control_plane.canonical_authority_fixture import initialize_canonical_authority, isolate_sqlite_runtime + from loopx.control_plane.coordination.runtime_shadow import build_todo_runtime_shadow_projection + from loopx.extensions.lark.presentation.explore_record_values import _finding_record_values + + isolate_sqlite_runtime(tmp_path, monkeypatch) + state = tmp_path / "active.md" + state.write_text("# Read-only feedback\n") + runtime = tmp_path / "runtime" + registry = tmp_path / "registry.json" + registry.write_text(json.dumps({"common_runtime_root": str(runtime), "goals": [ + {"id": "feedback", "repo": str(tmp_path), "state_file": state.name}, + ]})) + initialize_canonical_authority(runtime, "feedback", build_todo_runtime_shadow_projection( + goal_id="feedback", todos=[], handoff_mode="soft_claim"), state_path=state, provider=provider) + observation = { + "schema_version": "explore_execution_observation_v0", "candidate_sha256": "a" * 64, + "input_revision": "input-v1", "planned_method_id": "broad-search", + "executed_method_id": "targeted-check", "change_reason": "A counterexample ruled out broad search.", + "elapsed_seconds": 12.5, "limit_seconds": 60, "search_iterations": None, "stop_reason": None, + "evidence_refs": ["artifact:negative-result"], "result_ref": "artifact:negative-result", + "result_candidate_sha256": "a" * 64, + } + log = explore_result_log_path(runtime, "feedback") + append_explore_result_event(log, build_explore_node_event( + goal_id="feedback", node_id="choice", title="Method choice")) + for finding_id, observed in (("plain", None), ("changed", observation)): + append_explore_result_event(log, build_explore_finding_event( + goal_id="feedback", node_id="choice", finding_id=finding_id, + title="Recorded negative result", summary="No measured improvement.", status="refuted", + execution_observation=observed, evidence_refs=["artifact:negative-result"])) + from loopx.control_plane.effect_runtime import EffectRuntimeRejected + with pytest.raises(EffectRuntimeRejected, match="executed candidate"): + build_explore_finding_event(goal_id="feedback", node_id="choice", finding_id="bad", + title="Wrong candidate", execution_observation={**observation, "result_candidate_sha256": "b" * 64}) + before = {path: path.read_bytes() for path in (log, state, registry)} + server = ChatHTTPServer(("127.0.0.1", 0), ChatRequestHandler) + server.registry_path, server.runtime_root_override, server.verbose = registry, None, False + worker = threading.Thread(target=server.serve_forever, daemon=True) + worker.start() + try: + # Explore is never activated: already saved evidence remains readable. + with urlopen(f"http://127.0.0.1:{server.server_port}/api/chat/explore-results?goal_id=feedback&view=findings") as response: + page = json.load(response) + changed = next(row for row in page["items"] if row["finding_id"] == "changed") + plain = next(row for row in page["items"] if row["finding_id"] == "plain") + assert changed["execution_observation"] == observation + assert changed["status"] == "refuted" + assert "execution_observation" not in plain + for row in (plain, changed): + lark = _finding_record_values(row, goal_id="feedback", source_id="fixture") + assert lark["Status"] == "refuted" + assert lark["LoopX Result ID"] == row["finding_id"] + if row is plain: + assert lark["Summary"] == "No measured improvement." + else: + assert "broad-search -> targeted-check" in lark["Summary"] + assert "12.5 / 60" in lark["Summary"] + assert "Search iterations: not measured" in lark["Summary"] + assert "Termination reason: not measured" in lark["Summary"] + assert "artifact:negative-result" in lark["Summary"] + assert "independently assessed" in lark["Summary"] + assert all(path.read_bytes() == contents for path, contents in before.items()) + finally: + server.shutdown() + worker.join(timeout=5) + server.server_close()