feat: extract agent startup into reusable NewAgent for test framework#6956
feat: extract agent startup into reusable NewAgent for test framework#6956
Conversation
…tests Signed-off-by: Dejan Zele Pejchev <pejcev.dejan@gmail.com>
f184f8e to
03170c5
Compare
|
@greptile |
Greptile SummaryThis PR extracts agent startup logic from Key changes:
Design note: The Confidence Score: 4/5
Last reviewed commit: 03170c5 |
| // AgentCredentials contains the credentials needed to authenticate with the control plane. | ||
| type AgentCredentials struct { | ||
| APIKey string | ||
| OrgID string | ||
| EnvID string | ||
| URL string | ||
| SkipVerify bool | ||
| TLSInsecure bool | ||
| } |
There was a problem hiding this comment.
AgentCredentials struct lacks OrgSlug and EnvSlug fields. When buildProContext() constructs a ProContext from AgentCredentials, these fields remain empty strings. However, they are used downstream in execution records — see agent.go lines 355-356:
OrganizationSlug: a.proContext.OrgSlug,
EnvironmentSlug: a.proContext.GetEnvSlug(environmentId),When test frameworks use the AgentCredentials path, execution records will have empty slug fields (falling back to IDs via runner.go's fallback logic).
Consider:
- Adding
OrgSlugandEnvSlugtoAgentCredentialsso test agents can populate them, or - Documenting explicitly that these fields are intentionally omitted for the test scenario
This affects observability and any slug-based tracking in execution records.
Pull request description
Extracts runner/service/runnerClient creation from main.go into
runner.NewAgent()so the control plane test framework can spin up real agents against a test gRPC server without duplicating startup logic.Checklist (choose whats happened)
Breaking changes
Changes
Fixes