Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/cli/agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ command refuses an unknown one up front. The hosted mint serves these:
| `retro` | `actions:read`, `contents:read`, `pull_requests:write`, `issues:write`, `metadata:read` | vertex-ai, github-ro, github-artifacts |
| `prioritize` | `contents:read`, `issues:write`, `organization_projects:write`, `metadata:read` | vertex-ai, github-ro |

A `review` agent also gets `readonly_repo: true`: the checked-out repository is made read-only in the sandbox, so a reviewer cannot modify the code it reviews. That matches `harness/review.yaml` in fullsend-ai/agents.
Comment thread
waynesun09 marked this conversation as resolved.
Resolved

Pick the role whose permissions fit what the agent does. An unknown role fails
immediately with this table, rather than returning `403` from the mint the
first time the agent runs. To use a role the hosted mint does not serve, you
Expand Down
1 change: 1 addition & 0 deletions internal/agentnew/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ func buildHarness(opts Options, role Role) (*harness.Harness, error) {
Effort: opts.Effort,
PostScript: "scripts/post-" + opts.Name + ".sh",
TimeoutMinutes: opts.TimeoutMinutes,
ReadonlyRepo: role.ReadonlyRepo,
Trigger: opts.Trigger,
Env: &harness.EnvConfig{
Runner: map[string]string{
Expand Down
6 changes: 6 additions & 0 deletions internal/agentnew/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,12 @@ func TestRoleImageReachesTheHarness(t *testing.T) {
if h.OpenShell == nil || !reflect.DeepEqual(h.OpenShell.Profiles, role.Profiles) {
t.Errorf("role %q: profiles = %v, want %v", name, h.OpenShell, role.Profiles)
}
// readonly_repo must survive into the emitted YAML, not only sit on
// the Role struct: a generated review harness that ships writable
// lets the reviewer modify the code it reviews.
if h.ReadonlyRepo != role.ReadonlyRepo || h.ReadonlyRepo != (name == "review") {
t.Errorf("role %q: readonly_repo = %v, want %v", name, h.ReadonlyRepo, name == "review")
}
seen[role.Image] = true
}
// Both image constants must be reachable, or one is dead configuration.
Expand Down
11 changes: 8 additions & 3 deletions internal/agentnew/roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ type Role struct {
Profiles []string
// Image is the sandbox image this role's agents run under.
Image string
// ReadonlyRepo mirrors the fleet: the review harness makes the checked-out
// repository read-only in the sandbox, so a reviewer cannot modify the
// code it reviews. Set for roles whose fleet harness sets `readonly_repo`.
ReadonlyRepo bool
}

// roleTable is the set of roles `agent new` will generate for. Excluded on
Expand All @@ -60,9 +64,10 @@ var roleTable = map[string]Role{
"contents": "read", "pull_requests": "write", "issues": "write",
"checks": "read", "metadata": "read",
},
Providers: []string{"providers/vertex-ai.yaml", "providers/github-ro.yaml"},
Profiles: []string{"profiles/fullsend-vertex-ai.yaml", "profiles/fullsend-github-ro.yaml"},
Image: config.DefaultCodeImage,
Providers: []string{"providers/vertex-ai.yaml", "providers/github-ro.yaml"},
Profiles: []string{"profiles/fullsend-vertex-ai.yaml", "profiles/fullsend-github-ro.yaml"},
Image: config.DefaultCodeImage,
ReadonlyRepo: true,
Comment thread
waynesun09 marked this conversation as resolved.
Resolved
},
"coder": {
Name: "coder",
Expand Down
12 changes: 12 additions & 0 deletions internal/agentnew/roles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,15 @@ func TestCoderUsesEmbeddedGithubProvider(t *testing.T) {
t.Errorf("coder should use providers/github.yaml, got %v", role.Providers)
}
}

// TestReviewRoleMountsTheRepositoryReadOnly pins fleet parity: the review
// harness in fullsend-ai/agents sets readonly_repo, and only the review role
// does.
func TestReviewRoleMountsTheRepositoryReadOnly(t *testing.T) {
for _, name := range RoleNames() {
want := name == "review"
if got := roleTable[name].ReadonlyRepo; got != want {
t.Errorf("role %q: ReadonlyRepo = %v, want %v", name, got, want)
}
}
}
Loading