Repository navigation
Conversation
david6666666
left a comment
There was a problem hiding this comment.
REQUEST CHANGES 6818188 Refs #535
Dot, acting for @david6666666. Non-voting review.
The inline finding is about the decision notification contract, not the sound or popup controls.
Ran: inspected the pinned diff and the Release checks run; it requires maintainer action and is not green.
Not run: independent browser or audio playback. No total: reviewed head is behind current main.
| ): TaskOutcome | null { | ||
| if (message.role !== "assistant") return null; | ||
| if (message.status === "complete") | ||
| return asksForDecision(message.text) ? "decision" : "completed"; |
There was a problem hiding this comment.
This treats a completed reply ending in a question as an actual wait for a decision. A completed reply can end with a follow-up offer, and a genuine approval request need not end with a question mark. #535 calls for the authoritative waiting state. Could the decision notification consume that state (or be deferred until it is available), with regression coverage for both cases?
There was a problem hiding this comment.
Thanks for catching this. Updated the branch to consume the authoritative interaction state instead of inferring from the reply text.
ask_user/opendirector ask-usercreates a host-owned interaction. The host persists it and sets the assistant message toawaiting_decisiononly whileinteraction.status === "pending".agentTaskOutcomenow returnsdecisiononly for:
status === "awaiting_decision" && interaction.status === "pending".- A completed reply ending in
?— including a follow-up offer — remainscompleted. - Approval-like wording without an interaction remains
completed; a genuine approval request must come throughask_user/the CLI bridge. - Answered or cancelled interactions do not trigger a decision notification.
- Closing or restarting the turn cancels a pending interaction and marks the message
interrupted. - The pending interaction event is published after the Agent lease pause; closing during that pause cancels it.
- Removed the old
asksForDecisionquestion-mark heuristic.
Regression coverage:
tests/taskNotifications.test.ts: pending, answered, null, question-ending complete, and approval-like complete cases.tests/test_agent_interactions.py: ask, option validation, close, pause/resume and close-during-pause.tests/test_assistant_conversations.pyandtests/test_cli.py: API lifecycle and CLI bridge.tests/test_native_runtime.py: native gate coverage; the real OpenCode case is environment-gated and skipped locally.
Local checks:
npm test: 1040 passednpm run build: passednpm run check:i18n: 3484 keys, 0 problems- Python interaction/API/CLI tests: 82 passed
- Native gate: 2 passed, 1 skipped
The branch is rebased onto current main in 6467e326. I did not re-record the new decision card in a browser/audio session, so I am not claiming that as verified.
Could you re-review the updated commit?
- Announce user-started Agent turns when they finish, fail, or ask a question. - Announce canvas generations the user started; keep agent-submitted jobs with their turn. - Add a short chime, project/task/status toast, and an action back to the conversation or node. - Persist announced task identities so reloads and reconnects do not repeat a chime. - Cover the decision rule, origin filtering, and reload dedupe with tests. - Add zh-CN and en-US catalogs. Fixes ThinkFlowLab#535
- Add separate task sound and popup switches. - Add a persisted 0-100% volume slider with an in-settings preview. - Keep the previous loudness at the 30% default. - Gate task chimes and toasts independently. - Cover preference parsing and volume bounds with unit tests.
- Add an ask_user tool and CLI command that wait for an explicit user answer. - Persist pending interactions with the owning turn and expose answer endpoints. - Release and reacquire the Agent write lease while waiting for the user. - Mark unanswered interactions interrupted after a restart. - Render an in-chat decision card and notify from the authoritative state. - Add gate, CLI bridge, API lifecycle, notification and browser coverage. - Verify the bundled OpenCode harness waits for ask-user with a mock model.
- Register the pending future before releasing the project lease. - Publish the pending interaction only after the lease is released, so an answer cannot race the resume path. - Cancel a question closed during pause without leaving the ask call stranded. - Cover pause/event ordering and close-during-pause.
6818188 to
6467e32
Compare
david6666666
left a comment
There was a problem hiding this comment.
REQUEST CHANGES 6467e32 Refs #535
Dot,代表 @david6666666。
当前证据暂定 45/100(非批准分)。 范围 3/3,正确性 2/3,验证 2/3,主张证据 0/3,简洁性 0/3。
上次的问号误判已修:现在只在宿主确实有待答交互时通知。新入口还需要确保同一个问题只能结算一次,我把并发回答的疑问留在对应代码处。作者报告前后端定向测试通过,但 Release checks 仍需维护者操作,现有录像也早于新决策卡。补并发回归后,建议再录一次「收到提醒 → 打开决策卡 → 回答后续跑」。我没重跑测试。解释性代码注释按量表记零。
English summary: 45/100 provisional. The authoritative wait-state fix is in place. Serialize concurrent answers and attach current-tip decision workflow evidence.
| if not text and not option_id: | ||
| raise ProjectError('请输入回答或选择选项。', 422) | ||
| if self.resume_after_user is not None: | ||
| await self.resume_after_user() |
There was a problem hiding this comment.
这里检查 future.done() 之后,会先等租约、再等持久化。两个标签页如果几乎同时答同一个问题,可能都越过前面的检查,后一个回答覆盖前一个,或在 set_result() 时碰到已经结算的 future。能否在第一次 await 前先认领这一条回答,并让第二次稳定返回 409?建议用可暂停的租约或持久化回调写一个并发回归。
- Claim the interaction before resume or persistence so concurrent tabs cannot both settle it. - Let the losing answer return False and the API map it to 409. - Roll the in-memory answer back if persistence fails, allowing a retry. - Add a concurrent-answer regression that pauses the resume callback.
- Guard answer and close with one gate lock so a question cannot settle twice. - Keep the in-flight answer while close waits, rather than racing a cancelled persist against answered. - Add close-during-answer regression coverage.
david6666666
left a comment
There was a problem hiding this comment.
Dot,代表 @david6666666。
当前证据暂定 53/100(非批准)。 范围、正确性、验证、证据、简洁性依次为 3/3、3/3、2/3、0/3、0/3。
之前提的双标签页同时回答已修:回答和关闭串行,新增用例确认只接收一次回答、只恢复一次。我没发现同一处还有需要再标的代码问题。Release checks 仍需维护者操作,新决策卡也还没录到真实流程。下一步补「收到通知、回答、任务续跑」的录像;我没有重跑浏览器。
English summary: 53/100. Concurrent-answer handling is covered by a targeted regression. Release checks and the decision-card recording are still outstanding.
Summary
Adds task notifications for user-started Agent turns and canvas generations. Refs #535.
ask_user/opendirector ask-userinteraction, not a question-mark heuristic.agentRunId) do not notify on their own; the owning turn reports the result.zh-CNanden-UScatalogs.The decision contract is:
awaiting_decision→decision?/?→completedcompletedLocal checks:
npm test— 1040 passed.npm run build— passed.npm run check:i18n— 3484 keys, 0 problems.pytest tests/test_agent_interactions.py tests/test_assistant_conversations.py tests/test_cli.py— 84 passed.pytest tests/test_native_runtime.py -k 'ask_user or bundled_model_declares or rejects_removed_runtime'— 2 passed, 1 skipped (real OpenCode path environment-gated).Evidence that it works
Recordings (real UI; the chime is mixed at the actual trigger time). These cover the notification/settings surface and predate the authoritative decision card:
Decision interactions are covered by
tests/taskNotifications.test.ts,tests/test_agent_interactions.py, the API lifecycle tests and the bundled harness gate test.Provider verification
Bilingual UI
zh-CNanden-UScatalogs are updated for settings, task notification copy and decision UI copy.Implementation notes
Job.agentRunIdis projected into the canvas job row to distinguish user-started generation from Agent-submitted work.agentRunId.TaskNotificationLedgerpersists announced identities inlocalStorage, bounded to avoid growth.InteractionGateowns one turn's authoritative question.ask_userand the CLI bridge persist the interaction before publishing it; the message becomesawaiting_decisiononly while that interaction is pending.answerandcloseshare one gate lock. Closing while an answer is in flight waits for that settlement instead of racing a cancelled persist against an answered state.cancelledand its messageinterrupted; no stale decision notification is inferred.Scope decisions and limitations
ask_useror theopendirector ask-userCLI to produce a waiting decision. Harnesses without either path do not get an authoritative decision notification; a completed question is not treated as one.Follow-ups