Skip to content

feat: Fix babysit gaps#3806

Merged
michaeljguarino merged 8 commits into
masterfrom
fix-github-babysit
Jul 8, 2026
Merged

feat: Fix babysit gaps#3806
michaeljguarino merged 8 commits into
masterfrom
fix-github-babysit

Conversation

@michaeljguarino

@michaeljguarino michaeljguarino commented Jul 6, 2026

Copy link
Copy Markdown
Member

Currently this was not fetching review comments on reprompts, which are another form of comments in the github data model (and which we send for failing terraform plans).

Test Plan

Test environment: https://console.plrldemo.onplural.sh/cd/clusters/a1748282-ce8b-48ab-ae7e-326e74fce04e/services/f3f89a54-d1a7-4bc8-9152-daa07ede918d/components

Checklist

  • I have added a meaningful title and summary to convey the impact of this PR to a user.
  • If required, I have updated the Plural documentation accordingly.
  • I have added tests to cover my changes.
  • I have deployed the agent to a test environment and verified that it works as expected (required only when changing agent code).

Plural Flow: console

@michaeljguarino michaeljguarino requested a review from a team July 6, 2026 14:33
@michaeljguarino michaeljguarino added the enhancement New feature or request label Jul 6, 2026
@soffi-ai

soffi-ai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Soffi AI Summary

This PR bundles several related improvements across the AI agent run feature set, persona configuration, and log viewing UX.

Fix GitHub review comment fetching in agent "babysit" loop: The core bug fix addresses a gap where the agent's reprompt/babysit cycle was not fetching GitHub review comments (a distinct comment type in the GitHub data model, used for PR inline comments and Terraform plan failures) — only regular issue comments were being retrieved. This caused agents to miss critical feedback when responding to failing Terraform plan outputs.

Agent run token/cost usage accounting: A new Usage struct is introduced on AgentRunFragment (and surfaced in the GraphQL schema, Go client, and frontend) to track input/output token counts, cached tokens, reasoning tokens, and associated costs (input cost, output cost, total cost). This data is displayed in the AI agent runs table in the UI, giving operators visibility into per-run LLM costs.

Persona settings — Flows and Workbenches visibility controls: The PersonaConfiguration schema gains a new Flows sub-object (controlling visibility of Pipelines, Previews, and Workbenches within the Flows section) and adds flows and workbenches fields to the Sidebar configuration. The persona edit/create UI is updated accordingly, and the CRD YAML for Personas is regenerated. This lets administrators configure which sections are visible to users with a given persona.

Log viewing improvements: The Logs component and associated LogsRangeBanner are refactored to improve the time-range selection UX and metrics chart display, with the range banner component streamlined significantly.

Workbench model selector refactor: The WorkbenchModelSelector component is simplified (reduced from 78 to 68 lines), likely cleaning up redundant state or rendering logic.

Dependency and CI updates: Dockerfile base image is bumped, the deployment-operator-pr CI workflow is updated (likely a runner or action version change), Trivy security scan config is updated, and the bundled controller Helm chart is bumped to 0.0.196.

Commits

Commit Summary
b00e75b Core bug fix: ensures GitHub review comments (used for PR inline comments and Terraform plan failure feedback) are fetched during the agent babysit/reprompt loop, not just regular issue comments.
9d0268a Adds a Usage struct to AgentRunFragment in the Go client, capturing token counts (input, output, cached, reasoning) and cost breakdowns (input, output, total) for agent runs.
36b1e29 Wires agent run usage accounting into the GraphQL schema and Go client generation; adds the usage field to the agent run GraphQL fragment so cost/token data flows from server to consumers.
fa0891e Removes a UI button (likely a stale or redundant action element in the agent runs or workbench UI).
1ca846f Adds persona settings for Flows and Workbenches visibility: introduces a new Flows configuration sub-object (Pipelines, Previews, Workbenches toggles) and adds flows/workbenches fields to the Sidebar persona config; updates persona create/edit UI and regenerates the Personas CRD YAML.
8205f57 Attempts to fix a previously broken behavior (likely related to persona config or log range display) based on test environment feedback.
20820de Displays agent run token/cost usage in the AI agent runs table in the frontend, surfacing per-run LLM cost data to operators.
2e726b3 Bumps dependencies: Dockerfile base image update, deployment-operator CI workflow runner/action versions updated, Trivy config updated, and bundled controller Helm chart bumped to 0.0.196.

Deploy in Soffi


Updated: 2026-07-08 21:52 UTC

@greptile-apps

greptile-apps Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Fixes a gap in the babysit reprompt loop where GitHub PR review summaries (a separate comment type from issue and inline review comments) were not being fetched, causing the agent to miss bot-posted feedback such as failing Terraform plan reports.

  • github.go: Adds a third paginated fetch via ListReviews, skips empty-body entries (e.g. bare approvals), and sorts all three comment streams together by CreatedAt. ReactToComment short-circuits immediately for the new PRCommentTypeReviewSummary type since GitHub's reaction endpoint does not support review-level comments.
  • scm.go: Introduces PRCommentTypeReviewSummary and a Reactable() helper; PRStateHash now keys on ReactableID() (type-prefixed) instead of the bare numeric ID to avoid potential collisions across comment types.
  • getprstate.go / controller.go: Both prompt-building paths branch on Reactable() and emit a (reviewId: …, not reactable) label so the agent knows not to call reactToComment with those IDs.

Confidence Score: 4/5

Safe to merge; the new review-summary fetch path is additive, well-tested, and guarded against misuse at the reaction endpoint.

All changed code paths are covered by new unit tests, and the only non-test finding is a stale doc comment on ReactableID() that now undersells the non-reactable case.

go/deployment-operator/pkg/scm/scm.go — the ReactableID() doc comment should be updated to reflect the new non-reactable type.

Important Files Changed

Filename Overview
go/deployment-operator/pkg/scm/github.go Adds a third pagination loop to fetch PR review summaries via ListReviews, skipping empty bodies, and sorts the combined result by CreatedAt; correctly short-circuits ReactToComment for the new type.
go/deployment-operator/pkg/scm/scm.go Adds PRCommentTypeReviewSummary constant and Reactable() helper; updates PRStateHash to key on ReactableID() instead of bare ID; doc comment on ReactableID() is now slightly misleading for the new non-reactable type.
go/deployment-operator/pkg/agentrun-harness/controller/controller.go buildBabysitPrompt now branches on Reactable() to emit 'not reactable' label for review summaries, consistent with the getprstate tool.
go/deployment-operator/internal/mcpserver/agent/tool/getprstate.go Comment rendering branches on Reactable() to distinguish reactable vs non-reactable IDs in the prompt shown to the agent.
go/deployment-operator/internal/mcpserver/agent/tool/reacttocomment.go Description and tool description updated to clarify review summaries cannot be passed to reactToComment.
go/deployment-operator/pkg/scm/github_test.go New test verifying allComments fetches review summaries, skips empty-body reviews, and sorts results; covers the new Reactable() == false path.
go/deployment-operator/pkg/agentrun-harness/controller/analysis_gate_test.go New integration test confirming review summary comments surface in babysit context with 'not reactable' label and correct review_summary: prefix.

Comments Outside Diff (1)

  1. go/deployment-operator/pkg/scm/scm.go, line 56-59 (link)

    P2 The ReactableID() doc comment still says this value is what the agent should pass to reactToComment, but that is no longer universally true — calling reactToComment with a review_summary:… ID now returns an error. The misleading doc could cause a developer to call this method and then pass the result directly to ReactToComment without checking Reactable() first.

Reviews (1): Last reviewed commit: "Fix babysit gaps" | Re-trigger Greptile

@michaeljguarino michaeljguarino force-pushed the fix-github-babysit branch 2 times, most recently from 904f20f to ed5a4da Compare July 6, 2026 15:04
@michaeljguarino michaeljguarino changed the title Fix babysit gaps feat: Fix babysit gaps Jul 6, 2026
@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@michaeljguarino michaeljguarino force-pushed the fix-github-babysit branch 2 times, most recently from 613fc05 to e68f605 Compare July 7, 2026 16:21
@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

2 similar comments
@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

Currently this was not fetching review comments on reprompts, which are another form of comments in the github data model (and which we send for failing terraform plans).
@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@michaeljguarino

Copy link
Copy Markdown
Member Author

plural deploy this

@michaeljguarino michaeljguarino force-pushed the fix-github-babysit branch 3 times, most recently from 95f787f to 2fc9f78 Compare July 8, 2026 21:38
@michaeljguarino michaeljguarino merged commit c39e53b into master Jul 8, 2026
214 of 233 checks passed
@michaeljguarino michaeljguarino deleted the fix-github-babysit branch July 8, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants