Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,45 @@ try {
research_reading: "case", research_analysis_goal: child.goal_id, research_pack: studyPack.pack_id});
address.hash = "case-section-" + studyPack.pack_id + "-" + chapter.id;
const atChapter = () => page.waitForFunction(id => document.activeElement?.id === id, address.hash.slice(1));
await page.goto(address.href);
await atChapter();
const views = page.getByRole("group", {name: "研究视图", exact: true});
const historyView = views.getByRole("button", {name: "研究历程", exact: true});
const caseView = views.getByRole("button", {name: "案例解读", exact: true});
const ordinary = new URL(study);
const fullAxis = page.locator('.research-timeline .research-axis time.is-end[datetime="PT64800S"]');
await page.goto(ordinary.href);
await fullAxis.waitFor();
await caseView.waitFor();
assert.equal(await historyView.getAttribute("aria-pressed"), "true");
assert.equal(await page.locator(".research-case-reader").count(), 0);
assert.equal(new URL(page.url()).searchParams.has("research_reading"), false);
await caseView.press("Enter");
await page.locator(".case-opening h2").waitFor();
await page.goBack();
await fullAxis.waitFor();

await page.setViewportSize({width: 390, height: 900});
const historyGet = url => url.pathname === "/api/chat/explore-results"
&& url.searchParams.get("goal_id") === child.goal_id && url.searchParams.get("view") === "history";
await page.route(historyGet, route => route.fulfill({status: 503, json: {ok: false}}), {times: 1});
await page.goto(ordinary.href);
const historyError = page.locator(".research-history-read-error");
await historyError.waitFor();
await caseView.waitFor();
assert.equal(await historyView.getAttribute("aria-pressed"), "true");
await historyError.getByRole("button", {name: "重试", exact: true}).press("Enter");
await fullAxis.waitFor();
assert.equal(await page.evaluate(() => document.documentElement.scrollWidth > innerWidth), false);

const caseOnly = await start("case-only", {...child, events: []}, parent);
await page.goto(caseOnly);
await page.locator(".case-opening h2").waitFor();
assert.equal(await caseView.getAttribute("aria-pressed"), "true");
const caseOnlyReadback = await (await fetch(new URL("/fixture/readback", caseOnly))).json();
assert(caseOnlyReadback.history_reads > 0 && caseOnlyReadback.source_unchanged);
await page.setViewportSize({width: 1200, height: 900});

await page.goto(address.href);
await atChapter();
assert.equal(await caseView.getAttribute("aria-pressed"), "true");
await historyView.press("Enter");
await page.locator(".research-history-heading").waitFor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,88 @@
"goal_id": "synthetic-case-search",
"parent_goal_id": "synthetic-benchmark",
"display_name": "Search · Case 研究",
"events": [],
"events": [
{
"schema_version": "loopx_explore_result_event_v0",
"goal_id": "synthetic-case-search",
"event_kind": "node",
"recorded_at": "2026-11-21T01:00:00Z",
"title": "Can an early candidate satisfy both checks?",
"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
},
"agent_id": "synthetic-researcher",
"result_id": "history-start",
"node_kind": "question",
"status": "open",
"event_id": "b12628df1f9fcc7c"
},
{
"schema_version": "loopx_explore_result_event_v0",
"goal_id": "synthetic-case-search",
"event_kind": "finding",
"recorded_at": "2026-11-21T02:00:00Z",
"title": "Early probe missed the second check",
"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
},
"agent_id": "synthetic-researcher",
"result_id": "ruled-out-probe",
"node_id": "history-start",
"status": "refuted",
"event_id": "c4c1d855090973bd"
},
{
"schema_version": "loopx_explore_result_event_v0",
"goal_id": "synthetic-case-search",
"event_kind": "node",
"recorded_at": "2026-11-21T17:00:00Z",
"title": "Does the retained candidate cover both cases?",
"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
},
"agent_id": "synthetic-researcher",
"result_id": "history-end",
"node_kind": "question",
"status": "open",
"event_id": "969d2846d7e02569"
},
{
"schema_version": "loopx_explore_result_event_v0",
"goal_id": "synthetic-case-search",
"event_kind": "finding",
"recorded_at": "2026-11-21T19:00:00Z",
"title": "Retained candidate covered both cases",
"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
},
"agent_id": "synthetic-researcher",
"result_id": "recorded-outcome",
"node_id": "history-end",
"status": "confirmed",
"event_id": "da42d4af65d99f3a"
}
],
"analyses": [
{
"title": "初版解读",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export function GoalResearchHistory({goalId, originalGoalId = goalId, preferHist
};
const [caseMode, setCaseReading] = useState(readCaseMode);
const requestedCase = caseMode.goalId === goalId ? caseMode.requested : null;
const caseReading = requestedCase ?? !preferHistory;
const hasCases = (analysis.snapshot?.catalog.packs ?? []).some(pack => pack.case_study_summary);
// A link to a particular version stays in the case reader even when that
// version has no study. An unpinned visit can fall back to ordinary history.
Expand Down Expand Up @@ -521,7 +520,9 @@ export function GoalResearchHistory({goalId, originalGoalId = goalId, preferHist
</Fragment> : null;
const emptyHistoryMessage = zh ? "这个 Goal 尚无研究历程" : "No research history for this Goal yet";
const selectedStrategy = hasNativeSource && !emptySourceHistory ? strategies.selection : null;
const readingCase = caseReading && caseViewAvailable && (requestedCase === true || selectedStrategy === null);
// An unaddressed local visit can open its saved case once its own history is confirmed empty.
const readingCase = caseViewAvailable && (requestedCase === true
|| requestedCase === null && !hasNativeSource && openedHistorySource === historySource && emptyHistory);
const alternateReading = readingCase ? <ResearchCaseReading analysis={analysis} active={active}/>
: selectedStrategy !== null ? <GoalSourceStrategies key={strategies.scope} goalId={goalId} originalGoalId={originalGoalId}
sourceUrl={readSourceUrl} zh={zh} selection={selectedStrategy}
Expand Down
Loading