Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(tui-v2): /continue命令导致丢失新会话记录 - #552

Closed
AiHyo wants to merge 672 commits into
lsdefine:mainfrom
AiHyo:fix/tui-v2-continue-preserve-current-log
Closed

fix(tui-v2): /continue命令导致丢失新会话记录#552
AiHyo wants to merge 672 commits into
lsdefine:mainfrom
AiHyo:fix/tui-v2-continue-preserve-current-log

Conversation

@AiHyo

@AiHyo AiHyo commented Jun 1, 2026

Copy link
Copy Markdown

Context

In tui v2, a newly started conversation disappears from recoverable history after switching to another session with /continue.

The active conversation log is stored on agent.log_path, but reset_conversation() was snapshotting the PID-based fallback path instead. As a result, when /continue reset the current conversation before restoring the selected session, the newly started conversation was not preserved.

Fix

Use the agent's active log_path when snapshotting the current conversation before reset, while keeping the existing PID-based path as the fallback for older callers.

Validation

Completed local testing with tui v2: started a new conversation A, switched to conversation B with /continue, then used /continue again and confirmed conversation A remained recoverable.

lsdefine and others added 30 commits May 6, 2026 13:23
fix: ACP bridge streaming overlap and truncation
Replace fixed 5s sleep with the same backoff pattern already used in
dcapp.py: 5 -> 10 -> 20 -> ... -> 300s, resetting to 5s when a session
survived >=60s. Uses time.monotonic() to avoid clock-jump skew.
…ckoff

fix(qqapp): exponential reconnect backoff
The previous implementation called send_typing once with an empty
typing_ticket, which had no effect. The iLink API requires a valid
typing_ticket obtained from getconfig first.

Changes:
- Add get_typing_ticket() method to fetch ticket via getconfig API
- Replace single send_typing call with continuous typing loop
- Typing refreshes every 2 seconds until agent finishes processing
- Stops cleanly via threading.Event when message handling completes

Co-authored-by: succ985 <[email protected]>
Added instructions for setting up a virtual environment and installing dependencies.

error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
- subagent.md: 隐藏--nobg选项防止同步阻塞超时
- task_planning.md: 加第7条无限重试禁自评+探测策略重排序
- autonomous_operation_sop.md: set_todo前缀提示
)

* feat: add setup.py -- interactive initialization wizard

* fix: address PR lsdefine#295 review — rename to configure.py, improve all feedback

- Rename setup.py → configure.py to avoid pip/setuptools conflict
- Fix lark exception: catch generic Exception instead of non-existent AppAccessDeniedError/AppExpiredError
- Add proxy support to probe_models via HTTPS_PROXY/HTTP_PROXY env vars
- Implement masked_input() with real-time API key masking
- Add pip install hints for messaging platform dependencies
- Add 2 new providers: CRS Gemini Ultra (Antigravity), Kimi/Moonshot OAI
- Restructure main menu: LLM only / platform only / or both with cascade prompts
- Add Python 3.14 compatibility warning and reconfiguration detection
- Fix welcome_message: WeCom only, correct variable name
- Show GETTING_STARTED example commands after configuration
- Add advanced LLM options: proxy, context_win, stream, user_agent

---------

Co-authored-by: guowenjiao54 <[email protected]>
shenhao-stu and others added 20 commits May 28, 2026 19:09
…clear)

Root cause of the lingering Ctrl+S freeze even when the session is
idle: `InputArea.reset()` calls `self.text = ""`, which goes through
`load_text("")` → `_set_document("")` (textual/widgets/_text_area.py
:1181-1186).  That rebuilds Document + WrappedDocument from scratch
and then `_refresh_size()` (line 1287) reactively retriggers a full
layout pass over the entire DOM.  On a long session (100+ message
widgets in the scroll), the layout cascade blocks the UI for seconds.

Switch to `TextArea.clear()` which goes through the edit pipeline:
`delete((0,0), document.end)` → `wrapped_document.wrap_range(...)` —
no Document rebuild, range-scoped wrap only.  Guarded with
`if self.document.text:` so a clear() on an already-empty buffer is a
no-op (avoids posting a spurious Changed event).

Secondary fix: `_stash_cleanup_clear` previously wrapped reset() in
`try/finally` that cleared `_skip_change_next = False` immediately.
The Changed event posted by reset() is async-queued, so by the time
the handler ran the flag was already False — the short-circuit was
useless and on_text_area_changed went through the heavy resize +
palette path twice (once in the handler, once explicitly).  Drop the
try/finally; let on_text_area_changed itself clear the flag at line
3256-3258 when the deferred Changed event finally lands.

Also scrubs external TUI-project names from comments per request.
- /export clip 现在通过 _copy_to_clipboard 直接写系统剪贴板:
  Win32 ctypes(CF_UNICODETEXT,避开控制台 codepage)/ macOS pbcopy /
  Wayland wl-copy / X11 xclip 或 xsel,失败再退回手动复制。
- InputArea 在 Windows 上对 Enter 事件用 GetAsyncKeyState(VK_SHIFT) 兜底,
  终端把 Shift+Enter 报成普通 Enter 时也能正确插入换行而非提交。
- watch_theme 漏清 _seg_render_cache 导致主题切换后 Markdown 的
  h1/列表 bullet/code 块/link 等仍是上一主题的色 —— 缓存 key 不含
  theme,且 ANSI 颜色被烤进了 _MdRender。补上 clear()。

Refs:
- Shift+Enter 物理检测思路 from upstream PR lsdefine#519 by @jlu005807
  lsdefine#519
- _ptk_keypress_to_bytes 在 Windows 上对 Enter 收到 \r 时用
  GetAsyncKeyState(VK_SHIFT) 物理检测 Shift,按下时返回 \n 以触发换行
  (PTK 在某些 Windows 终端区分不出 Shift+Enter 与裸 Enter)。
- 新增 _line_region / _logical_visual_range 辅助函数,↑/↓ 按键:
  不在该逻辑行的视觉首/末行 → 视觉滚行;在视觉首行且光标在行首 →
  历史导航,否则先跳逻辑行首/尾,下次按键再跨行/进历史。多行粘贴
  内部导航更符合直觉。

Refs:
- Shift+Enter 物理检测 from upstream PR lsdefine#519 by @jlu005807
  lsdefine#519
- 多行输入逻辑行边界导航思路 from upstream PR lsdefine#520 by @jlu005807
  lsdefine#520
之前在任意逻辑行的视觉首/末行都会做"先跳行头/尾再跨行/进历史"的
两段式,中间行的两段式不直观。改成:中间逻辑行的视觉首/末行直接
做视觉上下移;只有第一逻辑行的视觉首行/最末逻辑行的视觉末行,才
触发"先跳到行头/尾,下次按键再进历史"。`_logical_visual_range`
因此变成死代码,顺手删掉。
…rrow-nav/Shift+EnterFeat/tui v3 improvements

Merged via GitHub API as requested.
之前 `_extract_ask_user` 对无候选项的 ask_user 事件也照常入队,
触发 `_enter_ask` → 自由文本输入的 ask 卡片路径,在某些终端下整个
live region 冻住。v2 (`tuiapp_v2.py:2909-2910`) 是显式 `if not cands: return`,
让 "Waiting for your answer ..." 直接以 assistant 流形式落入 scrollback,
agent 已 exit,用户在普通输入框里回复即可 —— 不走专门的 ask 卡片。

对齐 v2 行为:有候选才入队、才弹卡片;无候选 fallthrough 到普通流。
…fine#523)

CommonStack (https://commonstack.ai) is an OAI-compatible gateway
aggregating Claude, GPT, Gemini, DeepSeek, MiniMax, Zhipu, xAI,
Moonshot, Qwen and Xiaomi models behind a single key.

Adds it to the configure_mykey wizard as a native_oai entry,
placed alongside other multi-provider relays (openrouter, crs, gmi).
The wizard's existing probe_models() flow fetches the live
/v1/models list at config time; model_choices keeps the same
2-item fallback shape as openrouter.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
* fix(tui): drain exit-boundary intervened replay

* refine(tui): soften intervened message prompt
Update WeChat group QR code (group 19 → group 20)
@AiHyo AiHyo changed the title fix(tui-v2): keep new conversation recoverable after /continue switch fix(tui): 在 tui-v2 丢失当前会话记录 Jun 2, 2026
@AiHyo
AiHyo force-pushed the fix/tui-v2-continue-preserve-current-log branch 2 times, most recently from 8b13183 to 93e79ff Compare June 4, 2026 06:37
@AiHyo
AiHyo force-pushed the fix/tui-v2-continue-preserve-current-log branch from 93e79ff to dc9c14a Compare June 4, 2026 06:46
@AiHyo AiHyo changed the title fix(tui): 在 tui-v2 丢失当前会话记录 fix(tui-v2): /continue命令导致丢失新会话记录 Jun 4, 2026
@lsdefine

Copy link
Copy Markdown
Owner

Closing because the base branch history was force-pushed. This PR now includes hundreds of unrelated commits/files and can no longer be reviewed or merged safely. If the change is still needed, please open a fresh PR rebased onto the current main. Thank you for the contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.