Repository navigation
Conversation
…itOutcome and tool counts (ThinkFlowLab#449)
david6666666
left a comment
There was a problem hiding this comment.
75/100,建议修改后复审(非表决)(范围 3、正确性 2、验证 2、主张证据 2、简洁度 3)。区分工具已返回、等待条件已满足、还有 job 在跑,这个方向对。但现在业务层按校验后的时长执行,记录层却重新读原始参数。CLI transport 收到数字字符串时,业务模型会把它转成正数,记录层却按 0 秒写成 satisfied=true。因此等待到期仍可能显示成普通的“仍有任务运行”。建议复用已校验的查询参数,加一条 transport → 保存 → 重开回归。
下载并解码了 17 秒录像和两张中英文图,三个 blob 都与证据提交一致,能看见五条记录的分类。实录是作者标注的较早版本,不把它当成本 SHA 独立跑通。当前 Release 的 Python、浏览器、macOS、CodeQL 和 DSH 均绿;Windows 桌面任务 在 runtime 准备阶段报 spawnSync uv ENOENT,不是本次等待断言失败,也不是绿灯。
Dot,代表 @david6666666。
| return None | ||
| kind = arguments.get('type') | ||
| raw_wait = arguments.get('waitSeconds', 0) | ||
| wait_seconds = raw_wait if isinstance(raw_wait, (int, float)) and not isinstance(raw_wait, bool) and raw_wait >= 0 else 0 |
There was a problem hiding this comment.
这里用的是 transport 原始参数,不是 Query 校验后的值。waitSeconds: "1" 会被业务层转成 1 秒,但这里落到 0 秒;全未终态时,本来未满足的等待会被记成 satisfied=true。请让记录使用同一份校验结果,并补数字字符串与数字的落盘/重开对照。
There was a problem hiding this comment.
Addressed in d3490c73: extracted shared parse_query() in tools.py, validated query calls once in ToolGateway.execute(), derived ToolResult.wait_outcome directly from that validated JobStatusQuery/CanvasStatusQuery instance (and forwarded the normalized query dict to AgentTools.execute()), and updated cli_transport.py to consume outcome.wait_outcome directly (with standalone wait_outcome() also validating via JobStatusQuery/CanvasStatusQuery). Added numeric-string vs numeric assertions in tests/test_wait_outcome.py and a full cli_transport -> ToolGateway -> agent.py save -> fresh create_app reopen comparison test (test_cli_transport_wait_outcome_persists_identically_for_numeric_string_and_number_across_reopen).
david6666666
left a comment
There was a problem hiding this comment.
90/100,非表决(范围 3、正确性 3、验证 3、主张证据 2、简洁度 3)。上一轮行内问题已解决:waitOutcome 取校验后的 Query,而不是 transport 的原始时长;老的 transport fallback 也按同一模型解析。新增回归让 "1" 和 1 走 CLI → 保存 → fresh app 重开,得到相同的等待时长和未满足状态。
同 SHA Release 已全绿,Windows 也通过;CodeQL / DSH 通过。我核对了增量和测试断言,没有自行启动 OpenDirector。此前下载的双语录像仍是较早版本,只作界面分类的佐证;新边界由当前回归覆盖。
Dot,代表 @david6666666。Coordinator: 由仓库授权角色核对合入。
Summary
Follow-up fix to #681 addressing the
waitOutcomeand execution-record count edge cases raised in review (#681#pullrequestreview-6192347681):Record requested wait mode, duration, and satisfaction from the validated
Query(tools.py,gateway.py,cli_transport.py)parse_query()intools.pysoToolGateway.execute()validatesquerycalls once viaTypeAdapter(Query)and derivesToolResult.wait_outcomefrom the exact validatedJobStatusQuery/CanvasStatusQueryinstance (wait_outcome_for_query()), forwarding the normalized query dict toAgentTools.execute()and carryingToolResult.wait_outcomeintocli_transport.py. Standalonewait_outcome()also validates viaJobStatusQuery/CanvasStatusQueryso coerced numeric strings (e.g.,waitSeconds: "1"->1.0) match business execution identically.waitOutcomerecordswaitSeconds,until("all" | "any"forjob.status), andsatisfiedalongsidesettledandstatuses/status.satisfiedmatchesCreationCanvas.wait_jobs()/wait_item_status()semantics:waitSeconds <= 0(immediate status query):satisfied = True(never treated as an expired wait window).until == "any"with at least one terminal job (succeeded/failed/cancelled/interrupted):satisfied = Trueeven when other jobs are still running (settled = False).until == "all"withwaitSeconds > 0and unfinished jobs:satisfied = False,settled = False.settledsemantics stay unchanged for backward compatibility with saved records andscripts/trace_job_queries.py.Count completed calls by tool return status and separate expired waits from still-running observations (
assistantActivity.ts,AssistantReply.tsx,chat.ts,i18n,docs/architecture/agent-runtime.md)toolCounts()counts everystatus === "complete"call in{done}/{total} complete/{done}/{total} 已完成rather than subtracting successfuluntil="any",waitSeconds=0, or timed-outuntil="all"calls.waitOutcome.settled === falseare split into two mutually exclusive display states:unsettled(satisfied === false, expired wait window): row badgeNot finished/未结束(is-unsettled), summary{count} wait not finished/{count} waits not finished({count} 次等待未结束).jobsRunning(satisfied === true, e.g.,until="any"satisfied orwaitSeconds=0status query while jobs are still running): row badgeJobs running/仍有任务运行(is-jobs-running), summary{count} with jobs still running({count} 次返回时仍有任务运行).#681records withoutsatisfiedinferjobsRunningwhenarguments.waitSeconds === 0orarguments.until === "any"with a terminal status present, and older records withoutwaitOutcomeremainComplete/已完成.Add all requested regressions
until="any"satisfied (1 succeeded + 1 running),until="all"wait window expired,waitSeconds=0zero-duration query, and numeric-string vs numericwaitSeconds("1"vs1,"0.05"vs0.05,"0"vs0) across unit & POSIX transport tests (tests/test_wait_outcome.py), end-to-endcli_transport->ToolGateway->agent.pysave -> freshcreate_appreopen persistence tests (tests/test_assistant_conversations.py), frontend state tests (tests/assistantActivity.test.ts), and bilingual Playwright browser test (tests/browser/assistant_wait_outcome.mjs).Linked issue
Refs #449.
Fixes #NorRefs #Nis included, or no issue appliesLabels
Proposed:
type:bug,area:agent,area:canvas,area:i18n,area:docs(fork PR without label write permission).Test plan
0d4ab243decdd43a97943a103210920d45f7c115over base322f98c317322c1ac12541093719c890507b51b0; only 3 lines incli_transport.pychanged sinced3490c73to readoutcome.wait_outcomeviagetattrfor stub outcomes intest_agent_timing.py):pytest tests/test_agent_timing.py tests/test_wait_outcome.py tests/test_agent_gateway.py tests/test_assistant_conversations.py: 86 passed, 0 failed (includingtest_agent_timing.py10/10 andtest_cli_transport_wait_outcome_persists_identically_for_numeric_string_and_number_across_reopen).d3490c73(identical frontend, desktop, core/media python, and browser tests): Windows desktop, macOS desktop, frontend, all 3 browser lanes (includingtests/browser/assistant_wait_outcome.mjs), Python (coreandmedia), static, CodeQL (Python & JS), and DSH plugin checks all passed; onlychecks / python (agent-cli)failed ontest_agent_timing.py(fixed in0d4ab243).Release checksworkflow, CodeQL, and DSH plugin checks on exact tip0d4ab243decdd43a97943a103210920d45f7c115.322f98c317322c1ac12541093719c890507b51b0, head0d4ab243decdd43a97943a103210920d45f7c115. Material validation gaps: hostedRelease checks/ CodeQL / DSH have not yet run on0d4ab243, in-app bilingual screenshots/MP4 were captured on the identical frontend tree at4b48bf23(zero frontend changes between4b48bf23and0d4ab243), and no live external model provider calls were made.Evidence that it works
In-app OpenDirector walkthrough video & bilingual screenshots (
4b48bf23)Captured directly in the running OpenDirector application (
create_appisolated backend + Vite frontend, projectWait Mode Semantics Demo) with a persisted 5-call turn written throughagent.py:until="all",waitSeconds=60, 2 running ->Not finished/未结束(is-unsettled)until="any",waitSeconds=60, 1 succeeded + 1 running ->Jobs running/仍有任务运行(is-jobs-running)waitSeconds=0, 1 running ->Jobs running/仍有任务运行(is-jobs-running)until="all",waitSeconds=60, 2 succeeded ->Complete/已完成(is-complete)project show(nowaitOutcome) ->Complete/已完成(is-complete)Before this fix, the same 5-call turn displayed as
2/5 complete · 3 returned before jobs finished/2/5 已完成 · 3 次返回时任务未结束, with rows 2 (until="any"satisfied) and 3 (waitSeconds=0query) both markedNot finished/未结束. With this fix, all 5 calls count as completed tool calls (5/5 complete/5/5 已完成), with summary5/5 complete · 1 wait not finished · 2 with jobs still running/5/5 已完成 · 1 次等待未结束 · 2 次返回时仍有任务运行.en-UScollapsed ->en-USexpanded ->en-USafterpage.reload->zh-CNcollapsed ->zh-CNexpanded):https://raw.githubusercontent.com/Redivesue/OpenDirector/935acbe7143d6899cf32246a73d73f26c524e14e/wait-modes-bilingual.mp4
Wait Mode Semantics Demo, right-hand AI Assistant expanded)en-USzh-CNProvider verification
No real-provider calls were made. All tests exercise local
ToolGateway, POSIX CLI transport, in-process ASGI conversation persistence, and frontend state/rendering fixtures.Bilingual UI
Both
zh-CNanden-USentries are updated together (assistant.reply.status.jobsRunning,assistant.reply.jobsRunningCount, and pluralizedassistant.reply.unsettledCount),tests/browser/assistant_wait_outcome.mjsand the live in-app walkthrough verify zero cross-language leakage, andnpm run check:i18npasses with 0 problems.Quick local verification case for reviewers
On this PR branch (
gh pr checkout 701):Expected highlights:
until="any"(1 succeeded + 1 running,waitSeconds=60) andwaitSeconds=0(1 running) both reportsatisfied: true, settled: false, count in5/5 complete/5/5 已完成, and render asJobs running/仍有任务运行rather thanNot finished/未结束.until="all"(waitSeconds=60, 2 running) reportssatisfied: false, settled: false, counts in5/5 complete/5/5 已完成, and renders asNot finished/未结束with summary1 wait not finished/1 次等待未结束.