feat(chat): configurable interactive answer timeout (fork of #362 with blocking fixes) - #386
Open
devil233-ui wants to merge 7 commits into
Conversation
Make the answer window shared by the AskUserQuestion card and the tool approval bar configurable via settings.system.interactiveTimeoutMinutes (minutes, default 3, preserving current behavior). A very large value (e.g. 99999) approximates never timing out. The window is injected into both tools at runtime; every deadline stays a finite timestamp, so the countdown logic needs no special never-handling. Refs Stack-Cairn#354 (timeout configurability).
… a fine-grained slider Move the interactive answer timeout off its standalone input card and into the AskUserQuestion tool row, replacing the fixed read-only 'allow' label with a stop-based slider. The stop table keeps 1-60 minutes fine-grained (1,2,3,4,5,6,8,10,12,15,20,25,30,40,50,60) and jumps straight to 99999 past one hour, so the slider reads as a plain duration without exposing any internal 'never' semantics. The tool detail copy no longer hardcodes '3 minutes'; it now points at the adjustable slider.
Keep a single one-line comment on the stop table and drop the duplicate block inside the render body; both mirrored files stay byte-identical.
…list 前端改完滑块重启即回默认值:该键此前不在 save_system 白名单里, 落库时被丢弃。补入白名单 + normalize_interactive_timeout_minutes_value (正数保留、上限钳 99999、非正/非法回默认 3,与前端归一化同口径), 并更新 row_count 断言(9→10)与 key 列表,新增 round-trip 测试覆盖 7 个归一化用例。
99999 分钟换算成毫秒(≈5.99e9)超过 setTimeout 的 IDL long 上限 (2^31-1),裸调用会被 ToInt32 回绕:99999 被截成约 19.7 天, 而 35792~200000 分钟区间回绕成负数被钳为 0 → 「永不超时」瞬间 立刻超时。新增 scheduleAtDeadline 分段续期(单跳最多 2^31-1 ms, 到点按剩余时间续排,回调恒异步),替换 AskUserQuestion 与工具审批 的裸 setTimeout;补最大档回归 + scheduleAtDeadline 语义测试。 两端镜像,tsc/lint/mirror 均过。
原 PR 把 deadline 上界校验整个取消,远端浏览器时钟偏移时会显示 荒谬长倒计时,且把回归写进断言。上界改为最大可配置窗口 (99999 分钟):长窗口仍被采信,超出视为时钟不可比回退挂载近似。 同时两端 SystemToolsSection 过 biome 格式化(lint 从红转绿, CI 不再失败)。补超上限不采信测试。
StackCairn
marked this pull request as draft
August 6, 2026 04:18
Contributor
|
PR governance checks passed. Awaiting human review. |
Author
|
Screenshot for PR #386 - configurable interactive timeout (99999 min ≈ never timeout) |
devil233-ui
marked this pull request as ready for review
August 6, 2026 05:12
Contributor
|
代码太长了, 前端写的拖动条根本没必要min, max, 请优化一下代码质量 |
Contributor
|
前端传回的值是确定的, 无需后端过多检验 |
Author
|
v4f还是太菜了hhh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
接手原 #362(作者暂时没空继续)。本 PR 在 #362 的 3 个 commit 基础上,修复了三个阻塞问题,使其真正可用。
修复内容
1. 🐛 设置持久化:
interactiveTimeoutMinutes进 Rust 保存白名单原 #362 只改了前端,该键不在
save_system白名单里,落库时被丢弃 → 重启即回默认 3 分钟,功能等于没生效(实测确认)。system.rs保存白名单 +normalize_interactive_timeout_minutes_value(正数保留、上限钳 99999、非正/非法回默认 3,与前端归一化同口径)row_count断言 9→10、key 列表,新增 round-trip 测试覆盖 7 个归一化用例2. 🔧 setTimeout 32 位溢出:分段续期
99999 分钟 ≈ 5.99e9 ms 超过
setTimeout的 IDL long 上限(2^31-1),裸调用 ToInt32 回绕:99999 被截成约 19.7 天,35792~200000 分钟区间回绕成负数被钳为 0 → 「永不超时」瞬间立刻超时。scheduleAtDeadline:单跳最多 2^31-1 ms,到点按剩余续排,回调恒异步setTimeoutscheduleAtDeadline语义测试。原 feat(chat): configurable interactive answer timeout #362 的测试用 1 小时窗口,在安全范围内,测不出此 bug3. 🧹 卡片 deadline 上界:由"取消"改为"最大可配置窗口"
原 #362 取消上界校验,远端时钟偏移会显示荒谬倒计时,且把回归写进断言。现上界取
INTERACTIVE_TIMEOUT_MAX_MINUTES(99999 分钟):长窗口仍被采信,超出视为时钟不可比回退挂载近似。补超上限不采信测试。附带:biome 格式化(CI 修复)
两端
SystemToolsSection.tsx过biome check --write,pnpm lint从红转绿(原 #362 会在 CI 挂掉)。验证
settings::tests:42 pass(含新增 round-trip)tsc --noEmitcleanbiome checkclean已知限制(沿用原 #362 设计,未扩大范围)
Screenshots / preview
交互式应答超时滑块配置为 99999 分钟(≈永不超时)时,AskUserQuestion 卡片挂起并显示超长倒计时(约 99998 分钟剩余),不会如修复前那样瞬间超时落定。
关联 issue
Closes #354