feat(#807): make code agent multi-forge (GitHub + GitLab) - #813
feat(#807): make code agent multi-forge (GitHub + GitLab)#813fullsend-ai-coder[bot] wants to merge 1 commit into
Conversation
|
🤖 Finished Review · ✅ Success · Started 9:21 PM UTC · Completed 9:40 PM UTC Commit: |
ReviewFindingsMedium
Low
Previous runReviewFindingsMedium
Low
Previous run (2)ReviewFindingsMedium
Low
Previous run (3)ReviewFindingsMedium
Low
Previous run (4)ReviewFindingsMedium
Low
Previous run (5)ReviewFindingsMedium
Low
Previous run (6)ReviewFindingsMedium
Low
Previous run (7)ReviewFindingsMedium
Low
Previous run (8)ReviewFindingsMedium
Low
Previous run (9)ReviewFindingsHigh
Medium
Low
Labels: PR modifies the code agent (agents/, harness/, scripts/, policies/) Next steps:
|
b6f6f6a to
55b5185
Compare
|
🤖 Finished Review · ✅ Success · Started 1:30 AM UTC · Completed 1:49 AM UTC Commit: |
Superseded by updated review
55b5185 to
569e30f
Compare
|
🤖 Review · Commit: |
569e30f to
3171e2f
Compare
|
🤖 Finished Review · ✅ Success · Started 2:16 AM UTC · Completed 2:36 AM UTC Commit: |
3171e2f to
61fca6f
Compare
|
🤖 Finished Review · ✅ Success · Started 2:42 AM UTC · Completed 3:04 AM UTC Commit: |
61fca6f to
65cb980
Compare
|
🤖 Finished Review · ✅ Success · Started 3:09 AM UTC · Completed 3:28 AM UTC Commit: |
65cb980 to
dd3424a
Compare
|
🤖 Review · Commit: |
dd3424a to
37d2e76
Compare
|
🤖 Finished Review · ✅ Success · Started 3:36 AM UTC · Completed 3:51 AM UTC Commit: |
37d2e76 to
8381f0a
Compare
|
🤖 Finished Review · ✅ Success · Started 3:55 AM UTC · Completed 4:14 AM UTC Commit: |
8381f0a to
a3a5f9d
Compare
|
🤖 Finished Review · ✅ Success · Started 4:19 AM UTC · Completed 4:40 AM UTC Commit: |
a3a5f9d to
15c968f
Compare
|
🤖 Finished Review · ✅ Success · Started 4:47 AM UTC · Completed 5:04 AM UTC Commit: |
Add forge-dispatch architecture to the code agent, following the patterns established by the triage agent in PR #686. New ops libraries: - scripts/lib/code-ops.lib.sh: forge dispatcher (FULLSEND_FORGE) - scripts/lib/github-code-ops.lib.sh: GitHub impl using gh CLI - scripts/lib/gitlab-code-ops.lib.sh: GitLab impl using curl Refactored scripts: - pre-code.src.sh: uses forge_* functions for URL validation, existing-PR check, label/comment operations - post-code.src.sh: uses forge_* functions for push auth, PR/MR creation, auto-merge, assignee resolution, labels, comments, and CI URL generation Configuration: - harness/code.yaml: added forge.gitlab section with policy, skills, host_files, and env vars - policies/github/code.yaml: existing policy moved to forge dir - policies/gitlab/code.yaml: GitLab-specific network policy (curl binary, gitlab.com endpoints) - env/github/code.env: GitHub-specific vars (ISSUE_URL, GH_TOKEN) - env/gitlab/code.env: GitLab-specific vars (ISSUE_URL, GITLAB_TOKEN) - env/code.env: shared vars only (git identity, timeouts, Go) Key design decisions: - PR_NUMBER_FROM_URL convention preserved to avoid SC2153 - forge_list_prs_for_branch propagates errors (fail-closed) - post-failure-report.lib.sh left untouched (fix agent compat) - pr-assignee.lib.sh left untouched; GitLab ops remap response shapes to match GitHub expected format Related to #807 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Greg Allen <gallen@redhat.com>
15c968f to
d7e7cbb
Compare
|
🤖 Finished Review · ✅ Success · Started 5:06 AM UTC · Completed 5:26 AM UTC Commit: |
| GITLAB_HOST=$(echo "${url}" | sed -E 's|^https://([^/]+)/.*|\1|') | ||
| REPO_FULL_NAME=$(echo "${url}" | sed -E 's|^https://[^/]+/(.+)/-/issues/[0-9]+$|\1|') | ||
| REPO_ENCODED=$(printf '%s' "${REPO_FULL_NAME}" | jq -sRr @uri) | ||
| ISSUE_NUMBER=$(basename "${url}") |
There was a problem hiding this comment.
[low] logic-error
forge_get_repo_merge_methods never sets squash (s) to true. GitLab controls squash via squash_option, not merge_method. forge_enable_auto_merge ignores the _method_flag parameter. However, enable_auto_merge in post-code.src.sh short-circuits for GitLab before reaching the merge-method resolution code, so CODE_AUTO_MERGE_METHOD has no effect on GitLab.
| if [[ -z "${project_id}" ]]; then | ||
| gha_echo warning "Could not resolve project ID for fork-MR filtering — failing closed" | ||
| return 1 | ||
| fi |
There was a problem hiding this comment.
[low] logic-error
forge_write_output is a no-op when GITHUB_OUTPUT is unset (normal on GitLab CI). The pr_url output is silently dropped. Documented as intentional.
| _gitlab_code_api POST "/projects/${REPO_ENCODED}/issues/${ISSUE_NUMBER}/notes" \ | ||
| --data-urlencode "body=${body}" > /dev/null 2>/dev/null | ||
| } | ||
|
|
There was a problem hiding this comment.
[low] consumer-completeness
forge_list_prs_for_issue returns empty on API failure (|| true) rather than failing closed. Matches the identical GitHub implementation pattern.
| @@ -265,6 +270,10 @@ EOF | |||
|
|
|||
| post_failure_workflow_run_url() { | |||
There was a problem hiding this comment.
[low] dead-code
post-fix.sh does not source code-ops.lib.sh, so declare -F forge_* dispatch checks in its bundled post-failure-report.lib.sh copy are dead code. The fallback to gh CLI is correct.
| port: 443 | ||
| protocol: rest | ||
| enforcement: enforce | ||
| access: read-only |
There was a problem hiding this comment.
[low] sandbox-network-policy-broadening
GitLab sandbox policy allows **/curl binary for gitlab_api network access. Architecturally necessary (no glab CLI equivalent). Restricted to gitlab.com and gitlab.cee.redhat.com endpoints with access: read-only.
| return 0 | ||
| fi | ||
|
|
||
| echo "Assigning PR #${target_pr} to ${assignee}..." |
There was a problem hiding this comment.
[low] assignee-regex-relaxation
Assignee format validation regex relaxed from ^[a-zA-Z0-9_-]+$ to ^[a-zA-Z0-9_.-]+$, adding dot for GitLab username compatibility. No injection risk from adding dots to the allowed character set.
| @@ -0,0 +1,3 @@ | |||
| export ISSUE_URL="${GITHUB_ISSUE_URL}" | |||
| export GH_TOKEN=${GH_TOKEN} | |||
There was a problem hiding this comment.
[low] env-file-quoting-inconsistency
GH_TOKEN is exported without quotes while ISSUE_URL and FULLSEND_FORGE are quoted. Pre-existing pattern in env/code.env, not a regression.
Summary
Make the code agent support both GitHub and GitLab by introducing a forge-dispatch architecture, following the patterns established by the triage agent in PR #686.
Changes
code-ops.lib.sh(forge dispatcher),github-code-ops.lib.sh(~20 functions usingghCLI), andgitlab-code-ops.lib.sh(~20 functions usingcurlagainst GitLab REST API)pre-code.src.sh): Replaced GitHub-specific URL validation, existing-PR checks, and label/comment operations with forge-neutralforge_*function callspost-code.src.sh): Replaced all 25+ghCLI calls withforge_*functions for push auth, PR/MR creation, auto-merge, assignee resolution, labels, comments, and CI URL generationcode.yaml): Addedforge.gitlabsection with policy, skills, host_files, and env vars matching the triage harness patternpolicies/github/code.yaml; createdpolicies/gitlab/code.yamlwithcurlbinary allowlist and GitLab API endpointsenv/code.env) + forge-specific (env/github/code.env,env/gitlab/code.env)Design decisions
PR_NUMBER_FROM_URLnaming convention preserved to avoid shellcheck SC2153 (per repo convention)forge_list_prs_for_branch()propagates errors to maintain fail-closed security behaviorpost-failure-report.lib.shandpr-assignee.lib.shleft untouched for fix agent compatibility; GitLab ops remap response shapes to match GitHub expected formatmerge_when_pipeline_succeeds(no merge queue equivalent)oauth2:TOKENformat (notx-access-token)Testing
post-code-test.shtests pass (including security integration tests)pre-code-test.shtests pass (updated test env to includeFULLSEND_FORGE=github)shellcheck -x -e SC1091,SC2001,SC2016passes on all source and bundled scriptsmake check-bundleconfirms bundled scripts match sourcehack/lint-agent-docspassesCloses #807
Post-script verification
agent/807-multi-forge-code)693ed83bbd5289e1ef13d6c7a3772f61efc43c86..HEAD)