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: 1 addition & 1 deletion docs/cli/agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Next:
2. Test locally, printing the result instead of commenting:
POST_LINT_DOCS_DRY_RUN=1 fullsend run lint-docs \
--target-repo . --env-file .env.local
.env.local needs GITHUB_ISSUE_URL, ISSUE_NUMBER, REPO_FULL_NAME,
.env.local needs FULLSEND_WORK_ITEM_URL, ISSUE_NUMBER, REPO_FULL_NAME,
GH_TOKEN, ANTHROPIC_VERTEX_PROJECT_ID, CLOUD_ML_REGION, and
GOOGLE_APPLICATION_CREDENTIALS pointing at a GCP credentials file;
the run stops before it starts without them.
Expand Down
4 changes: 2 additions & 2 deletions internal/agentnew/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func buildHarness(opts Options, role Role) (*harness.Harness, error) {
// gives gh a placeholder; the raw value stays in env.runner for the
// post-script.
sandboxEnv := map[string]string{
"ISSUE_URL": "${GITHUB_ISSUE_URL}",
"ISSUE_URL": "${FULLSEND_WORK_ITEM_URL}",
Comment thread
rh-hemartin marked this conversation as resolved.
Resolved
Comment thread
rh-hemartin marked this conversation as resolved.
Resolved
// ISSUE_NUMBER / REPO_FULL_NAME are the fetch arguments the
// generated prompt uses. A github.com URL in a `gh` command is
// blocked by the SSRF PreToolUse hook: the sandbox cannot
Expand Down Expand Up @@ -152,7 +152,7 @@ func buildHarness(opts Options, role Role) (*harness.Harness, error) {
Trigger: opts.Trigger,
Env: &harness.EnvConfig{
Runner: map[string]string{
"ISSUE_URL": "${GITHUB_ISSUE_URL}",
"ISSUE_URL": "${FULLSEND_WORK_ITEM_URL}",
"GH_TOKEN": "${GH_TOKEN}",
"FULLSEND_FORGE": "github",
},
Expand Down
22 changes: 22 additions & 0 deletions internal/agentnew/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,28 @@ func TestGeneratedHarnessKeepsGHTokenOutOfSandbox(t *testing.T) {
}
}

// TestGeneratedHarnessUsesWorkItemURL pins the forge-agnostic work item URL
// variable in both env maps. The generated prompt deliberately does not fetch
// by URL, but the post-script still needs it.
func TestGeneratedHarnessUsesWorkItemURL(t *testing.T) {
files, err := Render(testOptions("lint-docs", "triage"))
if err != nil {
t.Fatal(err)
}
dir := t.TempDir()
writeTree(t, dir, files)
h, err := harness.Load(filepath.Join(dir, "harness", "lint-docs.yaml"))
if err != nil {
t.Fatalf("generated harness does not load: %v", err)
}
if got := h.Env.Runner["ISSUE_URL"]; got != "${FULLSEND_WORK_ITEM_URL}" {
t.Errorf("env.runner ISSUE_URL = %q, want ${FULLSEND_WORK_ITEM_URL}", got)
}
if got := h.Env.Sandbox["ISSUE_URL"]; got != "${FULLSEND_WORK_ITEM_URL}" {
t.Errorf("env.sandbox ISSUE_URL = %q, want ${FULLSEND_WORK_ITEM_URL}", got)
}
}

// TestGeneratedHarnessHasNoDeprecatedShapes pins decision 6: no forge: block
// (deprecated by ADR 0088) and no runner_env (deprecated by ADR 0055). Lint
// would warn, and a generator must never emit a shape the repo has deprecated.
Expand Down
2 changes: 1 addition & 1 deletion internal/agentnew/templates/post.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# iteration and only the last one counts.
#
# Required env:
# ISSUE_URL — HTML URL of the work item (the harness maps GITHUB_ISSUE_URL to it)
# ISSUE_URL — HTML URL of the work item (the harness maps FULLSEND_WORK_ITEM_URL to it)
# GH_TOKEN — minted by fullsend from the harness `role:` field
#
# Optional env:
Expand Down
6 changes: 3 additions & 3 deletions internal/agentnew/testdata/golden/codex.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ env:
runner:
FULLSEND_FORGE: github
GH_TOKEN: ${GH_TOKEN}
ISSUE_URL: ${GITHUB_ISSUE_URL}
ISSUE_URL: ${FULLSEND_WORK_ITEM_URL}
sandbox:
FULLSEND_FORGE: github
ISSUE_NUMBER: ${ISSUE_NUMBER}
ISSUE_URL: ${GITHUB_ISSUE_URL}
ISSUE_URL: ${FULLSEND_WORK_ITEM_URL}
REPO_FULL_NAME: ${REPO_FULL_NAME}
timeout_minutes: 15
trigger: |
Expand Down Expand Up @@ -160,7 +160,7 @@ trigger: |
# iteration and only the last one counts.
#
# Required env:
# ISSUE_URL — HTML URL of the work item (the harness maps GITHUB_ISSUE_URL to it)
# ISSUE_URL — HTML URL of the work item (the harness maps FULLSEND_WORK_ITEM_URL to it)
# GH_TOKEN — minted by fullsend from the harness `role:` field
#
# Optional env:
Expand Down
6 changes: 3 additions & 3 deletions internal/agentnew/testdata/golden/pi-openai.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ env:
runner:
FULLSEND_FORGE: github
GH_TOKEN: ${GH_TOKEN}
ISSUE_URL: ${GITHUB_ISSUE_URL}
ISSUE_URL: ${FULLSEND_WORK_ITEM_URL}
sandbox:
FULLSEND_FORGE: github
ISSUE_NUMBER: ${ISSUE_NUMBER}
ISSUE_URL: ${GITHUB_ISSUE_URL}
ISSUE_URL: ${FULLSEND_WORK_ITEM_URL}
REPO_FULL_NAME: ${REPO_FULL_NAME}
timeout_minutes: 15
trigger: |
Expand Down Expand Up @@ -178,7 +178,7 @@ trigger: |
# iteration and only the last one counts.
#
# Required env:
# ISSUE_URL — HTML URL of the work item (the harness maps GITHUB_ISSUE_URL to it)
# ISSUE_URL — HTML URL of the work item (the harness maps FULLSEND_WORK_ITEM_URL to it)
# GH_TOKEN — minted by fullsend from the harness `role:` field
#
# Optional env:
Expand Down
6 changes: 3 additions & 3 deletions internal/agentnew/testdata/golden/triage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ env:
runner:
FULLSEND_FORGE: github
GH_TOKEN: ${GH_TOKEN}
ISSUE_URL: ${GITHUB_ISSUE_URL}
ISSUE_URL: ${FULLSEND_WORK_ITEM_URL}
sandbox:
ANTHROPIC_VERTEX_PROJECT_ID: ${ANTHROPIC_VERTEX_PROJECT_ID}
CLAUDE_CODE_USE_VERTEX: "1"
CLOUD_ML_REGION: ${CLOUD_ML_REGION}
FULLSEND_FORGE: github
GOOGLE_APPLICATION_CREDENTIALS: /tmp/.gcp-credentials.json
ISSUE_NUMBER: ${ISSUE_NUMBER}
ISSUE_URL: ${GITHUB_ISSUE_URL}
ISSUE_URL: ${FULLSEND_WORK_ITEM_URL}
REPO_FULL_NAME: ${REPO_FULL_NAME}
timeout_minutes: 15
trigger: |
Expand Down Expand Up @@ -172,7 +172,7 @@ trigger: |
# iteration and only the last one counts.
#
# Required env:
# ISSUE_URL — HTML URL of the work item (the harness maps GITHUB_ISSUE_URL to it)
# ISSUE_URL — HTML URL of the work item (the harness maps FULLSEND_WORK_ITEM_URL to it)
# GH_TOKEN — minted by fullsend from the harness `role:` field
#
# Optional env:
Expand Down
6 changes: 3 additions & 3 deletions internal/agentnew/testdata/golden/validation-loop.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ env:
runner:
FULLSEND_FORGE: github
GH_TOKEN: ${GH_TOKEN}
ISSUE_URL: ${GITHUB_ISSUE_URL}
ISSUE_URL: ${FULLSEND_WORK_ITEM_URL}
sandbox:
ANTHROPIC_VERTEX_PROJECT_ID: ${ANTHROPIC_VERTEX_PROJECT_ID}
CLAUDE_CODE_USE_VERTEX: "1"
CLOUD_ML_REGION: ${CLOUD_ML_REGION}
FULLSEND_FORGE: github
GOOGLE_APPLICATION_CREDENTIALS: /tmp/.gcp-credentials.json
ISSUE_NUMBER: ${ISSUE_NUMBER}
ISSUE_URL: ${GITHUB_ISSUE_URL}
ISSUE_URL: ${FULLSEND_WORK_ITEM_URL}
REPO_FULL_NAME: ${REPO_FULL_NAME}
timeout_minutes: 15
trigger: |
Expand Down Expand Up @@ -180,7 +180,7 @@ trigger: |
# iteration and only the last one counts.
#
# Required env:
# ISSUE_URL — HTML URL of the work item (the harness maps GITHUB_ISSUE_URL to it)
# ISSUE_URL — HTML URL of the work item (the harness maps FULLSEND_WORK_ITEM_URL to it)
# GH_TOKEN — minted by fullsend from the harness `role:` field
#
# Optional env:
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/agent_new.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ func printNextSteps(opts agentnew.Options, f agentNewFlags, printer *ui.Printer)
printer.Raw(fmt.Sprintf(" 2. Test locally, printing the result instead of commenting:\n"+
" %s=1 fullsend run %s%s \\\n --target-repo . --env-file .env.local\n",
agentnew.DryRunEnvVar(opts.Name), opts.Name, fullsendDirArg(f.fullsendDir)))
printer.Raw(" .env.local needs GITHUB_ISSUE_URL, ISSUE_NUMBER, REPO_FULL_NAME,\n")
printer.Raw(" .env.local needs FULLSEND_WORK_ITEM_URL, ISSUE_NUMBER, REPO_FULL_NAME,\n")
switch {
case opts.UsesGateway():
printer.Raw(" and GH_TOKEN. The model goes through the inference.gateway block in\n")
Expand Down
2 changes: 1 addition & 1 deletion internal/harness/checkgenerated.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
// Not checked here, on purpose: ValidateRunnerEnvWith. It requires every
// ${VAR} in env.runner/env.sandbox to be set in the calling process, which is
// true in CI and false on a developer's machine. Failing generation because
// GITHUB_ISSUE_URL is unset would make the command unusable for its main
// FULLSEND_WORK_ITEM_URL is unset would make the command unusable for its main
// audience. The consequence is that an unset variable surfaces at
// `fullsend run` time instead; the generated docs say so.
func CheckGenerated(h *Harness, absDir string) ([]Diagnostic, error) {
Expand Down
Loading