feat(ai-chat): raise step limit to 20 and force a final answer #4
Closed
Ghost
wants to merge 1 commits from
feat/ai-chat-step-limit-and-forced-final-answer into develop
pull from: feat/ai-chat-step-limit-and-forced-final-answer
merge into: vvzvlad:develop
vvzvlad:main
vvzvlad:test/244-part-b
vvzvlad:fix/255-ws-redis-adapter-leak
vvzvlad:feat/251-intentional-clear
vvzvlad:fix/252-e2e-open-handles
vvzvlad:feat/184-autonomous-agent-runs
vvzvlad:feat/221-image-captions
vvzvlad:feat/git-sync
vvzvlad:refactor/193-tool-spec-registry
vvzvlad:fix/244-dataloss-bugs
vvzvlad:fix/embeddings-reindex-progress
vvzvlad:develop
vvzvlad:feature/offline-sync
vvzvlad:feat/229-catalog-yaml
vvzvlad:feat/243-blob-sandbox
vvzvlad:feat/228-inline-footnotes
vvzvlad:fix/qa-ui-bugs-216-218
vvzvlad:feature/agent-roles-catalog
vvzvlad:fix/share-alias-rename
vvzvlad:fix/ai-chat-empty-render
vvzvlad:feat/191-chat-doc-binding
vvzvlad:feat/201-temporary-notes
vvzvlad:feat/198-interrupt-agent
vvzvlad:feat/ai-chat-full-history
vvzvlad:feat/199-ai-generate-title
vvzvlad:feat/205-share-aliases
vvzvlad:batch/issues-189-187-170
vvzvlad:feat/170-mcp-test-button
vvzvlad:feat/189-context-badge
vvzvlad:feat/198-interrupt-agent-send-now
vvzvlad:fix/issues-190-159
vvzvlad:fix/ai-chat-new-chat-during-stream
vvzvlad:fix/ai-chat-stream-perf
vvzvlad:batch/issues-2026-06-25
vvzvlad:feat/ai-chat-persistent-history
vvzvlad:fix/ai-chat-copy-chat-wysiwyg
vvzvlad:fix/ai-stream-reset-resilience
vvzvlad:fix/ai-stream-undici-timeout
vvzvlad:fix/footnote-review-1227-followup
vvzvlad:fix/ai-chat-token-counter-realtime
vvzvlad:docs/manual-qa-test-plan
No Reviewers
Labels
Clear labels
bug
documentation
duplicate
enhancement
epic
feature
good first issue
help wanted
idea
invalid
needs-human
question
refactor
review/approved
review/changes-requested
review/needs
security
status/blocked
status/done
status/in-progress
status/ready
test
wontfix
Something isn't working
Improvements or additions to documentation
This issue or pull request already exists
New feature or request
Large multi-phase effort spanning many changes
New functionality request
Good for newcomers
Extra attention is needed
Idea / proposal for discussion
This doesn't seem right
эскалация: нужно решение человека
Further information is requested
Code cleanup / refactoring
в последнем ревью нет открытых blocking-находок
последнее ревью оставило открытые blocking-находки
head не ревьюился (head != reviewed_head)
Security / hardening issue
ждёт зависимость blocked_by
закрыто и проверено
в активной работе (мягкая заявка)
специфицировано, не заблокировано, ждёт исполнителя
Test coverage / test infrastructure
This will not be worked on
No Label
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: vvzvlad/gitmost#4
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "feat/ai-chat-step-limit-and-forced-final-answer"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The agent's per-turn step ceiling was
stepCountIs(8). On research-heavy questions the model spent all 8 steps on tool calls and the turn ended with empty text — the user saw no answer and had to nudge with?to start a new turn. Real incident from a chat that triggered this plan.Changes
stopWhenfromstepCountIs(8)tostepCountIs(MAX_AGENT_STEPS = 20)so multi-search research questions are not cut off mid-investigation.prepareStepoption that, on the last allowed step (stepNumber === 19), forcestoolChoice: 'none'and appends a synthesis instruction to the system prompt — the model must write the best text answer it can from what it already gathered, never an empty turn.undefined→ default behaviour, so natural early termination is unaffected.prepareAgentStep(stepNumber, system)for unit testing, mirroring the existingcompactToolOutputpattern.Out of scope (per plan)
Note for future bumps
At AI SDK v7 the per-step
systemfield is renamed toinstructions; on v6 (^6.0.134)systemis correct — noted in a code comment.Verification
pnpm --filter server test -- ai-chat.service— 10/10 pass (existingcompactToolOutput+assistantPartssuites plus the newprepareAgentStepblock: undefined for steps 0/1/5/10/18,{toolChoice:'none', system}at 19, system preserves the base prompt and contains the instruction marker, off-by-one pin).pnpm --filter server lint— no new errors (only the pre-existingcommon/helpers/utils.ts:3 no-require-imports).onFinish/onError/onAbortand themaxOutputTokenscomment are untouched.Ghost referenced this pull request2026-06-21 16:32:23 +03:00
Ghost referenced this pull request2026-06-23 06:55:05 +03:00
Ghost referenced this pull request2026-06-24 00:10:43 +03:00
Ghost referenced this pull request2026-06-24 05:28:16 +03:00
Ghost referenced this pull request2026-06-24 12:45:05 +03:00
Ghost referenced this pull request2026-06-24 13:05:44 +03:00
Ghost referenced this pull request2026-06-25 12:25:48 +03:00
Ghost referenced this pull request2026-06-27 19:52:21 +03:00
Ghost referenced this pull request2026-06-27 20:24:56 +03:00
Pull request closed