Prevent wrong-scope GitOps agent deletion#647
Conversation
Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
|
|
There was a problem hiding this comment.
Risk Assessment: Low
Decision: Eligible for approval — no additional reviewers required. (GitHub blocked bot self-approval on this PR.)
Evidence (from diff only)
| Area | Change | Impact |
|---|---|---|
src/registry/toolsets/gitops.ts |
resource_scope made required for gitops_agent delete; docs updated |
Fixes wrong-scope DELETE when org/project defaults are suppressed |
src/registry/index.ts |
Required-param validation also rejects empty strings | Fail-closed guard; prevents resource_scope: "" bypass |
| Tests | Registry + harness_delete regressions for omitted/empty/explicit scopes |
Strong coverage for the fixed path |
tasks/todo.md |
Internal task notes | No runtime impact |
Rationale
- Blast radius: Narrow — primary behavior change is GitOps agent deletion; the registry one-liner is defensive validation on an existing required-param check.
- Complexity: Low; logic is easy to follow and well tested.
- Operational risk: Reduces risk (prevents accidental account-scoped deletion of a project agent with the same raw ID).
- Breaking change: Callers omitting
resource_scopewill now error instead of issuing a destructive wrong-scope request — intentional and correct.
No CODEOWNERS gate detected. No reviewers assigned.
Sent by Cursor Automation: Assign PR reviewers
There was a problem hiding this comment.
Inline comment autofix — no comments to address
Triggered on ready_for_review for PR #647. Checked GitHub review threads and inline review comments via API — none found from human reviewers.
No code changes were made on this run. When inline review comments are left on the diff, this automation will attempt a minimal fix and reply on each thread.
Sent by Cursor Automation: Autofix PR review comments


Description
Fixes a destructive scope-resolution bug in
gitops_agentdeletion. Because GitOps agents use raw identifiers and support account, org, and project scope, omittingresource_scopecaused the registry'sscopeOptionalbehavior to omit configured org/project defaults and issue an account-scoped DELETE. A project-context deletion could therefore remove an account agent with the same identifier.The operation now requires explicit
resource_scope, rejects empty required params, documents safe account/org/project calls, and includes registry and public-handler regression coverage.Type of Change
Checklist
pnpm testpassespnpm typecheckpassespnpm buildpassespnpm standards:checkpasses (architecture guardrails — see docs/coding-standards.md)pnpm docs:checkpasses (if registry/tool counts changed)Coding Standards (registry-driven MCP model)
If this PR adds or changes Harness API coverage:
server.registerTool()calls — only toolset definitions insrc/registry/toolsets/ALL_TOOLSETSandToolsetNameunionoperationPolicyon every new/changed endpointsrc/registry/extractors.ts(no raw passthrough on real endpoints)identifierFieldsandscopedeclared on new resourcesconsole.log()insrc/(stdio JSON-RPC safety)