As an
Engineer who previously ran opsctrl diagnose
I want to
retrieve and optionally apply the recommended fix for a pod issue
So that
I can resolve issues faster using previously validated suggestions
✅ Acceptance Criteria
🧩 CLI Behavior
-
Command Format:
- User runs:
opsctrl fix <pod> --namespace <ns>
-
Fetch Prior Diagnosis:
-
CLI sends a request to the backend with:
pod name, namespace, org_id, auth token
-
Backend returns the last diagnosis for this pod (within a TTL window, e.g. 15 mins).
-
Display Mode (default):
-
CLI prints:
💡 Suggested Fix (from last diagnosis):
- "Update the image tag to a valid one or configure imagePullSecrets."
🛠️ Suggested Patch:
kubectl set image deployment/api api=myregistry.io/api:1.2.4
⚠️ Apply this fix with: opsctrl fix <pod> --apply
-
Apply Mode (opt-in):
-
RBAC & Gating:
🔐 Backend Responsibilities
-
Last Diagnosis Lookup:
-
Role Validation:
- Return RBAC context (e.g., canApplyFix: true/false)
- Fix metadata includes
runnable: true/false
-
Audit Log (if applied):
🧩 Suggested Tasks (GitHub Issues)
CLI
Backend
Integration
Would you like me to draft the GitHub issue templates for these as well? Or do you want to continue shaping more features (e.g., audit log views, dashboard webhook, Slack flow, etc.)?
As an
Engineer who previously ran
opsctrl diagnoseI want to
retrieve and optionally apply the recommended fix for a pod issue
So that
I can resolve issues faster using previously validated suggestions
✅ Acceptance Criteria
🧩 CLI Behavior
Command Format:
opsctrl fix <pod> --namespace <ns>Fetch Prior Diagnosis:
CLI sends a request to the backend with:
pod name,namespace,org_id, auth tokenBackend returns the last diagnosis for this pod (within a TTL window, e.g. 15 mins).
Display Mode (default):
CLI prints:
Apply Mode (opt-in):
If
--applyflag is passed:CLI prompts for confirmation:
On confirmation, CLI runs the fix using:
kubectl, if it’s a safe 1-liner (e.g., image update)kubectl apply -f -Output includes success/failure and the actual command run.
RBAC & Gating:
If the user is not authorized (based on org policy):
CLI exits with:
🔐 Backend Responsibilities
Last Diagnosis Lookup:
API:
GET /diagnosis/<pod>?namespace=<ns>Lookup by pod + org + timestamp
Must return:
{ "diagnosis": "...", "suggested_fix": "...", "fix_command": "...", "confidence_score": 0.92, "timestamp": "2025-05-07T13:04Z" }Role Validation:
runnable: true/falseAudit Log (if applied):
If user runs with
--apply, backend receives webhook or event to log:🧩 Suggested Tasks (GitHub Issues)
CLI
fixCommand Scaffolding--applyExecutionBackend
Integration
Would you like me to draft the GitHub issue templates for these as well? Or do you want to continue shaping more features (e.g., audit log views, dashboard webhook, Slack flow, etc.)?