Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ python scripts/trigger_incident.py api-gateway outage "gateway down"

1. Start TrueForge: `npx @truefoundry/trueforge` (in a separate terminal)
2. Open `http://localhost:8790`
3. **Add model provider** → paste your `OPENAI_API_KEY`
3. **Configure Model Provider**:
- **For OpenAI**: Go to Settings, select OpenAI, and paste your `OPENAI_API_KEY`. Leave Base URL as default.
- **For Groq / Open-source models**: First, run `python groq_proxy.py` in a separate terminal. Then in TrueForge Settings, select your provider, set the **Base URL** to `http://localhost:8080/v1` (or `http://172.19.48.1:8080/v1` if using WSL), enter your Groq API key, and specify the model ID.
4. **Add MCP server** → URL: `http://localhost:8000/mcp` (name: `demo-infra`)
5. **Create agent** named `missioncontrol`:
- **System prompt**: `agent/system-prompt.md`
Expand Down
154 changes: 52 additions & 102 deletions YT Scripts/Script.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
# MissionControl — 3-Minute Demo Script (Detailed)
# MissionControl — 3-Minute Demo Script (Highly Detailed)

## Video Specs
- Duration: 2:45 to 3:00
- Resolution: 1080p
- Format: MP4
- Style: Screen recording with voiceover
- **Duration**: 2:45 to 3:00
- **Resolution**: 1080p
- **Format**: MP4
- **Style**: Screen recording with voiceover

---

## SCENE 1 — About the Project (0:00 – 0:30)

**[SCREEN: Clean desktop. Open PowerShell terminal. Type `ls` to show project folder.]**
**[SCREEN: Clean desktop. Open PowerShell terminal in the project folder.]**

**[TYPE IN POWERSHELL]:**
```powershell
ls
```

**SAY:**
"MissionControl is an autonomous DevOps incident-response agent. It monitors a microservices stack, detects failures in real time, and automatically remediates them. But here's the important part: it never acts without human approval. Every risky operation goes through a hold-to-confirm gate. Built for SRE teams who want faster incident response without losing control."

**[SCREEN: Open browser to http://localhost:3001. Show the Home page with all three services green.]**
**[SCREEN: Open browser to http://localhost:3001. Show the Home page with all services green.]**

**SAY:**
"This is the dashboard. Three services: PostgreSQL, Redis, and the application server. All green. All healthy right now. Let me show you what happens when one fails."
"This is the dashboard. We have four microservices running, including api-gateway and payment-service. All green. All healthy right now. Let me show you what happens when one fails."

---

Expand All @@ -27,95 +32,95 @@
**[SCREEN: Switch to VS Code. Open the project root folder.]**

**SAY:**
"Four components. TrueForge runs the agent and enforces approval gates. A FastMCP server gives the agent five tools — list services, get metrics, inject chaos, rollback, and restart. Docker Compose boots PostgreSQL, Redis, and the application server. And a Next.js dashboard visualizes everything."
"Four components. TrueForge runs the agent and enforces approval gates. A FastMCP server gives the agent tools like listing services, getting metrics, injecting chaos, and rolling back deploys. Docker Compose runs PostgreSQL, Redis, and the backend. And a Next.js dashboard visualizes everything."

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Informational

7. Narration invents mcp tool 🐞 Bug ≡ Correctness

The script says FastMCP gives the agent a chaos-injection tool, but the server explicitly excludes
chaos injection and exposes it only through the human-controlled REST/dashboard path. Showing the
MCP definitions during this narration will contradict the claimed architecture.
Agent Prompt
## Issue description
The demo narration attributes chaos injection to the MCP toolset even though the MCP server intentionally does not expose it.

## Issue Context
Describe chaos injection as a human-controlled dashboard/REST capability and reserve the MCP description for investigation and remediation tools.

## Fix Focus Areas
- YT Scripts/Script.md[32-40]
- mcp-servers/demo-infra/server.py[21-40]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


**[SCREEN: Open mcp-servers/demo-infra/server.py. Scroll to the tool definitions.]**

**SAY:**
"This is the MCP server. The agent calls tools through it. list_services returns all service health. get_service_metrics returns CPU, memory, and error rate. rollback_deploy and restart_service require explicit human consent. The agent cannot bypass this."
"This is the MCP server. The agent calls tools through it. `list_services` returns service health. `rollback_deploy` requires explicit human consent. The agent cannot bypass this."

**[SCREEN: Open agent/system-prompt.md. Highlight the approval rule.]**

**SAY:**
"The agent's system prompt enforces this. Think before acting. Never execute risky operations without approval. Always verify after remediation."
"The agent's system prompt enforces this. Think before acting. Never execute risky operations without approval."

---

## SCENE 3 — Demo: Inject Chaos (1:00 – 1:40)

**[SCREEN: Switch to PowerShell terminal.]**
**[SCREEN: Switch to browser. Open the Dashboard at http://localhost:3001 and click on "Chaos Lab".]**

**SAY:**
"I'm going to inject a CPU spike into the API gateway. Watch the dashboard."
"I'm going to inject an error spike into the payment service using our Chaos Lab UI. Watch what happens."

**[TYPE]:**
```powershell
python scripts/trigger_incident.py api-gateway cpu_spike
```
**[SCREEN: In Chaos Lab, select `payment-service` and choose `error_spike`. Click the "Inject" button.]**

**[SCREEN: Switch to browser. Show the Home page. The api-gateway health badge turns red.]**
**[SCREEN: Navigate back to the Home page or Incident page on the dashboard. Show the payment-service badge turning red.]**

**SAY:**
"Done. The API gateway just spiked to 95 percent CPU. The dashboard shows it red. An active incident has been created."
"Done. The payment service just spiked to a 40 percent error rate. The dashboard shows it's degraded, and an active incident has immediately been created in our system."

**[SCREEN: Switch to TrueForge terminal. Show the agent output.]**
**[SCREEN: Switch to TrueForge UI. Open the chat with the `missioncontrol` agent.]**

**SAY:**
"Watch the agent. It's polling the MCP server every few seconds."
"Now we switch to our TrueForge agent. I'll prompt it to investigate the alert."

**[SCREEN: Show agent calling list_services, then get_service_metrics.]**
**[PASTE THIS EXACT PROMPT INTO TRUEFORGE CHAT]:**
```text
Please investigate the payment-service. It seems to have an error spike.

**SAY:**
"There. It called list_services, saw the API gateway is unhealthy. Then it called get_service_metrics to investigate. CPU at 95 percent, error rate climbing. It's reasoning about what to do."
Here is the data from our systems:
1. Overall system health: All services healthy, but payment-service shows error_rate of 40%.
2. Error metrics for payment-service: version v1.8.3, status healthy, error_rate 0.4, latency_p99 120.
Comment on lines +73 to +74

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

6. Demo supplies contradictory metrics 🐞 Bug ≡ Correctness

The recording script says the injected error_spike produces 40% errors, then supplies the agent a
healthy status with error_rate 0.4; the simulator actually changes payment-service to degraded
with error_rate 12.3. The recorded dashboard and agent prompt therefore cannot agree, and the
supplied healthy data may prevent the requested rollback diagnosis.
Agent Prompt
## Issue description
The demo prompt and narration use metrics and status values that contradict both each other and the simulator's error-spike state.

## Issue Context
Update all supplied values to the real post-injection state, or have the agent fetch them through MCP instead of pasting fabricated values.

## Fix Focus Areas
- YT Scripts/Script.md[60-78]
- mcp-servers/demo-infra/state.py[20-30]
- apps/dashboard/app/chaos/page.tsx[31-38]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

3. Recent error logs: No explicit ERROR level logs found. Only INFO/WARN logs.
4. Recent deploys: deploy-003 (version v1.8.3) - changes: ['Retry logic fix', 'Idempotency keys'].

Analyze this data, determine the root cause, and propose a remediation. Do not ask any clarifying questions or use tools to request more info; just provide your final analysis and recommendation immediately.
```

**[SCREEN: Show agent output: "Recommending rollback of api-gateway to restore health."]**
**[SCREEN: Show agent responding immediately with the analysis.]**

**SAY:**
"It decided the best action is to roll back the deployment. But it can't do that without my approval."
"The agent investigates the metrics and logs I provided. It finds that `deploy-003` was just rolled out with a retry logic fix that is causing silent failures."

---

## SCENE 4 — Demo: Human Approval Gate (1:40 – 2:15)

**[SCREEN: Show TrueForge approval prompt.]**
**[SCREEN: Show agent output recommending rollback of payment-service.]**

**SAY:**
"Here's the gate. The agent is asking: 'Roll back api-gateway to restore health. Approve or reject?' This is the human-in-the-loop moment. I click approve."

**[SCREEN: Show approval granted. Agent calling rollback_deploy through MCP.]**
"It diagnosed the root cause and decided the best action is to roll back the deployment to the previous version. But it can't do that without my approval. This is the human-in-the-loop moment."

**SAY:**
"Approved. The agent called rollback_deploy on the MCP server. The service is rolling back."
**[TYPE THIS INTO TRUEFORGE TO APPROVE]:**
```text
Approved. Proceed with the rollback.
```

**[SCREEN: Wait 5 seconds. Show agent output: "Rollback complete. Verifying health."]**
**[SCREEN: Show agent acknowledging the approval and automatically executing the rollback tool.]**

**SAY:**
"Rollback complete. The agent is now verifying that health is restored."
"I approved it. The agent calls the rollback tool through the MCP server. The rollback to version 1.8.2 is executed, and the agent automatically verifies the health."

**[SCREEN: Switch to browser. Show the Home page. All three health badges are green again.]**
**[SCREEN: Switch to browser. Show the Home page. All health badges are green again.]**

**SAY:**
"All green. PostgreSQL, Redis, API gateway. Health restored. Total time from injection to resolution: under thirty seconds."
"All green. Health restored. Total time from injection to resolution: under thirty seconds."

---

## SCENE 5 — Demo: Verification (2:15 – 2:35)

**[SCREEN: Navigate to the Incident page.]**

**SAY:**
"The incident timeline shows the full lifecycle."

**[SCREEN: Show timeline entries: chaos injected, agent detected, approval granted, remediation executed, health restored.]**
**[SCREEN: Navigate to the Incident page on the dashboard.]**

**SAY:**
"Chaos injected. Agent detected. Approval granted. Remediation executed. Health restored. Every step logged."
"The incident timeline shows the full lifecycle: Chaos injected. Agent detected. Approval granted. Remediation executed. Health restored. Every step logged."

**[SCREEN: Switch to terminal.]**

**[TYPE]:**
**[TYPE IN POWERSHELL]:**
```powershell
curl -s http://localhost:8001/api/state
Invoke-RestMethod http://localhost:8001/api/services
```

**[SCREEN: Show JSON output — no active incidents, all services healthy.]**
Expand All @@ -130,69 +135,14 @@ curl -s http://localhost:8001/api/state
**[SCREEN: Switch to GitHub. Show PR #5 with Qodo review comments.]**

**SAY:**
"We also used Qodo PR-Agent for automated code review. It caught sixteen issues across two pull requests. Hardcoded personal paths, missing build context, unsafe process cleanup. We fixed every one. Two were false positives — dismissed with documented reasoning. Full audit trail in the PR history."
"We also used Qodo PR-Agent for automated code review. It caught sixteen issues across two pull requests. We fixed every one. Full audit trail in the PR history."

**[SCREEN: Switch back to dashboard. All green.]**

**SAY:**
"MissionControl. Autonomous incident response with human-in-the-loop approval. Built with TrueForge, MCP, and Qodo. Thank you."

**[SCREEN: Show GitHub repo URL for 3 seconds.]**
```
```text
https://github.com/ADITYA-tp01/Mission-Control
```

---

## Timing Summary

| Scene | Duration | Content |
|---|---|---|
| 1 | 0:00 – 0:30 | About the project |
| 2 | 0:30 – 1:00 | Tech stack and architecture |
| 3 | 1:00 – 1:40 | Demo: inject chaos + agent detects |
| 4 | 1:40 – 2:15 | Demo: human approval gate + remediation |
| 5 | 2:15 – 2:35 | Demo: verification |
| 6 | 2:35 – 3:00 | Learning + closing |
| **Total** | **3:00** | |

## Commands Used

```powershell
# Setup (run before recording)
git clone https://github.com/ADITYA-tp01/Mission-Control.git
cd Mission-Control
.\scripts\setup.ps1

# Start TrueForge (separate terminal)
npx @truefoundry/trueforge

# Inject chaos
python scripts/trigger_incident.py api-gateway cpu_spike

# Verify state
curl -s http://localhost:8001/api/state
```

## Pre-Recording Checklist

- [ ] Docker Desktop running
- [ ] Node.js 18+ installed
- [ ] Python 3.10+ installed
- [ ] OpenAI API key in .env
- [ ] TrueForge configured with MCP server connected
- [ ] Browser open to localhost:3001
- [ ] PowerShell terminal ready
- [ ] Screen recording software running
- [ ] Desktop clean (no unrelated tabs)
- [ ] Microphone tested

## Post-Recording Checklist

- [ ] Video is under 3:00
- [ ] All text on screen is readable (not blurry)
- [ ] Audio is clear
- [ ] Health badge color change is visible (green to red to green)
- [ ] TrueForge approval prompt is visible
- [ ] Agent reasoning is visible in TrueForge terminal
- [ ] No personal info visible
2 changes: 1 addition & 1 deletion apps/dashboard/app/api/infra/action/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export async function POST(request: NextRequest) {
async function triggerAgent(origin: string, service: string, chaosType: string): Promise<void> {
if (process.env.AUTO_TRIGGER_AGENT === 'false') return
try {
await fetch(`${origin}/api/webhook`, {
await fetch(`http://127.0.0.1:3001/api/webhook`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
Expand Down
73 changes: 73 additions & 0 deletions groq_proxy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import requests
from flask import Flask, request, jsonify, Response
Comment on lines +1 to +2

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. Proxy dependencies are uninstalled 🐞 Bug ≡ Correctness

The new proxy imports Flask and Requests, but the repository's only Python requirements file
contains neither package and the setup scripts perform no pip installation. A clean checkout
following the new python groq_proxy.py instruction therefore fails with ModuleNotFoundError.
Agent Prompt
## Issue description
The documented Groq proxy cannot start in a clean project environment because Flask and Requests are not declared or installed.

## Issue Context
Add an appropriate dependency manifest for the host-side proxy and update setup/documentation so users install it before running the script.

## Fix Focus Areas
- groq_proxy.py[1-2]
- README.md[107-111]
- scripts/setup.ps1[14-22]
- scripts/setup.sh[11-16]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

import os

app = Flask(__name__)

# The actual Groq API endpoint
GROQ_API_URL = "https://api.groq.com/openai/v1"

@app.route('/v1/chat/completions', methods=['POST'])
def proxy_chat_completions():
try:
data = request.get_json()

# Strip unsupported 'reasoning_content' from messages
if 'messages' in data:
for msg in data['messages']:
if 'reasoning_content' in msg:
del msg['reasoning_content']

# Forward the cleaned payload to Groq
headers = {
'Authorization': request.headers.get('Authorization'),
'Content-Type': 'application/json'
}

# Make the request to Groq, passing stream=True to support streaming
stream = data.get('stream', False)
groq_resp = requests.post(
f"{GROQ_API_URL}/chat/completions",
json=data,
headers=headers,
Comment on lines +29 to +32

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

5. Upstream requests never time out 🐞 Bug ☼ Reliability

Both outbound request paths omit a timeout, so a stalled Groq connection can leave the corresponding
proxy request blocked indefinitely. Repeated stalls can accumulate blocked Flask workers and make
the local model provider unresponsive.
Agent Prompt
## Issue description
Outbound Groq calls have no connection or read deadline and may block indefinitely.

## Issue Context
Apply explicit connect/read timeouts to both `requests.post` and `requests.request`, and return a stable gateway-timeout/provider error when they expire. Account for long-lived streaming reads without leaving connection establishment unbounded.

## Fix Focus Areas
- groq_proxy.py[27-34]
- groq_proxy.py[61-67]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

stream=stream
)
Comment on lines +29 to +34

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The outbound request has no timeout, so a stalled Groq connection can block a proxy worker indefinitely and accumulate stuck requests. [possible bug]

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** groq_proxy.py
**Line:** 29:34
**Comment:**
	*Possible Bug: The outbound request has no timeout, so a stalled Groq connection can block a proxy worker indefinitely and accumulate stuck requests.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎


if stream:
def generate():
for line in groq_resp.iter_lines():
if line:
yield line + b'\n\n'

return Response(
generate(),
content_type=groq_resp.headers.get('Content-Type', 'text/event-stream')
)
Comment on lines +42 to +45

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Streaming responses use Flask's default 200 status, so Groq 401, 429, and 5xx errors reach clients as successful responses. [api mismatch]

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** groq_proxy.py
**Line:** 42:45
**Comment:**
	*Api Mismatch: Streaming responses use Flask's default 200 status, so Groq 401, 429, and 5xx errors reach clients as successful responses.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +42 to +45

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

4. Streaming errors become successes 🐞 Bug ≡ Correctness

The streaming branch omits groq_resp.status_code, causing Flask to return HTTP 200 even when Groq
responds with a 4xx or 5xx. Clients can consequently treat authentication, rate-limit, and provider
errors as successful streamed completions.
Agent Prompt
## Issue description
Streaming upstream failures are always exposed to clients with a successful HTTP status.

## Issue Context
Set the downstream response status from `groq_resp.status_code` and preserve relevant upstream headers/error bodies. Add a test for a streamed upstream 4xx response.

## Fix Focus Areas
- groq_proxy.py[27-45]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

else:
return jsonify(groq_resp.json()), groq_resp.status_code

except Exception as e:
print(f"Proxy Error: {e}")
return jsonify({"error": str(e)}), 500

@app.route('/', defaults={'path': ''})
@app.route('/<path:path>', methods=['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'])
def catch_all(path):
# Pass through any other endpoints without modification
headers = {
'Authorization': request.headers.get('Authorization'),
'Content-Type': request.headers.get('Content-Type')
}
groq_resp = requests.request(
method=request.method,
url=f"{GROQ_API_URL}/{path}",
headers=headers,
Comment on lines +61 to +64

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

3. Pass-through duplicates api version 🐞 Bug ≡ Correctness

The catch-all appends the complete incoming path to a base URL that already ends in /v1, so a
request to the configured /v1/models route is sent to Groq as /openai/v1/v1/models. Model
discovery and every non-chat /v1/* endpoint therefore fail upstream.
Agent Prompt
## Issue description
The catch-all duplicates the `/v1` path segment when forwarding OpenAI-compatible endpoints other than chat completions.

## Issue Context
Either use an upstream origin without `/v1` or strip the incoming `v1/` prefix before joining paths. Preserve query parameters and add coverage for `/v1/models`.

## Fix Focus Areas
- groq_proxy.py[7-10]
- groq_proxy.py[53-68]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

data=request.get_data(),
params=request.args
)
return Response(groq_resp.content, status=groq_resp.status_code, headers=dict(groq_resp.headers))

if __name__ == '__main__':
print("Starting Groq API Proxy on http://0.0.0.0:8080")
print("This proxy intercepts requests and removes 'reasoning_content' to prevent 400 errors.")
app.run(host='0.0.0.0', port=8080)
Loading