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
3 changes: 3 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ jobs:
run: bunx vitest run --maxWorkers=4 tests/directFormalizationEvidence.test.ts tests/directFormalizationWorkflow.test.ts tests/formalizationCoverage.test.ts tests/formalizationAudit.test.ts tests/formalizationContext.test.ts tests/formalizationPackagesWarmup.test.ts tests/mathProofEnvironmentSeed.test.ts tests/webFormalizationAuditWorker.test.ts tests/webFormalizationBackgroundReview.test.ts tests/webBackgroundReview.test.ts tests/webFormalizationProgress.test.ts tests/webThinkingProcess.test.ts tests/codexSessionInstructions.test.ts
- run: bun run build && bun run build:web
- run: bunx playwright install --with-deps chromium
- name: Verify proof progress in the default simple reading
timeout-minutes: 5
run: bun scripts/test-web-proof-thinking.ts --simple-reading
- name: Verify the browser's login and research flows with local fixtures
run: bun run test:web-login && bun run test:web-natural-first && bun run test:web-chat-session && bun run test:web-chat-cancel-recovery && bun run test:web-key-memory && bun run test:web-saved-key && bun run test:web-solve-process && bun run test:web-review-regressions && bun run test:web-plan-recovery && bun run test:web-plan-ownership && bun run test:web-explain && bun run test:web-explain-recovery
- name: Verify research account switching and interrupted frontend operations
Expand Down
24 changes: 23 additions & 1 deletion apps/web/i18n/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export const process: Record<string, string> = {
"平台检查": "Host check",
"平台检查 {0}": "Host check {0}",
"自查通过": "The self-check passed",
"源码预检失败": "Source precheck failed",
"Lean 环境或工具出错": "Lean environment or tool error",
// The independent acceptance
"没有进行独立验收": "No independent acceptance was run",
"在干净环境里重新检查完整原题": "Rechecking the whole problem in a clean environment",
Expand All @@ -75,13 +77,33 @@ export const process: Record<string, string> = {
"在路线图中查看": "Open in the roadmap",
"在路线图中查看这项任务": "Open this task in the roadmap",
"指导这项任务": "Guide this task",
"成员任务": "Member assignment",
"等待派工启动": "Waiting for dispatch",
"准备工作区": "Preparing the workspace",
"推进中,已有发现": "In progress, findings recorded",
"推进中,尚无发现记录": "In progress, no findings recorded yet",
"已暂停并保留任务": "Paused, assignment retained",
"等待写入停止": "Waiting for writes to stop",
"宿主正在检查交付": "Host is checking the delivery",
"交付检查未通过": "Delivery check failed",
"已采纳": "Adopted",
"交付已核验": "Delivery checked",
"交付证据未记录": "Delivery evidence unavailable",
"研究已返回": "Research findings returned",
"已返回,成果未记录": "Returned with no result recorded",
"任务失败": "Task failed",
"会话已中断": "Session interrupted",
"任务已取消": "Task canceled",
"当前 Lean 陈述": "Current Lean statement",
"当前候选": "Current candidate",
"复制片段": "Copy excerpt",
"下载片段": "Download excerpt",
"源码片段": "Source excerpt",
"下载失败,请重试。": "Download failed. Please try again.",
"这份文件在这次检查之后又改过,Lean 指出的行可能已经移动。": "This file changed after the check, so the lines Lean names may have moved.",
"Lean 诊断与版本": "Lean diagnostics and version",
"待证目标": "Proof goal",
"检查环境": "Check environment",
"诊断产物": "Diagnostic artifact",
"这次检查的文件没有单独保存,下面是任务当前的文件。": "This check kept no file of its own; below is the task's current file.",
"文件较长,后面的部分没有保存。": "The file is long; the rest was not saved.",
"另有 {0} 条消息对不上这份文件的行": "{0} more messages do not match lines of this file",
Expand Down
2 changes: 2 additions & 0 deletions docs/solver-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ Lead 的三个自动检索目标先覆盖当前证据排序的首选路线,剩

M5 在 typed helper 的当前源码投影完成后、正式分配和模型调用前执行同一预检。仅完整查询自身的明确类型或解析错误记为 `invalid`,阻塞该接口并给 Lead 精确反馈,不增加模型尝试数或数学失败数。heartbeat、递归深度、内部异常、IO 和未分类错误不判无效,也不缓存。尚不存在的引理依赖、不支持的局部作用域、输入变化和不完整错误记为 `deferred`;工具或环境不可用记为 `unavailable`,均允许原流程继续。当前查询未重建的活动 `set_option`(包括 `maxHeartbeats` / `maxRecDepth`)保守 defer。预检等待期间其他独立任务仍能分配,宿主不将其误报为路线空闲。

若 Lean 报某个限定名不存在,而本题冻结库快照将该名称列为尚未导入模块的公开声明,且模块摘要与题目回执一致,预检记为 `deferred` 并给出具体的 `import`。成员仍须在候选源码中加入所需导入并通过证明检查。拼错的名称、仅在其他库找到的名称及已导入后仍存在的这类错误继续记为 `invalid`。

预检仅在当前运行进程和同一真实 worker 项目根内复用,最多保留 64 条实际检查结果,绑定合同、依赖、完整源码和配置、实际工具、环境、作用域及调用方原有预算。缓存存取复制结果,避免其他调用方修改缓存记录;命中前及调用方等待后都核对原诊断产物仍存在且摘要匹配,产物损坏或丢失会重新检查。检查点里的结果只用于解释;恢复后重新检查。等待结束会再次核对任务、canonical、worker 角色及归属、路线、模型准入和原预算,过期结果不会派发。`Infinity` 原样保持,不新增解题截止时间。嵌套类型副本直接绑定同一固定依赖根并核对环境身份,不回退到陈旧的 worker package link。

类型展开成功后,只有完整证明擦除投影、模块顺序和映射、查询命令及其余合同和环境输入完全相同时,后续证明体修改才可复用该成功结果。投影摘要和实际副本写入共用同一构造函数;本次原始源码仍形成新的输入摘要并完整核对当前性。原 artifact 保持原样,另用 `projectionReuse` 记录原检查输入、原源码、本次源码和共同投影摘要,不生成新的 Lean 回执。无效类型仍只复用完全相同的原始输入;投影索引随原检查结果一起淘汰,连续证明修改不会增加保留结果数。该复用仅省去重复的 advisory 类型展开,不提供任何证明验收。
Expand Down
2 changes: 1 addition & 1 deletion scripts/test-web-discovery-invites.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ try {
phase = `task-discovery-${width}`; await page.goto(`${origin}/library.html?${entry}`);
const discovery = page.locator('[data-library-discovery]'); await discovery.waitFor();
await discovery.getByRole('heading', { name: tx('这一步已有的前提', 'Premises recorded for this step'), exact: true }).waitFor();
assert.ok(await discovery.locator('.katex').count(), 'Task formulas render as mathematics');
await discovery.locator('.katex').first().waitFor();
assert.equal(await page.locator('[data-library-environment]').inputValue(), 'target');
await page.locator(`[data-library-match="${standard.id}"]`).waitFor();
assert.equal(await page.locator(`[data-library-match="${mathlib.id}"]`).count(), 0, 'Mathlib asset stays outside the standard task environment');
Expand Down
19 changes: 13 additions & 6 deletions scripts/test-web-proof-thinking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { webLimits, type WebAgentAction, type WebAgentActionBody, type WebEventD
import { extendTrajectory, recordedTrajectory, trajectoryPage } from '../apps/web/trajectory';
import { proofOutline } from '../apps/web/verificationKit';
import { taskVersion } from '../src/solver/tasks';
import { webCheckedLeanFixture } from '../tests/helpers/webCheckedLeanFixture';
import { audit } from './web-a11y';
import { freePort, preferFullCollaboration, settled } from './web-scenario';
import { openChatResultDetails } from './web-ui-controls';
Expand Down Expand Up @@ -563,10 +564,13 @@ try {
touch(); summary('engineer', 'proof-summary', copy.engineerSummary, true);
touch(); run.artifact = { source: failedSource, workerId: 'engineer', status: 'candidate', capturedAt: run.updatedAt };
action({ workerId: 'engineer', itemId: 'proof-check-1', kind: 'command', phase: 'completed', status: 'failed', exitCode: 1,
command: 'theorem-os check-lean --file Submission.lean', output: checkOutput, lean: { passed: false, messages: [
command: 'theorem-os check-lean --file Submission.lean', output: checkOutput, lean: webCheckedLeanFixture(failedSource, false, [
{ severity: 'warning', line: 4, text: warning }, { severity: 'error', line: 5, column: 9, text: diagnostic },
] } });
]) });
await page.goto(`${origin}/?chat=${conversation.id}`, { timeout: 0 });
const resultDetails = page.locator('[data-chat-result-more]');
assert.equal(await resultDetails.getAttribute('open'), null, 'Simple reading starts with proof progress folded');
await openChatResultDetails(page);
await contains(copy.engineerSummary.split('\n')[1]!); await failedCheck.waitFor(); await settled(page);
assert.equal(await detail(), null, 'A new browser has made no choice');
assert.equal(await thinking.getAttribute('data-detail'), 'simple', 'A new browser reads the conversation in 简洁');
Expand Down Expand Up @@ -628,7 +632,10 @@ try {
assert.equal(await group.count(), 1); assert.equal(await group.locator(':scope > details').getAttribute('open'), null, 'Returning to 简洁 folds again');
assert.equal(await failedCheck.getAttribute('open'), null); assert.equal(await brief.count(), 1);
assert.equal(await process.getAttribute('open'), null);
await page.reload({ timeout: 0 }); await failedCheck.waitFor(); await settled(page);
await page.reload({ timeout: 0 });
assert.equal(await resultDetails.getAttribute('open'), null, 'Reloading simple reading folds proof progress again');
await openChatResultDetails(page);
await failedCheck.waitFor(); await settled(page);
assert.equal(await thinking.getAttribute('data-detail'), 'simple', 'The choice survives a refresh');

// A long task shows its latest twelve rows; the rest is one click away.
Expand Down Expand Up @@ -1454,9 +1461,9 @@ try {
action({ workerId: 'engineer', itemId: 'public-commentary', kind: 'message', textSource: 'commentary', phase: 'completed', status: 'done', text: copy.commentary });
run.artifact = { source: failedSource, workerId: 'engineer', status: 'candidate', capturedAt: run.updatedAt };
action({ workerId: 'engineer', itemId: 'proof-check-1', kind: 'command', phase: 'completed', status: 'failed', exitCode: 1,
command: 'theorem-os check-lean --file Submission.lean', output: checkOutput, lean: { passed: false, messages: [
command: 'theorem-os check-lean --file Submission.lean', output: checkOutput, lean: webCheckedLeanFixture(failedSource, false, [
{ severity: 'error', line: 5, column: 9, text: diagnostic }, { severity: 'warning', line: 4, text: warning }, { severity: 'info', line: 5, text: info },
] } });
]) });
await contains(copy.commentary);
assert.equal(await thinking.locator('[data-thinking-work="research"][data-thinking-task="research"]').count(), 1,
'A matching delivery replaces the same task version\'s finding instead of repeating it');
Expand All @@ -1480,7 +1487,7 @@ try {
diff: '@@ -4,2 +4,4 @@\n theorem ui_fixture_add_identity (n : Nat) : n + 0 = n ∧ 0 + n = n := by\n- exact Nat.add_zero n\n+ constructor\n+ · exact Nat.add_zero n\n+ · exact Nat.zero_add n' }] });
run.artifact = { source: correctedSource, workerId: 'engineer', status: 'candidate', capturedAt: run.updatedAt };
action({ workerId: 'engineer', itemId: 'proof-check-2', kind: 'command', phase: 'completed', status: 'done', exitCode: 0,
command: 'theorem-os check-lean --file Submission.lean', output: 'Synthetic check passed. No Lean process ran.', lean: { passed: true, messages: [] } });
command: 'theorem-os check-lean --file Submission.lean', output: 'Synthetic check passed. No Lean process ran.', lean: webCheckedLeanFixture(correctedSource, true) });
await contains(copy.revision.split('\n')[1]!);
const passedCheck = thinking.locator('[data-thinking-detail="check:p:engineer:proof-check-2"]');
await page.waitForFunction(source => document.querySelector('[data-thinking-detail="check:p:engineer:proof-check-2"] .thinking-source pre code')?.textContent === source, correctedSource);
Expand Down
8 changes: 5 additions & 3 deletions scripts/test-web-solve-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type { WebRunner } from '../apps/web/runner';
import type { WorkerFormalizationInput, WorkerFormalizationMessage } from '../apps/web/formalizationTypes';
import type { WorkerInput, WorkerMessage } from '../apps/web/shared';
import { localeStorageKey } from '../apps/web/i18n';
import { webCheckedLeanFixture } from '../tests/helpers/webCheckedLeanFixture';
import { webFormalizationEvidence, webFormalizationStatement } from '../tests/helpers/webFormalizationFixture';
import { audit } from './web-a11y';
import { deferred, freePort, settled, startBrowser } from './web-scenario';
Expand Down Expand Up @@ -44,11 +45,12 @@ const runner: WebRunner = {
progress('research_action', '直接求解', { workerId: 'solver', operation: 'direct' });
await sleep(20);
progress('turn_started', '第 1 轮', { workerId: 'solver', turn: 1 });
// The Agent's file is saved as a candidate before it checks it, so the check arrives with the source Lean named its error in.
send({ type: 'artifact', artifact: { source: statement, workerId: 'solver', capturedAt: new Date().toISOString(), status: 'candidate' } } as WorkerMessage);
const checkedText = statement.replace('sorry', 'unknown_tactic');
send({ type: 'artifact', artifact: { source: checkedText, workerId: 'solver', capturedAt: new Date().toISOString(), status: 'candidate' } } as WorkerMessage);
action({ workerId: 'solver', itemId: '1:c1', phase: 'started', kind: 'command', status: 'running', command: "theorem-os check-lean --file 'Submission.lean'" });
action({ workerId: 'solver', itemId: '1:c1', phase: 'completed', kind: 'command', status: 'failed', exitCode: 1,
command: "theorem-os check-lean --file 'Submission.lean'", output: 'error: unknown tactic', lean: lean(false, 2) });
command: "theorem-os check-lean --file 'Submission.lean'", output: 'error: unknown tactic',
lean: webCheckedLeanFixture(checkedText, false, [{ severity: 'error', line: 2, text: 'unknown tactic' }]) });
progress('proof_check_started', 'Lean 检查', { workerId: 'solver', turn: 1 });
const held = deferred(); releaseRun = held.resolve;
await Promise.race([held.promise, new Promise<void>(resolve => signal.addEventListener('abort', () => resolve(), { once: true }))]);
Expand Down
2 changes: 1 addition & 1 deletion src/solver/cooperation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ export class CooperativeResearch extends CooperationInputs {
projectRoot: project,
// A family type never names its own members, which do not exist in source until they are proved.
dependencies: this.dependencies(task).map(item => item.task).filter(input => input.familyMember !== task.id), environmentDigest: environment,
env: workerAccess.environment, signal,
env: workerAccess.environment, installedLibrary: workerAccess.installedLibrary, signal,
timeoutMs: this.input.timeoutMs ?? Infinity }) : {
result: { status: 'unavailable', inputDigest: mathDigest(canonicalMathJson([taskDigest, environment, 'worker-environment-unavailable'])),
taskDigest, reason: 'worker-environment-unavailable', evidence: 'advisory-type-elaboration', proofAcceptance: 'not-assessed' },
Expand Down
Loading
Loading