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.
Overview
This PR stabilizes and improves the multi-step CI/CD pipeline workflow in the Wizard Agent. The agent can now reliably generate a pipeline, ask for confirmation, and commit the workflow file to the user’s repository using the multi-turn API flow. It also prevents misrouting of user intent caused by ambiguous LLM decisions.
⸻
Key Improvements
✅ 1. Hardened commit-intent detection
• Replaced overly-broad commit regex with a safe, pipeline-specific matcher
• Ensures phrases like “yes commit”, “commit workflow”, “apply pipeline” always trigger pipeline_commit
• Prevents accidental triggers from unrelated phrases like “recent commits”
✅ 2. Added commit-history safety guard
• If the LLM or user references:
• “recent commits”
• “commit history”
• “see commits”
→ the request routes to github_adapter instead of committing a workflow.
This prevents the agent from confusing GitHub history queries with pipeline commits.
⸻
• User intent now always overrides LLM intent for commit confirmation
• Guarantees the correct tool runs even when model reasoning is imperfect
• Solves previous issue where “yes commit” was misinterpreted as a request for GitHub commit history
⸻
• Ensures LAST_GENERATED_YAML and LAST_REPO_USED are properly retained
• Allows API-based multi-step flows to commit generated workflows without losing state
⸻
• More deterministic command routing
• Better separation between pipeline tools and GitHub informational tools
• Cleaner, safer conversational agent logic
⸻
Why This Matters
These changes make the Wizard Agent behave consistently and predictably, even across multiple conversational steps. This is essential for:
• Multi-step CI/CD pipeline generation
• CI workflow confirmation UX
• Reducing LLM misinterpretation errors
• Maintaining reliable automated repository commits
• Future expansion of the wizard (rollback, edits, diff previews, etc.)
This work significantly improves the reliability and robustness of the MCP-based CI/CD Builder.