Skip to content

feat(gitops): add read commands for app details, agent metrics and dashboard - #505

Draft
BlueLabelscotch wants to merge 4 commits into
mainfrom
feat/gitops-reads
Draft

BlueLabelscotch wants to merge 4 commits into
mainfrom
feat/gitops-reads

Conversation

@BlueLabelscotch

@BlueLabelscotch BlueLabelscotch commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Adds read-only GitOps commands:

  • get gitops_app_resource_tree, gitops_app_event, gitops_pod_log, gitops_managed_resource, gitops_resource_action take <agent>/<app>
  • get gitops_agent_metrics <agent> --start-time --end-time [--source], which rejects a start after the end or a range over 14 days (the API silently returns an empty result for both)
  • get gitops_dashboard

Only gitops_dashboard was checked against real data. The other commands reach the right endpoints, but every agent in my test project is disconnected, so they only returned "Agent is disconnected". Their output is the raw response (--format json or --yaml), not tuned fields. gitops_cluster_link and the write commands are not included.

…gs, managed resources, resource actions, agent metrics and dashboard
@augmentcode

augmentcode Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

CLI Grammar Review · session (Harness team members only) · fe0e7ca

CLI grammar changes (beta) · Advisory only, FYI, not required changes.

  • 🟡 New harness get gitops_metrics <agent>: --start-time, --end-time, --source
    • Other time-range flags use --from/--to (3 in rt.spec.yaml) or --start-at/--end-at (fme). Consider --from/--to.
    • Alias gitops_metric is singular; noun is already plural, so likely fine.
  • 🟢 New harness get gitops_tree (gitops_trees) <agent/app>: --app-namespace
  • 🟢 New harness get gitops_log (gitops_logs) <agent/app>: --pod-name, --namespace, --container, --tail-lines, --app-namespace
  • 🟢 New harness list gitops_event (gitops_events) <agent/app>: --app-namespace
  • 🟢 New harness list gitops_resource (gitops_resources) <agent/app>: --app-namespace
  • 🟢 New harness list gitops_action (gitops_actions) <agent/app>: --namespace, --resource-name, --kind, --group, --version, --app-namespace
  • 🟢 New harness get gitops_dashboard (gitops_dashboards)

Overall: 🟡 Recommend manual review

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Deep Code Review Agent🐛

Review completed with 4 suggestions.

Reviewed commit: f735eb8

Comment thread pkg/spec/gitops.spec.yaml
verb: get
noun: gitops_pod_log
short: "Get pod logs of an application: harness get gitops_pod_log <agent/app> [--pod-name ...]"
handler_type: endpoint

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Deep Code Review Agent🐛

get gitops_pod_log uses the generic endpoint handler for the streaming PodLogs API. That handler reads the whole body and unmarshals it as one JSON value (pkg/client/client.go:268–291), so a successful response with multiple log entries fails as malformed API response before any output can be rendered.

Severity: high


🤖 Was this useful? React with 👍 or 👎

Comment thread pkg/spec/gitops.spec.yaml Outdated
item_expr: it
yaml_pick_expr: it
query_params:
podName: 'flags["pod-name"] != "" ? flags["pod-name"] : nil'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Deep Code Review Agent🐛

The PodLogs API reads query.podName, query.namespace, query.container, and query.tailLines, but get gitops_pod_log sends all four without the query. prefix. The request therefore does not bind the caller’s filters or tail limit, potentially selecting more logs than requested.

Severity: medium


🤖 Was this useful? React with 👍 or 👎

Comment thread pkg/spec/gitops.spec.yaml
noun: gitops_app_resource_tree
short: "Get the Kubernetes resource tree of an application: harness get gitops_app_resource_tree <agent/app>"
handler_type: endpoint
id_parts: 2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Deep Code Review Agent🐛

get gitops_app_resource_tree cannot target applications stored as namespace/app: id_parts: 2 rejects agent/namespace/app, and the command does not expose the API’s separate application-namespace parameter. Other locations where this applies: pkg/spec/gitops.spec.yaml:1307, :1319, :1345, :1357.

Severity: medium


🤖 Was this useful? React with 👍 or 👎

Comment thread pkg/spec/gitops.spec.yaml Outdated
yaml_pick_expr: it

- command: get gitops_app_event
verb: get

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Deep Code Review Agent🐛

gitops_app_event takes an application ID and returns zero or more events, not one named event, so verb: get conflicts with the get/list cardinality rule in AGENTS.md and docs/verbs.md. Other locations where this applies: pkg/spec/gitops.spec.yaml:1341 (gitops_managed_resource), :1353 (gitops_resource_action).

Severity: low


🤖 Was this useful? React with 👍 or 👎

@BlueLabelscotch

Copy link
Copy Markdown
Collaborator Author

cosmos review

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Deep Code Review Agent🐛

Review completed with 2 suggestions.

Reviewed commit: fe0e7ca

return nil, fmt.Errorf("range is over 14 days (the metrics retention window); use a shorter range")
}
return map[string]string{
"startTime": start.UTC().Format(time.RFC3339),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Deep Code Review Agent🐛

metricsRangeParams validates timestamps with fractional seconds but drops the fraction when building startTime and endTime. A valid range entirely within one second is sent as two identical timestamps, so the API does not receive the window the CLI validated.

Severity: medium


🤖 Was this useful? React with 👍 or 👎

Comment thread pkg/spec/gitops.spec.yaml
- id: count
expr: it.count
- id: last_seen
expr: it.lastTimestamp

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Deep Code Review Agent🐛

gitops_event.last_seen reads only the legacy lastTimestamp field, so events that report their observation time through series.lastObservedTime or eventTime can show a blank last_seen even though the API response includes the time.

Severity: low


🤖 Was this useful? React with 👍 or 👎

@BlueLabelscotch
BlueLabelscotch marked this pull request as draft November 19, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant