-
Notifications
You must be signed in to change notification settings - Fork 13
Workflow Completeness: Only kelos-pr-responder handles KELOS_UPSTREAM_REPO β all other agents break in fork workflowsΒ #876
Description
π€ Kelos Self-Update Agent @gjkim42
Summary
The Kelos controller automatically injects the KELOS_UPSTREAM_REPO environment variable into agent containers when upstreamRepo is set on the Task or TaskSpawner (see api/v1alpha1/task_types.go:131, internal/controller/job_builder.go:307). This enables fork workflows where agents operate on a fork but need to interact with the upstream repo's issues and PRs.
However, only the kelos-pr-responder prompt handles KELOS_UPSTREAM_REPO. All other agents that interact with GitHub via gh commands completely ignore it, meaning their commands target the fork repo instead of the upstream repo.
Evidence
kelos-pr-responder (the only agent that handles it) β added in PR #748:
- Step 1:
gh pr view ... --repo "$KELOS_UPSTREAM_REPO" - Step 2:
gh issue view ... --repo "$KELOS_UPSTREAM_REPO" - Step 7:
gh pr edit ... --repo "$KELOS_UPSTREAM_REPO" - Step 8:
gh pr checks ... --repo "$KELOS_UPSTREAM_REPO"
Agents that use gh commands but do NOT handle KELOS_UPSTREAM_REPO:
| Agent | gh commands affected |
|---|---|
| kelos-workers | gh issue view, gh issue comment, gh pr create, gh pr edit, gh pr checks |
| kelos-reviewer | gh pr view, gh pr review, gh api repos/{owner}/{repo}/pulls/ |
| kelos-planner | gh issue view, gh issue comment |
| kelos-triage | gh issue edit, gh issue comment, gh pr list, gh issue list |
| kelos-squash-commits | gh pr view, gh pr edit, gh issue edit |
| kelos-config-update | gh pr list, gh api, gh pr create, gh pr edit |
| kelos-image-update | gh pr list, gh pr create |
Proposed Fix
Instead of scattering KELOS_UPSTREAM_REPO handling across every prompt step (as pr-responder does), add a single instruction to the AgentConfig level so all agents inherit it:
In self-development/agentconfig.yaml (shared AgentConfig), add:
## GitHub Repository Targeting
When the `KELOS_UPSTREAM_REPO` environment variable is set, all `gh` commands that
interact with issues, PRs, or the GitHub API must include `--repo "$KELOS_UPSTREAM_REPO"`
to target the correct repository. This variable is automatically injected by the Kelos
controller in fork workflows where the agent's workspace is a fork but operations should
target the upstream repo.In all inline AgentConfigs (kelos-workers-agent, kelos-reviewer-agent, kelos-planner-agent, etc.), add the same instruction.
In kelos-pr-responder.yaml, the per-step KELOS_UPSTREAM_REPO instructions can then be simplified or removed, since the AgentConfig already provides the general rule.
Why AgentConfig vs. prompt
- The
KELOS_UPSTREAM_REPOpattern is a cross-cutting concern for all agents, not specific to any one workflow step - Putting it in the AgentConfig avoids repeating it in every prompt and ensures new agents automatically get it
- The pr-responder's current approach of adding it to each step is brittle β when new steps are added, the
--repoflag is often forgotten (as the cubic review on PR Update agent config: address review feedback from recent PRsΒ #748 noted for the CI-check step)
Scope
This issue affects self-development/agentconfig.yaml and all inline AgentConfigs in self-development/*.yaml. No code changes required β only agent prompt/config updates.