Skip to content

Commit 5b0e5da

Browse files
authored
Merge pull request #47 from oslabs-beta/paython-mcp
Fix AI-generated pipelines missing provider (AWS OIDC) configuration
2 parents a8ebc17 + eca7e2b commit 5b0e5da

File tree

3 files changed

+54
-2
lines changed

3 files changed

+54
-2
lines changed

client/src/pages/ConfigurePage.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,24 @@ export default function ConfigurePage() {
108108
setChatLoading(true);
109109

110110
try {
111+
// Send the same provider/config context that the manual generator uses.
112+
// This prevents the wizard from producing generic placeholder provider steps.
113+
const pipelineSnapshot = {
114+
template,
115+
provider,
116+
branch,
117+
stages,
118+
options,
119+
};
120+
111121
const res = await api.askYamlWizard({
112122
repoUrl: repo,
113123
provider,
114124
branch: branch,
115125
message: trimmed,
116126
yaml,
127+
// Extra context for the backend/wizard toolchain (safe to ignore if unused)
128+
pipelineSnapshot,
117129
});
118130

119131
if ((res as any)?.tool_called) {
@@ -148,7 +160,10 @@ export default function ConfigurePage() {
148160
branch,
149161
provider,
150162
stages,
151-
});
163+
// Keep a copy of the current options in wizard context so follow-up prompts
164+
// can reference the selected provider identity (AWS role / GCP service account).
165+
options,
166+
} as any);
152167
}
153168

154169
let text: string;

server/agent/wizardAgent.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,18 @@ Tell me what you’d like to do next.
135135
}
136136

137137
const cookie = userPrompt?.cookie || '';
138+
const pipelineSnapshot =
139+
userPrompt?.pipelineSnapshot ||
140+
userPrompt?.body?.pipelineSnapshot ||
141+
null;
138142
const systemPrompt = `
139143
You are the MCP Wizard Agent.
140144
You have full access to the following connected tools and APIs:
141145
- repo_reader: reads local and remote repositories, useful for listing or describing repositories
142146
- pipeline_generator: generates CI/CD YAMLs
143147
- oidc_adapter: lists AWS roles or Jenkins jobs
144148
- github_adapter: fetches real-time GitHub repository data through an authenticated API connection
149+
- gcp_adapter: fetches Google Cloud information
145150
Do not say that you lack access to GitHub or external data — you can retrieve this information directly through the available tools.
146151
Only call tools when the user explicitly asks for data retrieval or actions. Do NOT call tools for explanations, help, or capability questions.
147152
@@ -311,6 +316,17 @@ Tell me what you’d like to do next.
311316
if (provider) payload.provider = provider;
312317
if (template) payload.template = template;
313318

319+
// 🔑 Inject authoritative pipeline options from the frontend (Option A)
320+
if (pipelineSnapshot?.options) {
321+
payload.options = pipelineSnapshot.options;
322+
}
323+
if (pipelineSnapshot?.stages) {
324+
payload.stages = pipelineSnapshot.stages;
325+
}
326+
if (pipelineSnapshot?.branch) {
327+
payload.branch = pipelineSnapshot.branch;
328+
}
329+
314330
// Fetch GitHub repo details before pipeline generation
315331
let repoInfo = null;
316332
try {

server/routes/agent.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,37 @@ router.post('/wizard', requireSession, async (req, res) => {
3939
// Trigger wizard agent with AI prompt
4040
router.post('/wizard/ai', requireSession, async (req, res) => {
4141
try {
42-
const { prompt } = req.body;
42+
const {
43+
prompt,
44+
repoUrl,
45+
provider,
46+
branch,
47+
pipelineSnapshot,
48+
} = req.body;
49+
4350
if (!prompt) {
4451
return res
4552
.status(400)
4653
.json({ success: false, error: 'Missing required field: prompt' });
4754
}
55+
56+
console.log('🧠 Wizard AI request received:', {
57+
repoUrl,
58+
provider,
59+
branch,
60+
hasPipelineSnapshot: !!pipelineSnapshot,
61+
snapshotKeys: pipelineSnapshot ? Object.keys(pipelineSnapshot) : [],
62+
});
63+
4864
const result = await runWizardAgent({
4965
prompt,
66+
repoUrl,
67+
provider,
68+
branch,
69+
pipelineSnapshot,
5070
cookie: req.headers.cookie,
5171
});
72+
5273
res.json({ success: true, data: result });
5374
} catch (err) {
5475
console.error('Wizard AI Error:', err);

0 commit comments

Comments
 (0)