Skip to content

refactor: extract job agents package out of controller package#951

Merged
adityachoudhari26 merged 2 commits intomainfrom
extract-job-agents-pkg
Apr 9, 2026
Merged

refactor: extract job agents package out of controller package#951
adityachoudhari26 merged 2 commits intomainfrom
extract-job-agents-pkg

Conversation

@adityachoudhari26
Copy link
Copy Markdown
Member

@adityachoudhari26 adityachoudhari26 commented Apr 9, 2026

Resolves #946

Summary by CodeRabbit

  • Refactor
    • Internal code reorganization to improve modularity and maintainability of job agent packages.

Copilot AI review requested due to automatic review settings April 9, 2026 16:58
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 9, 2026

Warning

Rate limit exceeded

@adityachoudhari26 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 17 minutes and 45 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 17 minutes and 45 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 40c3216e-0610-40c4-9b11-44300154fd98

📥 Commits

Reviewing files that changed from the base of the PR and between 7ba7f9d and e09c6ce.

📒 Files selected for processing (12)
  • apps/workspace-engine/pkg/jobagents/argo/argocd.go
  • apps/workspace-engine/pkg/jobagents/argo/argocd_plan.go
  • apps/workspace-engine/pkg/jobagents/argoworkflows/workflow.go
  • apps/workspace-engine/pkg/jobagents/argoworkflows/workflow_test.go
  • apps/workspace-engine/pkg/jobagents/registry.go
  • apps/workspace-engine/pkg/jobagents/terraformcloud/tfe.go
  • apps/workspace-engine/pkg/jobagents/testrunner/testrunner.go
  • apps/workspace-engine/svc/controllers/deploymentplanresult/controller.go
  • apps/workspace-engine/svc/controllers/deploymentplanresult/controller_test.go
  • apps/workspace-engine/svc/controllers/jobdispatch/controller.go
  • apps/workspace-engine/svc/controllers/jobdispatch/getters_postgres.go
  • apps/workspace-engine/svc/controllers/jobdispatch/setters.go
📝 Walkthrough

Walkthrough

Import paths for job agent packages are consolidated, moving from workspace-engine/svc/controllers/jobdispatch/jobagents to workspace-engine/pkg/jobagents across multiple files. Files that depend on the registry and agent implementations are updated to reference the new package location.

Changes

Cohort / File(s) Summary
Job Agent Implementations
apps/workspace-engine/pkg/jobagents/argo/argocd.go, apps/workspace-engine/pkg/jobagents/argo/argocd_plan.go, apps/workspace-engine/pkg/jobagents/argoworkflows/workflow.go, apps/workspace-engine/pkg/jobagents/terraformcloud/tfe.go, apps/workspace-engine/pkg/jobagents/testrunner/testrunner.go, apps/workspace-engine/pkg/jobagents/registry.go
Updated types import path from svc/controllers/jobdispatch/jobagents/types to pkg/jobagents/types; interface assertions updated to reference types from new package location.
Job Agent Test
apps/workspace-engine/pkg/jobagents/argoworkflows/workflow_test.go
Updated argo_workflows import from svc/controllers/jobdispatch/jobagents/argoworkflows to pkg/jobagents/argoworkflows.
Deployment Plan Result Controller
apps/workspace-engine/svc/controllers/deploymentplanresult/controller.go, apps/workspace-engine/svc/controllers/deploymentplanresult/controller_test.go, apps/workspace-engine/svc/controllers/deploymentplanresult/getters_postgres.go
Updated registry and agent package imports to use pkg/jobagents instead of svc/controllers/jobdispatch/jobagents; NewController parameter type references new registry location.
Job Dispatch Controller
apps/workspace-engine/svc/controllers/jobdispatch/controller.go, apps/workspace-engine/svc/controllers/jobdispatch/getters_postgres.go, apps/workspace-engine/svc/controllers/jobdispatch/setters.go
Updated all job agent package imports (argo, argoworkflows, github, terraformcloud, testrunner, registry) from svc/controllers/jobdispatch/jobagents to pkg/jobagents; Setter interface embedded types now resolve to new locations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers

  • jsbroks

Poem

🐰 Hops of joy through package trees,
Import paths reorganized with ease,
From deep controllers to pkg so bright,
Job agents dance in their new light! 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly summarizes the main change: extracting job agents from a controller package into a separate package, which is exactly what all file changes accomplish.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch extract-job-agents-pkg

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the workspace-engine job dispatching “job agents” out of the svc/controllers/... tree into a reusable pkg/jobagents package, and updates controllers/tests to import the new package paths.

Changes:

  • Moved job agent code under apps/workspace-engine/pkg/jobagents and updated controller imports accordingly.
  • Introduced a shared pkg/jobagents/types capability interface set (Dispatchable/Plannable/Verifiable + PlanResult).
  • Added/ported agent implementations and accompanying unit tests (ArgoCD, Argo Workflows, GitHub Actions, Terraform Cloud, TestRunner).

Reviewed changes

Copilot reviewed 13 out of 26 changed files in this pull request and generated no comments.

Show a summary per file
File Description
apps/workspace-engine/svc/controllers/jobdispatch/setters.go Updates jobdispatch controller imports to new pkg/jobagents/... paths.
apps/workspace-engine/svc/controllers/jobdispatch/getters_postgres.go Switches jobagents import to pkg/jobagents.
apps/workspace-engine/svc/controllers/jobdispatch/controller.go Wires controller to agents from pkg/jobagents/* instead of controller-local packages.
apps/workspace-engine/svc/controllers/deploymentplanresult/getters_postgres.go Updates imports for jobagents and specific agents.
apps/workspace-engine/svc/controllers/deploymentplanresult/controller.go Switches jobagents import to new package location.
apps/workspace-engine/svc/controllers/deploymentplanresult/controller_test.go Updates test imports to new pkg/jobagents and pkg/jobagents/types.
apps/workspace-engine/pkg/jobagents/types/types.go Adds shared agent capability interfaces and PlanResult.
apps/workspace-engine/pkg/jobagents/testrunner/testrunner.go Updates types import to pkg/jobagents/types.
apps/workspace-engine/pkg/jobagents/testrunner/testrunner_test.go Adds unit tests for TestRunner dispatch/plan behavior and concurrency.
apps/workspace-engine/pkg/jobagents/terraformcloud/workspace.go Adds Terraform Cloud workspace templating/upsert + variable sync + webhook config helpers.
apps/workspace-engine/pkg/jobagents/terraformcloud/tfe.go Updates types import to pkg/jobagents/types.
apps/workspace-engine/pkg/jobagents/terraformcloud/tfe_test.go Adds unit tests for Terraform Cloud config parsing and option builders.
apps/workspace-engine/pkg/jobagents/terraformcloud/config.go Adds Terraform Cloud agent config parsing + client creation helper.
apps/workspace-engine/pkg/jobagents/registry.go Updates types import to pkg/jobagents/types.
apps/workspace-engine/pkg/jobagents/github/workflow_dispatcher.go Adds GitHub App auth + workflow dispatch implementation.
apps/workspace-engine/pkg/jobagents/github/githubaction.go Adds GitHub Actions job agent that dispatches workflows asynchronously.
apps/workspace-engine/pkg/jobagents/github/githubaction_test.go Adds unit tests for GitHub agent dispatch + config parsing + concurrency.
apps/workspace-engine/pkg/jobagents/github/config.go Adds GitHub agent config parsing helpers.
apps/workspace-engine/pkg/jobagents/argoworkflows/workflow.go Updates types import to pkg/jobagents/types.
apps/workspace-engine/pkg/jobagents/argoworkflows/workflow_test.go Updates import path for argoworkflows package.
apps/workspace-engine/pkg/jobagents/argoworkflows/workflow_submitter.go Adds Argo Workflows submitter with retry + idempotency check.
apps/workspace-engine/pkg/jobagents/argo/argocd.go Updates types import to pkg/jobagents/types.
apps/workspace-engine/pkg/jobagents/argo/argocd_verification.go Adds ArgoCD verification metric spec builder.
apps/workspace-engine/pkg/jobagents/argo/argocd_plan.go Updates types import to pkg/jobagents/types.
apps/workspace-engine/pkg/jobagents/argo/argoapp_test.go Adds comprehensive ArgoCD agent tests including dispatch, verifications, and plan/diff.
apps/workspace-engine/pkg/jobagents/argo/application_upserter.go Adds ArgoCD API upserter/deleter/manifest getter implementations with retry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@adityachoudhari26 adityachoudhari26 merged commit 8b16c98 into main Apr 9, 2026
7 of 8 checks passed
@adityachoudhari26 adityachoudhari26 deleted the extract-job-agents-pkg branch April 9, 2026 17:11
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.

refactor: extract job agents package out of job dispatch controller

2 participants