Hardened AI orchestration reliability and reduced non-converging edit loops#12
Open
AbhishekSinghDhadwal wants to merge 1 commit intomasterfrom
Open
Hardened AI orchestration reliability and reduced non-converging edit loops#12AbhishekSinghDhadwal wants to merge 1 commit intomasterfrom
AbhishekSinghDhadwal wants to merge 1 commit intomasterfrom
Conversation
- Enforced structured Act-mode contract with required next_action (tool|final), runtime validation, and legacy compatibility - Added deterministic mode-specific decoding options for tool phases - Added continuation metadata (reason/progressDelta) and bounded loop guardrails in AI tab (max rounds + no-progress cap + explicit stop reason) - Improved tool execution resilience with longer timeout, one transient retry, and larger tool-result summary cap - Added token-aware context compaction in conversation message selection - Updated planning/act prompt guidance to require explicit next_action contract. - Improved edit-tool behavior: - insert_code / replace_code now validate non-empty code and return concise accepted metadata - UI edit application skips failed tool results - Added completion policy to finalize one-shot create/insert requests instead of unsolicited fix loops
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.
This PR hardens AI tool-calling reliability and loop termination behavior in CQL Studio with minimal runtime-focused changes (no API or settings schema changes). It also improves one-shot code-edit completion to reduce unnecessary post-edit self-correction loops.
What changed
1) Act-mode response contract hardening
next_action: "tool" | "final".Files:
src/app/services/ai.service.tssrc/app/services/ai-planning.service.ts2) Deterministic tool-phase decoding
File:
src/app/services/ai.service.ts3) Bounded continuation + no-progress safeguards
reason,progressDelta).Files:
src/app/services/ai-stream-response-handler.service.tssrc/app/components/cql-ide/tabs/ai-tab/ai-tab.component.ts4) Tool execution resilience
File:
src/app/services/ai-tool-execution-manager.service.ts5) Token-aware context compaction
File:
src/app/services/conversation-manager.service.ts6) One-shot edit loop reduction
insert_code/replace_codenow validate non-empty code and return concise accepted metadata instead of verbose placeholder payloads.Files:
src/app/services/tools/insert-code.tool.tssrc/app/services/tools/replace-code.tool.tssrc/app/components/cql-ide/tabs/ai-tab/ai-tab.component.tssrc/app/services/ai.service.tsWhy
It was observed that there existed multiple tool chain orchestration issues like - flaky tool-call chaining, random loop continuation, and non-converging edit-repair cycles. These changes prioritize deterministic control flow, bounded retries/loops, and better completion behavior for common user intents.
Scope
Sources I've referred to in order to implement these changes
NOTE - This is not a final fix, and is simply a step towards strengthening the application. Future fixes will further strengthen the tool calling chain and associated components, especially towards code completion.