Commit 2904de0
feat: tool-call dedup plus shell/terminal hardening and editor fixes (#116)
* chore: clean completed tasks from todo.md
* fix: apply CodeRabbit auto-fixes
Fixed 1 file(s) based on 1 unresolved review comment.
Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
* fix: harden shell, terminal, and plan-mode robustness
- Shell error briefs now surface the trailing output of a failed command
(last non-empty lines rendered as plain text), so the collapsed worklog
card explains why a command failed instead of only its exit code.
- Subagents no longer receive plan-mode workflow reminders; the reminder
is root-only, since subagent toolsets usually exclude the plan-mode
tools and the injection only invited calls to tools they don't have.
- The terminal cursor-position probe no longer risks hanging in raw mode
on exit: reads are non-blocking during the probe and VMIN/VTIME are
restored to canonical defaults so a cancelled probe can't wedge the tty.
- Reorder the welcome info block so session/storage details render last,
and log the auto-save path failure instead of swallowing it silently.
* feat(soul): dedupe repeated tool calls within and across steps
Identical tool calls in one step now share the original task's result
instead of re-executing. Across steps, repeats are detected via
canonical JSON arguments (key order no longer defeats matching) and
nudged with sparse system-reminders at consecutive streaks of 3, 5,
and 8, reducing loop-thrash without hard-blocking legitimate retries.
Per-step state is armed inside the step-retry wrapper so a retried
step never awaits tasks cancelled by the failed attempt, and a D-Mail
revert clears the dedup seed since the reverted history no longer
contains those calls. Adds tool_call_dedup_detected telemetry plus a
dup_type property on tool_call events.
* chore: drop completed rename plan from todo, apply review nits
The pythinker-cli -> pythinker-code rename plan is fully realized
(root pyproject is pythinker-code, module is src/pythinker_code/, no
pythinker_cli references remain), so retire it from tasks/todo.md.
Review nits: annotate /reports with NoReturn and assert the injection
counter stays untouched in the subagent plan-mode suppression test.
* feat: editor bug fixes, Draft and auto save fixes.
* refactor: simplify dedup reminder path and tidy review nits
soul/toolset: append the cross-step dedup reminder inline at the tool task's return instead of behind a second wrapper task. Behaviour is unchanged (toolset tests pass) but the returned task is now the tool task itself, with one fewer task and closure per reminder. Drop the now-unused default on _append_reminder_to_return_value and annotate begin_step/end_step with the existing ToolCallKey alias.
tools/utils: tail() docstring no longer over-specifies the buffer as stderr (it holds mixed command output); rename stripped -> rstripped to reflect that it holds an rstrip() result.
* fix: address CodeRabbit review on dedup reminder and test
Bound the canonical arguments echoed in the strong dedup reminder to a 256-char preview so large-payload tools (WriteFile, MultiEdit) don't re-inject their whole body into context on every repeat; exact identity is still carried by the args_hash dedup telemetry.
Rewrite test_begin_end_step to assert observable behaviour (handle()/end_step()/dedup_triggered) instead of poking private _current_step_* internals.
* fix(test): narrow handle() result to Task before await (pyright)
handle() returns Task[ToolResult] | ToolResult; assert isinstance Task before awaiting, matching the other dedup tests, so pyright's check job passes.
---------
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: CodeRabbit <noreply@coderabbit.ai>1 parent d016f8e commit 2904de0
40 files changed
Lines changed: 1048 additions & 1063 deletions
File tree
- docs/en/reference
- src/pythinker_code
- acp
- auth
- openai
- cli
- hooks
- soul
- dynamic_injections
- tools
- shell
- ui
- shell
- components
- usage_adapters
- visualize
- utils
- tasks
- tests
- core
- ui_and_conv
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
349 | | - | |
| 349 | + | |
350 | 350 | | |
351 | | - | |
| 351 | + | |
352 | 352 | | |
353 | 353 | | |
354 | 354 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
| 153 | + | |
152 | 154 | | |
153 | 155 | | |
154 | 156 | | |
155 | | - | |
| 157 | + | |
156 | 158 | | |
157 | 159 | | |
158 | 160 | | |
159 | 161 | | |
160 | | - | |
| 162 | + | |
161 | 163 | | |
162 | 164 | | |
163 | 165 | | |
164 | 166 | | |
165 | | - | |
| 167 | + | |
166 | 168 | | |
167 | 169 | | |
168 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
789 | 789 | | |
790 | 790 | | |
791 | 791 | | |
792 | | - | |
793 | 792 | | |
794 | 793 | | |
795 | 794 | | |
| |||
798 | 797 | | |
799 | 798 | | |
800 | 799 | | |
801 | | - | |
802 | | - | |
803 | | - | |
804 | | - | |
805 | | - | |
806 | | - | |
807 | | - | |
808 | | - | |
809 | 800 | | |
810 | 801 | | |
811 | 802 | | |
| |||
861 | 852 | | |
862 | 853 | | |
863 | 854 | | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
864 | 867 | | |
865 | 868 | | |
866 | 869 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | | - | |
| 178 | + | |
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
| 187 | + | |
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | | - | |
| 179 | + | |
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
911 | 911 | | |
912 | 912 | | |
913 | 913 | | |
914 | | - | |
| 914 | + | |
915 | 915 | | |
916 | 916 | | |
917 | 917 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| |||
0 commit comments