Skip to content

feat(forge): add Forgejo/Gitea forge.Client - #9524

Closed
MrGeek0s wants to merge 2 commits into
fullsend-ai:mainfrom
MrGeek0s:feature/Forgejo-API-Client
Closed

MrGeek0s wants to merge 2 commits into
fullsend-ai:mainfrom
MrGeek0s:feature/Forgejo-API-Client

Conversation

@MrGeek0s

Copy link
Copy Markdown

Summary

  • Adds internal/forge/forgejo implementing forge.Client for Forgejo/Gitea API v1
  • Wires CLI DetectForge, harness validation, and repos forge enum
  • Includes Actions/reactions/variables/review-thread coverage plus review fixes (no hardcoded default host, nil token scopes, no forgejo→GitHub mint/status fallthrough)
  • Replaces closed feat(forge): add Forgejo/Gitea forge.Client #9522 after DCO-signed history rewrite

Test plan

  • go test ./internal/forge/forgejo/ ./internal/forge/ -count=1
  • go test ./internal/harness/ -run TestValidateForge
  • go test ./internal/cli/ -run TestNewForgeClient_Forgejo
  • Upstream CI Route/Harness + DCO green
  • Reviewer pass on remaining Medium Qodo notes

Made with Cursor

MrGeek0s and others added 2 commits November 15, 2026 22:33
Implement forge.Client for Forgejo/Gitea API v1 with CLI DetectForge
wiring, Actions/reactions/review-thread coverage, and review fixes
(no hardcoded default host, nil scopes, no GitHub mint fallthrough).

Signed-off-by: mrgeek <yassine.elfhama@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: mrgeek <yassine.elfhama@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@MrGeek0s
MrGeek0s requested a review from a team as a code owner November 16, 2026 03:35
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Add Forgejo/Gitea forge client and CLI integration

✨ Enhancement 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Add a Forgejo/Gitea API v1 client for repository, review, Actions, and reaction operations.
• Recognize Forgejo in remote detection, manifests, and CLI client creation without a default host.
• Keep Forgejo out of GitHub token minting and status notifications; document unsupported
 operations.
Diagram

graph TD
  Remote["Git remote"] --> Detect["Forge detection"] --> Factory["CLI client factory"] --> Client["Forgejo client"] --> API["Forgejo API v1"]
  Manifest["Manifest validation"] --> Factory
  Client --> Unsupported["Unsupported methods"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Use a Forgejo/Gitea SDK
  • ➕ Reuse maintained request models and endpoint handling.
  • ➖ Adds a dependency and still requires adaptation to the broad forge.Client interface.

Recommendation: The direct REST adapter is reasonable for an incremental forge.Client implementation and keeps unsupported behavior explicit. Consider an SDK if API compatibility and endpoint maintenance become a recurring burden.

Files changed (20) +2484 / -11

Enhancement (11) +2119 / -10
forge_client.goCreate Forgejo clients from instance URL and environment credentials +36/-3

Create Forgejo clients from instance URL and environment credentials

• Adds Forgejo/Gitea token resolution and a Forgejo factory branch. A manifest URL takes precedence over Forgejo and Gitea URL environment variables; creation fails without a URL.

internal/cli/forge_client.go

run.goPrevent Forgejo runs from entering GitHub-only paths +11/-2

Prevent Forgejo runs from entering GitHub-only paths

• Skips GitHub token minting and reminting for Forgejo and warns when mint_url is supplied. Returns an explicit error instead of using GitHub status notifications.

internal/cli/run.go

detect.goRecognize Forgejo and Gitea remote hosts +7/-1

Recognize Forgejo and Gitea remote hosts

• Detects Codeberg, gitea.com, and hostnames containing forgejo or gitea as Forgejo.

internal/forge/detect.go

actions_reactions.goImplement Actions, reactions, and review-thread operations +653/-0

Implement Actions, reactions, and review-thread operations

• Adds workflow runs and dispatch, jobs, artifacts, repository variables, reactions, and PR authorization context. Maps review comments to best-effort individual threads.

internal/forge/forgejo/actions_reactions.go

client.goAdd the Forgejo HTTP client foundation +231/-0

Add the Forgejo HTTP client foundation

• Introduces the forge.Client implementation, configurable API base, authenticated JSON requests, error mapping, and basic user and repository operations.

internal/forge/forgejo/client.go

highvalue.goAdd fork, commit, review, protection, and secret support +457/-0

Add fork, commit, review, protection, and secret support

• Implements higher-value repository and pull-request operations, including sequential multi-file commits and branch-protection reads. Adds repository Actions secret operations.

internal/forge/forgejo/highvalue.go

repos.goImplement core repository, file, PR, and issue APIs +515/-0

Implement core repository, file, PR, and issue APIs

• Adds content and branch operations, pull-request lifecycle methods, issue and label handling, comments, and commit comparison.

internal/forge/forgejo/repos.go

stubs.goMark unavailable Forgejo capabilities explicitly +198/-0

Mark unavailable Forgejo capabilities explicitly

• Completes interface coverage with ErrNotSupported responses for unimplemented and forge-specific operations, including GitLab pipelines and organization-level variables.

internal/forge/forgejo/stubs.go

forge.goAccept Forgejo in harness forge validation +2/-0

Accept Forgejo in harness forge validation

• Registers forgejo as a recognized forge key.

internal/harness/forge.go

forge_config.goSelect GitHub-compatible workflow paths for Forgejo +3/-0

Select GitHub-compatible workflow paths for Forgejo

• Explicitly maps Forgejo to the existing GitHub Actions shim path and reference patterns.

internal/repos/forge_config.go

manifest.goAllow Forgejo in repository manifests +6/-4

Allow Forgejo in repository manifests

• Adds the ForgeForgejo constant and accepts it during manifest forge validation.

internal/repos/manifest.go

Tests (8) +328 / -1
forge_client_test.goTest Forgejo client creation requirements +29/-0

Test Forgejo client creation requirements

• Covers client type and URL normalization, plus missing-token and missing-URL errors.

internal/cli/forge_client_test.go

detect_test.goTest Forgejo remote detection +10/-0

Test Forgejo remote detection

• Adds Codeberg and self-hosted Forgejo remote cases.

internal/forge/detect_test.go

actions_reactions_test.goTest Actions and reaction API mappings +144/-0

Test Actions and reaction API mappings

• Exercises mocked reactions, workflow runs and dispatch, variables, authorization context, review threads, and nil token scopes.

internal/forge/forgejo/actions_reactions_test.go

client_test.goTest basic Forgejo client behavior +55/-0

Test basic Forgejo client behavior

• Checks interface conformance, user and repository responses, and an unsupported pipeline operation.

internal/forge/forgejo/client_test.go

highvalue_test.goTest commits, reviews, and protected-branch reads +55/-0

Test commits, reviews, and protected-branch reads

• Uses a mock server to exercise a branch file commit, PR review creation and listing, and protection detection.

internal/forge/forgejo/highvalue_test.go

live_smoke_test.goAdd an opt-in live Forgejo smoke test +33/-0

Add an opt-in live Forgejo smoke test

• Adds a build-tagged test for authenticated user, repository, and organization repository reads against a configured internal instance.

internal/forge/forgejo/live_smoke_test.go

forge_test.goUpdate the valid-forges validation expectation +1/-1

Update the valid-forges validation expectation

• Expects Forgejo in the error message listing recognized forge keys.

internal/harness/forge_test.go

harness_test.goTest Forgejo as a valid harness platform +1/-0

Test Forgejo as a valid harness platform

• Asserts that ValidForgePlatform accepts forgejo.

internal/harness/harness_test.go

Documentation (1) +37 / -0
README.mdDocument Forgejo client setup and coverage +37/-0

Document Forgejo client setup and coverage

• Describes credentials, URL configuration, supported API areas, unsupported methods, and live-smoke usage.

internal/forge/forgejo/README.md

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

Grey Divider


Action required

1. Agent approvals land as invisible pending reviews 🐞 Bug ≡ Correctness
Description
CreatePullRequestReview accepts the shared APPROVE event but sends it unchanged, while
Gitea/Forgejo recognise APPROVED, REQUEST_CHANGES and COMMENT. When the review agent submits
an approval, Gitea's preparePullReviewType treats the unrecognised value as PENDING, so the call
succeeds but the review remains an unsubmitted draft and the PR is not marked approved.
Code

internal/forge/forgejo/highvalue.go[R281-289]

+	switch event {
+	case "APPROVE", "REQUEST_CHANGES", "COMMENT":
+	default:
+		return fmt.Errorf("create review on #%d: invalid event %q", number, event)
+	}
+	payload := map[string]any{
+		"event": event,
+		"body":  body,
+	}
Relevance

●●● Strong

Concrete, deterministic correctness bug: APPROVE must map to APPROVED. No counter-precedent in
history.

PR-#9056

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The client accepts APPROVE and passes it unchanged as the request's event, while the
Gitea/Forgejo review API enum uses APPROVED instead. The cited server behavior treats unrecognised
values as PENDING, explaining why an approval request does not record an approved review.

internal/forge/forgejo/highvalue.go[280-307]
internal/cli/postreview.go[596-602]
internal/forge/forgejo/highvalue.go[279-306]
🌐 ReviewStateApproved ReviewStateType = "APPROVED"; CreatePullReviewOptions.Event is a ReviewStateType
🌐 The review request accepts APPROVED, PENDING, COMMENT, REQUEST_CHANGES or REQUEST_REVIEW.

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The shared approval event is `APPROVE`, but Forgejo/Gitea expect `APPROVED`. Sending the shared value unchanged leaves the review pending instead of approved.

## Fix Focus Areas
- internal/forge/forgejo/highvalue.go[279-292]

## Recommended Fix
Keep accepting `APPROVE` from callers, but translate it to `APPROVED` in the Forgejo/Gitea request payload. Add a test asserting that an approval request transmits `APPROVED`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


2. Failed batches leave files committed 🐞 Bug ≡ Correctness
Description
CommitFilesToBranch writes or deletes each TreeFile in a separate Contents API operation despite
the interface's atomic-commit contract. If a later operation fails, earlier files remain committed
even though the method returns an error for the batch.
Code

internal/forge/forgejo/highvalue.go[R135-137]

+// CommitFilesToBranch implements forge.Client via sequential contents API.
+// Not atomic: a mid-batch failure may leave earlier file writes committed.
+func (c *LiveClient) CommitFilesToBranch(ctx context.Context, owner, repo, branch, message string, files []forge.TreeFile) (bool, error) {
Relevance

●● Moderate

Non-atomic batch is already documented in code; atomicity contract concerns have mixed history.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The interface requires an atomic commit, but the new loop performs independent writes and returns
immediately on a later failure.

internal/forge/forge.go[1196-1203]
internal/forge/forgejo/highvalue.go[135-168]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Sequential file writes can leave a partially applied multi-file commit.
## Fix Focus Areas
- internal/forge/forgejo/highvalue.go[135-168]
## Recommended Fix
Build one commit containing the complete set of changes and update the branch once. If the Forgejo API cannot provide that guarantee, return an explicit unsupported error rather than reporting partial writes as an implementation of the atomic method.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


3. Creating new files fails on Forgejo 🐞 Bug ≡ Correctness
Description
putFile always sends PUT /contents/{path} and omits sha when it has none. That is the path
taken by CreateFile, CreateFileOnBranch, and CreateOrUpdateFile*/CommitFilesToBranch
whenever the file does not exist yet. Forgejo's PUT is update-only and rejects a missing sha with
422 [SHA]: Required (creation needs POST), so every new-file write and multi-file commit that adds
a file fails on Forgejo.
Code

internal/forge/forgejo/repos.go[R101-106]

+	if sha != "" {
+		payload["sha"] = sha
+	}
+	p := "/repos/" + escapePath(owner, repo) + "/contents/" + strings.TrimPrefix(path, "/")
+	_, err := c.do(ctx, http.MethodPut, p, payload, nil)
+	return err
Relevance

●● Moderate

Depends on Forgejo PUT/POST API behavior and version; no direct team precedent.

PR-#9056

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
CreateFile and CreateFileOnBranch pass sha "". CreateOrUpdate* also leave sha empty when the
GET returns 404. All of them reach the PUT in putFile, which Forgejo rejects.

internal/forge/forgejo/repos.go[109-135]
🌐 Forgejo 14.0.3's PUT endpoint validates sha as a required, non-empty field (... 422 "[SHA]: Required"). POST is the documented create endpoint and does not require sha.
🌐 Only recent Gitea (1.26) allows PUT to create when SHA is empty.

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`putFile` always uses PUT. Forgejo requires `sha` on PUT and creates files only via POST, so writing a new file fails.

## Fix Focus Areas
- internal/forge/forgejo/repos.go[93-135]

## Recommended Fix
In `putFile`, choose `http.MethodPost` when `sha == ""` and `http.MethodPut` otherwise. Add tests asserting the method used for each case.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


View high (3)
4. Diverged forks pass the ancestor safety check 🐞 Bug ≡ Correctness
Description
When Forgejo omits status, CompareCommits returns identical whenever total_commits == 0 and
ahead otherwise. A head that is behind base is therefore reported as identical, and diverged
history as ahead. layers/commit.go relies on ahead/identical to refuse delivery onto forks
with fork-only commits, and RefResolver.IsAncestor relies on ahead, so both safeguards wrongly
pass on Forgejo.
Code

internal/forge/forgejo/repos.go[R510-514]

+	// Forgejo/Gitea often omit GitHub-style status; derive a coarse signal.
+	if cmp.TotalCommits == 0 {
+		return "identical", nil
+	}
+	return "ahead", nil
Relevance

●● Moderate

Semantic compare-status mapping; risky and no close precedent either way.

PR-#8928

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The GitLab client calls compare in both directions to tell ahead, behind and diverged apart. The
Forgejo client looks in one direction only, then maps the result onto exactly the statuses that
callers treat as safe.

internal/layers/commit.go[546-556]
internal/repos/ref_resolve.go[64-76]
internal/forge/gitlab/repo.go[621-667]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
When `status` is absent, Forgejo `CompareCommits` derives `identical`/`ahead` from a single forward `total_commits`. Behind and diverged histories are misreported as safe.

## Fix Focus Areas
- internal/forge/forgejo/repos.go[497-515]

## Recommended Fix
If base == head, return `identical`. Otherwise run the forward compare (base...head) and the reverse compare (head...base). Return `diverged` if both have commits, `ahead` if only forward does, `behind` if only reverse does, and `identical` if neither does. If the reverse call fails, return `diverged`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


5. Forgejo agent runs fail in scripts 🔗 Cross-repo conflict ≡ Correctness
Description
ValidForgePlatform now accepts forgejo, but the agents repository has no Forgejo harness overlay
or script dispatcher branch. When a Codeberg or Gitea remote selects the new forge, the code and fix
harnesses supply no Forgejo-specific environment, and their post-scripts reject the forge.
Code

internal/harness/forge.go[51]

+	"forgejo": true,
Relevance

●● Moderate

Cross-repo agents overlay gap is architectural and possibly intentionally deferred; no close
precedent.

PR-#8836

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR accepts the new forge key, while the agent-owned harness has only GitHub and GitLab overlays
and its operation dispatcher exits for every other value.

fullsend -> agents
internal/harness/forge.go[43-57]
internal/forge/detect.go[24-35]
External repo: fullsend-ai/agents, harness/code.yaml [111-160]
External repo: fullsend-ai/agents, scripts/lib/code-ops.lib.sh [17-26]
External repo: fullsend-ai/agents, scripts/lib/fix-ops.lib.sh [11-22]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Forgejo is accepted as an agent forge, but agents harnesses and post-scripts support only GitHub and GitLab.
## Fix Focus Areas
- internal/harness/forge.go[47-51]
- /cross_repos/agents/harness/code.yaml[111-160]
- /cross_repos/agents/scripts/lib/code-ops.lib.sh[17-26]
## Recommended Fix
Add Forgejo overlays and operation dispatch in agents, including the fix harness and scripts, before enabling Forgejo agent runs; otherwise keep unsupported runs blocked explicitly.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


6. Forgejo scripts lack push credentials 🔗 Cross-repo conflict ≡ Correctness
Description
runAgent skips minting for Forgejo but does not resolve FORGEJO_TOKEN or GITEA_TOKEN and
export the credential as PUSH_TOKEN to the runner environment. When only the documented Forgejo
credential is configured, the agents repository’s code and fix post-scripts reach their required
PUSH_TOKEN check without a token, while the sandbox may instead inherit an ambient GitHub token.
Code

internal/cli/run.go[R1050-1052]

+	} else if forgePlatform == repos.ForgeForgejo {
+		// Forgejo has no GitHub App mint endpoint; use FORGEJO_TOKEN / GITEA_TOKEN directly.
+		mintCleanup = func() {}
Relevance

●● Moderate

Concrete credential-wiring gap in PR scope, but no close precedent in history; cross-repo behavior
needs judgment.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The Forgejo branch in runAgent installs only a no-op mintCleanup, unlike the GitLab branch’s
explicit agent credential setup. resolveForgejoToken supplies the CLI API client but does not put
a token in the agent sandbox; the agent harnesses pass PUSH_TOKEN, and the post-scripts require it
before pushing changes.

fullsend -> agents
internal/cli/run.go[1043-1056]
internal/cli/forge_client.go[29-38]
internal/cli/run.go[1044-1069]
internal/cli/forge_client.go[29-39]
External repo: fullsend-ai/agents, harness/code.yaml [89-94]
External repo: fullsend-ai/agents, harness/fix.yaml [105-115]
External repo: fullsend-ai/agents, scripts/post-code.sh [3627-3631]
External repo: fullsend-ai/agents, scripts/post-fix.sh [2468-2469]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Forgejo client authentication can use `FORGEJO_TOKEN` or `GITEA_TOKEN`, but the agent run does not make that credential available as the `PUSH_TOKEN` required by its post-scripts.

## Fix Focus Areas
- internal/cli/run.go[1050-1055]
- internal/cli/forge_client.go[29-38]
- /cross_repos/agents/harness/code.yaml[89-94]
- /cross_repos/agents/scripts/post-code.sh[3627-3631]

## Recommended Fix
Add Forgejo agent credential setup analogous to `applyGitLabAgentCredentials`: resolve `FORGEJO_TOKEN` or `GITEA_TOKEN`, fail if neither is available, and use `setFlagEnv` to make the resolved credential available to runner scripts as `PUSH_TOKEN`. Coordinate this with Forgejo support in the agents repository, covering both the code and fix harnesses.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗



Remediation recommended

7. Smoke test exposes internal Forgejo host 📘 Rule violation ⛨ Security
Description
The build-tagged live smoke test hardcodes https://git.forge.internal/api/v1 as the API base,
along with the organization forgeops-ai and repository forge-platform, instead of reading them
from FORGEJO_API_URL or using placeholders. The same internal host is also committed in
internal/cli/forge_client_test.go, so anyone with repository access can see the internal endpoint
and project names, and anyone who runs the live_forgejo tag is pointed at that instance.
Code

internal/forge/forgejo/live_smoke_test.go[R16-21]

Relevance

●●● Strong

Team accepts replacing hardcoded test literals with synthetic values; similar test-literal cleanups
were accepted.

PR-#8913

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 1062040 flags internal hostnames (*.internal) and real project or repo names in use, and
requires test values to be clearly fake placeholders. The smoke test embeds git.forge.internal,
forgeops-ai, and forge-platform directly, and the same internal host appears in
internal/cli/forge_client_test.go.

Rule 1062040: Disallow hardcoded secrets and sensitive environment-specific identifiers in source code
internal/forge/forgejo/live_smoke_test.go[16-21]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The live Forgejo smoke test in `internal/forge/forgejo/live_smoke_test.go` hardcodes an internal host (`git.forge.internal`), an organization (`forgeops-ai`), and a repository (`forge-platform`). Rule 1062040 forbids committing environment-specific internal identifiers to source.

## Fix Focus Areas
- internal/forge/forgejo/live_smoke_test.go[16-21]
- internal/cli/forge_client_test.go[109-114]

## Recommended Fix
In `live_smoke_test.go`, replace the hardcoded base URL with `os.Getenv("FORGEJO_API_URL")` and skip the test when it is empty, the same way it already skips when `FORGEJO_TOKEN` is unset. Read the org and repo names from env vars such as `FORGEJO_SMOKE_ORG` and `FORGEJO_SMOKE_REPO`, and skip when they are unset. In `forge_client_test.go`, replace the `https://git.forge.internal` fixture with a neutral placeholder such as `https://forgejo.example.com`, since the test only asserts URL normalization.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


8. Valid tags cannot be resolved 🐞 Bug ≡ Correctness
Description
GetRef strips only refs/heads/ and sends every remaining ref to the branch endpoint. Callers
passing the documented heads/main or tags/v0 forms consequently request nonexistent branches
instead of resolving those refs.
Code

internal/forge/forgejo/repos.go[R218-221]

Relevance

●●● Strong

Trivial deterministic fix: GetRef should resolve tags/heads instead of always using the branch
endpoint.

PR-#9056

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The interface names both ref forms and repository callers use them; the new method always calls
GetBranchRef.

internal/forge/forge.go[1207-1210]
internal/forge/forgejo/repos.go[208-221]
internal/repos/ref_resolve.go[43-48]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GetRef` interprets documented ref paths as literal branch names.
## Fix Focus Areas
- internal/forge/forgejo/repos.go[218-221]
## Recommended Fix
Normalize supported `heads/` and `tags/` forms and query the corresponding Forgejo git-ref endpoint, preserving not-found errors for missing refs.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


9. Unchanged files create extra commits 🐞 Bug ≡ Correctness
Description
CommitFilesToBranch sends every non-delete file to CreateOrUpdateFileOnBranch and sets changed
without comparing its content. Repeating a batch whose files already contain the requested bytes
therefore creates commits instead of returning (false, nil) as the shared method promises.
Code

internal/forge/forgejo/highvalue.go[R163-166]

Relevance

●● Moderate

Idempotence contract violation is plausible, but no close precedent in history.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The contract specifies idempotence, while the implementation writes and marks every non-delete entry
changed.

internal/forge/forge.go[1196-1203]
internal/forge/forgejo/highvalue.go[159-168]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The batch method treats unchanged file content as a new change.
## Fix Focus Areas
- internal/forge/forgejo/highvalue.go[137-168]
- internal/forge/forgejo/repos.go[128-135]
## Recommended Fix
Compare requested bytes with existing content on the target branch, omit unchanged entries, and return `(false, nil)` when nothing needs to change. Preserve the atomic batch guarantee separately.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


View medium (8)
10. Executable files lose their requested mode 🐞 Bug ≡ Correctness
Description
CommitFilesToBranch passes only a file's bytes to a Contents API write and discards
TreeFile.Mode. A batch containing a new 100755 script cannot create it with the executable mode
requested by the caller.
Code

internal/forge/forgejo/highvalue.go[R159-163]

Relevance

●● Moderate

Dropped file mode is a real gap in the new commit path, but fixing it depends on Contents API
limits; no precedent.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The interface models executable files, but the new call and its request payload contain no mode.

internal/forge/forge.go[995-1011]
internal/forge/forgejo/highvalue.go[159-166]
internal/forge/forgejo/repos.go[93-106]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The batch writer ignores executable-file mode from `TreeFile`.
## Fix Focus Areas
- internal/forge/forgejo/highvalue.go[159-166]
- internal/forge/forgejo/repos.go[93-106]
## Recommended Fix
Use a commit mechanism that records each tree entry's requested mode, including `100755`. Reject unsupported modes explicitly rather than silently creating files with different permissions.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


11. Some repository files cannot be read 🐞 Bug ≡ Correctness
Description
getContents appends the supplied file path to a URL without escaping URL-significant characters,
and the write and delete helpers use the same construction. A legitimate repository path containing
? or # is interpreted as a query or fragment, so file operations address a different path.
Code

internal/forge/forgejo/repos.go[R54-55]

Relevance

●● Moderate

Path escaping was rejected for GitHub owner/repo, but file-path slashes are intentional here; no
close match.

PR-#8668

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
These helpers interpolate caller-provided paths directly into URLs, with no restriction in the file
contract excluding URL-significant filenames.

internal/forge/forgejo/repos.go[54-60]
internal/forge/forgejo/repos.go[93-105]
internal/forge/forgejo/highvalue.go[151-153]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Raw file paths can change the request URL's query or fragment instead of addressing the intended file.
## Fix Focus Areas
- internal/forge/forgejo/repos.go[54-60]
- internal/forge/forgejo/repos.go[93-105]
- internal/forge/forgejo/repos.go[137-145]
- internal/forge/forgejo/highvalue.go[151-153]
## Recommended Fix
Escape path segments consistently across contents reads, writes and deletes while retaining directory separators. Test filenames containing `?`, `#` and spaces.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


12. Workflow log readers receive an archive 🐞 Bug ≡ Correctness
Description
GetWorkflowRunLogs converts the run-log response body directly to a string without extracting its
contents. The Forgejo/Gitea endpoint returns a logs archive, so callers expecting searchable log
text receive archive bytes instead.
Code

internal/forge/forgejo/actions_reactions.go[R565-569]

Relevance

●● Moderate

Archive-vs-text correctness issue; no historical precedent for this endpoint.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The endpoint documents an archive response, while the method returns its raw bytes as text.

internal/forge/forgejo/actions_reactions.go[544-569]
internal/forge/github/github.go[5132-5184]
🌐 The workflow-run logs endpoint describes its successful response as a logs archive.

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The run-log endpoint returns an archive, not plaintext logs.
## Fix Focus Areas
- internal/forge/forgejo/actions_reactions.go[544-569]
## Recommended Fix
Extract and concatenate the relevant log files from the archive, with size limits, or retrieve plaintext job logs through the job-log endpoint. Return text consistent with the shared client method.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


13. Forgejo workflows are missed by probing 🐞 Bug ≡ Correctness
Description
ForgeConfigFor selects GitHub's workflow paths for Forgejo, so probing examines only
.github/workflows/fullsend.yml and .yaml. A repository storing its workflow in Forgejo's
.forgejo/workflows directory is therefore reported as missing that workflow, affecting operations
that rely on the probe.
Code

internal/repos/forge_config.go[R100-102]

Relevance

●● Moderate

Valid Forgejo path concern, but scope of GitHub-shim reuse is a design choice; no close precedent.

PR-#8836

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The configuration selects GitHub-only paths, whereas Forgejo looks in its native directory first and
falls back to GitHub's directory only in its absence.

internal/repos/forge_config.go[55-68]
internal/repos/forge_config.go[97-104]
internal/repos/ref_ops.go[117-129]
🌐 Forgejo defines workflows in .forgejo/workflows and checks .github/workflows only when the native directory is absent.

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Forgejo workflow probing omits the platform's native workflow directory.
## Fix Focus Areas
- internal/repos/forge_config.go[55-68]
- internal/repos/forge_config.go[97-104]
## Recommended Fix
Provide a Forgejo-specific workflow path configuration including `.forgejo/workflows` and the GitHub fallback where appropriate. Test probes against repositories using each supported directory.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


14. Fork lookup failures appear as no fork 🐞 Bug ☼ Reliability
Description
FindExistingFork ignores errors from its second repository request when checking the fork's
parent. If that request fails after the first identified a fork, the method returns empty names with
a nil error and its caller proceeds as though it must create a fork.
Code

internal/forge/forgejo/highvalue.go[R42-46]

Relevance

●● Moderate

Ignored error in fork lookup is a plausible reliability fix; no close precedent found.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The second lookup is guarded by err == nil, with no error branch, and the fork-creation caller
treats empty names as absence.

internal/forge/forgejo/highvalue.go[21-51]
internal/layers/commit.go[126-145]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A failed parent-verification request is treated as proof that no existing fork was found.
## Fix Focus Areas
- internal/forge/forgejo/highvalue.go[21-51]
## Recommended Fix
Return errors from the second repository lookup instead of falling through to the no-fork result. Test a successful first lookup followed by a failed verification request.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


15. Runs of unrelated workflows match a requested one 🐞 Bug ≡ Correctness
Description
workflowFileMatches accepts strings.HasSuffix(cand, wf) with no path separator, so a request for
ci.yml also matches my-ci.yml or release-ci.yml. ListWorkflowRuns also reads only the first
30 repository runs. As a result, GetLatestWorkflowRun, ListWorkflowRunsSince and GetWorkflow
can return another workflow's run, or report that none exist when the target's latest run is older
than the newest 30.
Code

internal/forge/forgejo/actions_reactions.go[R284-286]

Relevance

●● Moderate

Suffix match without separator is a plausible trivial fix, but no direct history on workflow
matching.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The bare HasSuffix(cand, wf) makes the /+wf check redundant and matches any filename that ends
with the same characters. ListWorkflowRuns fetches a single page (`listActionRunsPage(..., 1,
30)`).

internal/forge/forgejo/actions_reactions.go[274-292]
internal/forge/forgejo/actions_reactions.go[358-372]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Workflow matching uses a bare suffix check, so runs of other workflows are returned. `ListWorkflowRuns` only reads one page.

## Fix Focus Areas
- internal/forge/forgejo/actions_reactions.go[274-292]
- internal/forge/forgejo/actions_reactions.go[358-372]

## Recommended Fix
Drop the bare `strings.HasSuffix(cand, wf)` and keep the exact, `"/"+wf` suffix and EqualFold checks. Paginate `ListWorkflowRuns` (bounded, like `ListWorkflowRunsSince`) until enough matching runs are found.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


16. Org repo and PR lists silently truncate 🐞 Bug ☼ Reliability
Description
ListOrgRepos sends one request with limit=100, and ListRepoPullRequests/ListOpenIssues send
one with limit=50. None of them paginate. Forgejo caps page size at MAX_RESPONSE_ITEMS (50 by
default), so orgs with more repos, PRs or issues than that get partial results with no error, and
enrollment/discovery code skips the rest.
Code

internal/forge/forgejo/client.go[R174-178]

Relevance

●● Moderate

Pagination requests were rejected in the GitHub client (PR 5853), but that is older and in a
different file; mixed signals.

PR-#5853

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Each method decodes a single page and returns it. Other methods in the same PR
(ListIssueReactions, ListRepoVariables) already page through results, so these three are the
inconsistent ones.

internal/forge/forgejo/client.go[172-190]
internal/forge/forgejo/repos.go[314-325]
internal/forge/forgejo/repos.go[424-442]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Several list methods fetch only the first page, and Forgejo caps the page size, so results are silently truncated.

## Fix Focus Areas
- internal/forge/forgejo/client.go[172-190]
- internal/forge/forgejo/repos.go[314-325]
- internal/forge/forgejo/repos.go[424-442]

## Recommended Fix
Loop over `page=1..N` with `limit=50` and stop when a page returns fewer than 50 items. Apply the same bounded pattern used in `ListRepoVariables`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


17. Status reconciliation on Forgejo hits GitHub 🐞 Bug ≡ Correctness
Description
Adding forgejo to validForgeKeys lets detectForgePlatform accept --forge forgejo, but
reconcile-status sends every non-GitLab forge to reconcileGitHubClient. With that flag,
reconciliation attempts GitHub authentication and may update a same-named GitHub repository or fail
confusingly, rather than rejecting unsupported Forgejo reconciliation as setupStatusNotifier does.
Code

internal/harness/forge.go[R50-51]

Relevance

●● Moderate

Reasonable guard, but the team's handling of unsupported forge paths is not clearly precedented.

PR-#9321

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new validation entry makes --forge forgejo valid, while the reconciliation branch handles only
GitLab before selecting a GitHub client. run.go already rejects Forgejo for status notifications,
but the corresponding path in reconcilestatus.go has no such check.

internal/cli/reconcilestatus.go[143-161]
internal/cli/run.go[7072-7078]
internal/harness/forge.go[47-54]
internal/cli/reconcilestatus.go[143-154]
internal/cli/run.go[6995-7004]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`reconcile-status --forge forgejo` enters the GitHub fallback, potentially targeting the wrong forge instead of rejecting unsupported reconciliation.

## Fix Focus Areas
- internal/harness/forge.go[50-51]
- internal/cli/reconcilestatus.go[143-161]

## Recommended Fix
Before the GitHub branch, explicitly reject Forgejo with `return fmt.Errorf("status reconciliation is not supported for forgejo yet")`, or add a Forgejo reconciliation branch using a Forgejo client if reconciliation is supported. Test `--forge forgejo` and audit other `== "gitlab"`-else-GitHub branches for the same fallback.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗



Informational

18. Deleting a reaction can remove the bot's own one 🐞 Bug ≡ Correctness
Description
DeleteIssueReaction and DeleteIssueCommentReaction match a synthetic ID containing the
reaction's user but discard that user before sending a DELETE identified only by content. When the
ID belongs to someone else, Forgejo applies the DELETE to the authenticated account, removing its
reaction with the same content or doing nothing while the method still returns success.
Code

internal/forge/forgejo/actions_reactions.go[R67-79]

Relevance

●● Moderate

Real correctness bug in new Forgejo reaction code, but no matching historical precedent either way.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The synthetic IDs incorporate usernames, but both methods use the matched ID only to find the
reaction content. Neither checks the matched username against the authenticated user, and the DELETE
body carries only content, so it cannot identify the other user's reaction.

internal/forge/forgejo/actions_reactions.go[25-31]
internal/forge/forgejo/actions_reactions.go[60-80]
internal/forge/forgejo/actions_reactions.go[25-44]
internal/forge/forgejo/actions_reactions.go[60-79]
internal/forge/forgejo/actions_reactions.go[95-113]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Reaction deletion matches a user-specific synthetic ID, but the content-only DELETE acts on the authenticated user's reaction instead of necessarily acting on the matched reaction.

## Fix Focus Areas
- internal/forge/forgejo/actions_reactions.go[60-79]
- internal/forge/forgejo/actions_reactions.go[95-113]

## Recommended Fix
Resolve the authenticated user's login and allow content-based deletion only when the matched reaction belongs to that user. Otherwise, return an error, such as ErrNotSupported or a forbidden error. Apply the check to both issue and issue-comment reactions, and test the case where different users reacted with the same content.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


19. New Forgejo settings are missing from CLI docs 📘 Rule violation ⚙ Maintainability
Description
The new forgejo branch of newForgeClient reads FORGEJO_TOKEN, GITEA_TOKEN, FORGEJO_API_URL
and GITEA_API_URL, and the --forge forgejo value is newly accepted in the harness and manifest.
None of these appear under docs/, and the PR adds no docs/cli/ or docs/guides/ entry for them,
so CLI users have no documented way to learn which variables to set or which precedence applies. The
only reference is internal/forge/forgejo/README.md, which is outside the documentation locations
this rule checks.
Code

internal/cli/forge_client.go[R80-88]

Relevance

● Weak

Two closely matching findings about env vars or config fields missing from docs were explicitly
dismissed as false_positive or intentional.

PR-#8489
PR-#8877

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR introduces new CLI-facing environment variables and a new --forge value that the checklist
requires to be reflected in docs/cli/ or docs/guides/. A grep of docs/ for FORGEJO and
GITEA returned no matches, and the PR changes no docs file. The existing GitLab variables also
have no hits under docs/, so this gap follows an existing pattern.

Rule 2748504: Keep CLI and config documentation in sync with behavior changes
internal/cli/forge_client.go[72-88]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR adds CLI-facing configuration for Forgejo: the `--forge forgejo` value and the environment variables `FORGEJO_TOKEN`, `GITEA_TOKEN`, `FORGEJO_API_URL` and `GITEA_API_URL`. None of these are mentioned under `docs/cli/` or `docs/guides/`, so CLI users cannot discover them from the reference docs.

## Fix Focus Areas
- internal/cli/forge_client.go[72-88]
- internal/forge/detect.go[25-35]
- internal/forge/forgejo/README.md[13-20]

## Recommended Fix
Add a short Forgejo section to the CLI reference under `docs/cli/` (or the existing forge/auth page if one exists). List `--forge forgejo`, the token variables with precedence (`FORGEJO_TOKEN` before `GITEA_TOKEN`), and the URL variables with precedence (manifest URL, then `FORGEJO_API_URL`, then `GITEA_API_URL`), and note that the URL is required. Keep the wording consistent with how the GitLab variables are described, if they are documented anywhere.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


Grey Divider

⚠️ Warning | Comment size exceeded, inner finding content trimmed View findings
⚠️ Warning | Comment size exceeded, non finding content trimmed Learn more

Grey Divider

Qodo Logo

Comment on lines +16 to +21
c := New(tok, WithBaseURL("https://git.forge.internal/api/v1"))
u, err := c.GetAuthenticatedUser(context.Background())
if err != nil {
t.Fatal(err)
}
r, err := c.GetRepo(context.Background(), "forgeops-ai", "forge-platform")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

7. Smoke test exposes internal forgejo host 📘 Rule violation ⛨ Security

The build-tagged live smoke test hardcodes https://git.forge.internal/api/v1 as the API base,
along with the organization forgeops-ai and repository forge-platform, instead of reading them
from FORGEJO_API_URL or using placeholders. The same internal host is also committed in
internal/cli/forge_client_test.go, so anyone with repository access can see the internal endpoint
and project names, and anyone who runs the live_forgejo tag is pointed at that instance.
Agent Prompt
## Issue description
The live Forgejo smoke test in `internal/forge/forgejo/live_smoke_test.go` hardcodes an internal host (`git.forge.internal`), an organization (`forgeops-ai`), and a repository (`forge-platform`). Rule 1062040 forbids committing environment-specific internal identifiers to source.

## Fix Focus Areas
- internal/forge/forgejo/live_smoke_test.go[16-21]
- internal/cli/forge_client_test.go[109-114]

## Recommended Fix
In `live_smoke_test.go`, replace the hardcoded base URL with `os.Getenv("FORGEJO_API_URL")` and skip the test when it is empty, the same way it already skips when `FORGEJO_TOKEN` is unset. Read the org and repo names from env vars such as `FORGEJO_SMOKE_ORG` and `FORGEJO_SMOKE_REPO`, and skip when they are unset. In `forge_client_test.go`, replace the `https://git.forge.internal` fixture with a neutral placeholder such as `https://forgejo.example.com`, since the test only asserts URL normalization.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

Comment on lines +135 to +137
// CommitFilesToBranch implements forge.Client via sequential contents API.
// Not atomic: a mid-batch failure may leave earlier file writes committed.
func (c *LiveClient) CommitFilesToBranch(ctx context.Context, owner, repo, branch, message string, files []forge.TreeFile) (bool, error) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. Failed batches leave files committed 🐞 Bug ≡ Correctness

CommitFilesToBranch writes or deletes each TreeFile in a separate Contents API operation despite
the interface's atomic-commit contract. If a later operation fails, earlier files remain committed
even though the method returns an error for the batch.
Agent Prompt
## Issue description
Sequential file writes can leave a partially applied multi-file commit.
## Fix Focus Areas
- internal/forge/forgejo/highvalue.go[135-168]
## Recommended Fix
Build one commit containing the complete set of changes and update the branch once. If the Forgejo API cannot provide that guarantee, return an explicit unsupported error rather than reporting partial writes as an implementation of the atomic method.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

Comment on lines +163 to +166
if err := c.CreateOrUpdateFileOnBranch(ctx, owner, repo, branch, f.Path, message, content); err != nil {
return changed, err
}
changed = true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

9. Unchanged files create extra commits 🐞 Bug ≡ Correctness

CommitFilesToBranch sends every non-delete file to CreateOrUpdateFileOnBranch and sets changed
without comparing its content. Repeating a batch whose files already contain the requested bytes
therefore creates commits instead of returning (false, nil) as the shared method promises.
Agent Prompt
## Issue description
The batch method treats unchanged file content as a new change.
## Fix Focus Areas
- internal/forge/forgejo/highvalue.go[137-168]
- internal/forge/forgejo/repos.go[128-135]
## Recommended Fix
Compare requested bytes with existing content on the target branch, omit unchanged entries, and return `(false, nil)` when nothing needs to change. Preserve the atomic batch guarantee separately.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

Comment on lines +159 to +163
content, err := f.Bytes()
if err != nil {
return changed, err
}
if err := c.CreateOrUpdateFileOnBranch(ctx, owner, repo, branch, f.Path, message, content); err != nil {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

10. Executable files lose their requested mode 🐞 Bug ≡ Correctness

CommitFilesToBranch passes only a file's bytes to a Contents API write and discards
TreeFile.Mode. A batch containing a new 100755 script cannot create it with the executable mode
requested by the caller.
Agent Prompt
## Issue description
The batch writer ignores executable-file mode from `TreeFile`.
## Fix Focus Areas
- internal/forge/forgejo/highvalue.go[159-166]
- internal/forge/forgejo/repos.go[93-106]
## Recommended Fix
Use a commit mechanism that records each tree entry's requested mode, including `100755`. Reject unsupported modes explicitly rather than silently creating files with different permissions.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

Comment on lines +218 to +221
// GetRef implements forge.Client.
func (c *LiveClient) GetRef(ctx context.Context, owner, repo, ref string) (string, error) {
ref = strings.TrimPrefix(ref, "refs/heads/")
return c.GetBranchRef(ctx, owner, repo, ref)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

8. Valid tags cannot be resolved 🐞 Bug ≡ Correctness

GetRef strips only refs/heads/ and sends every remaining ref to the branch endpoint. Callers
passing the documented heads/main or tags/v0 forms consequently request nonexistent branches
instead of resolving those refs.
Agent Prompt
## Issue description
`GetRef` interprets documented ref paths as literal branch names.
## Fix Focus Areas
- internal/forge/forgejo/repos.go[218-221]
## Recommended Fix
Normalize supported `heads/` and `tags/` forms and query the corresponding Forgejo git-ref endpoint, preserving not-found errors for missing refs.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

Comment on lines +174 to +178
var raw []apiRepo
path := "/orgs/" + url.PathEscape(org) + "/repos?limit=100"
if _, err := c.do(ctx, http.MethodGet, path, nil, &raw); err != nil {
return nil, err
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

16. Org repo and pr lists silently truncate 🐞 Bug ☼ Reliability

ListOrgRepos sends one request with limit=100, and ListRepoPullRequests/ListOpenIssues send
one with limit=50. None of them paginate. Forgejo caps page size at MAX_RESPONSE_ITEMS (50 by
default), so orgs with more repos, PRs or issues than that get partial results with no error, and
enrollment/discovery code skips the rest.
Agent Prompt
## Issue description
Several list methods fetch only the first page, and Forgejo caps the page size, so results are silently truncated.

## Fix Focus Areas
- internal/forge/forgejo/client.go[172-190]
- internal/forge/forgejo/repos.go[314-325]
- internal/forge/forgejo/repos.go[424-442]

## Recommended Fix
Loop over `page=1..N` with `limit=50` and stop when a page returns fewer than 50 items. Apply the same bounded pattern used in `ListRepoVariables`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

Comment thread internal/harness/forge.go
Comment on lines +50 to +51
// Forgejo/Gitea API client (ForgeOps FACTORY-FULLSEND-FORGEJO-CLIENT-001).
"forgejo": true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

17. Status reconciliation on forgejo hits github 🐞 Bug ≡ Correctness

Adding forgejo to validForgeKeys lets detectForgePlatform accept --forge forgejo, but
reconcile-status sends every non-GitLab forge to reconcileGitHubClient. With that flag,
reconciliation attempts GitHub authentication and may update a same-named GitHub repository or fail
confusingly, rather than rejecting unsupported Forgejo reconciliation as setupStatusNotifier does.
Agent Prompt
## Issue description
`reconcile-status --forge forgejo` enters the GitHub fallback, potentially targeting the wrong forge instead of rejecting unsupported reconciliation.

## Fix Focus Areas
- internal/harness/forge.go[50-51]
- internal/cli/reconcilestatus.go[143-161]

## Recommended Fix
Before the GitHub branch, explicitly reject Forgejo with `return fmt.Errorf("status reconciliation is not supported for forgejo yet")`, or add a Forgejo reconciliation branch using a Forgejo client if reconciliation is supported. Test `--forge forgejo` and audit other `== "gitlab"`-else-GitHub branches for the same fallback.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

Comment on lines +67 to +79
var content string
for _, r := range reactions {
if r.ID == reactionID {
content = r.Content
break
}
}
if content == "" {
return fmt.Errorf("delete issue reaction %d: %w", reactionID, forge.ErrNotFound)
}
p := "/repos/" + escapePath(owner, repo) + "/issues/" + strconv.Itoa(number) + "/reactions"
_, err = c.do(ctx, http.MethodDelete, p, map[string]any{"content": content}, nil)
return err

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Informational

18. Deleting a reaction can remove the bot's own one 🐞 Bug ≡ Correctness

DeleteIssueReaction and DeleteIssueCommentReaction match a synthetic ID containing the
reaction's user but discard that user before sending a DELETE identified only by content. When the
ID belongs to someone else, Forgejo applies the DELETE to the authenticated account, removing its
reaction with the same content or doing nothing while the method still returns success.
Agent Prompt
## Issue description
Reaction deletion matches a user-specific synthetic ID, but the content-only DELETE acts on the authenticated user's reaction instead of necessarily acting on the matched reaction.

## Fix Focus Areas
- internal/forge/forgejo/actions_reactions.go[60-79]
- internal/forge/forgejo/actions_reactions.go[95-113]

## Recommended Fix
Resolve the authenticated user's login and allow content-based deletion only when the matched reaction belongs to that user. Otherwise, return an error, such as ErrNotSupported or a forbidden error. Apply the check to both issue and issue-comment reactions, and test the case where different users reacted with the same content.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

Comment thread internal/harness/forge.go
// abstraction design (see https://github.com/fullsend-ai/fullsend/pull/6237).
"jira": true,
// Forgejo/Gitea API client (ForgeOps FACTORY-FULLSEND-FORGEJO-CLIENT-001).
"forgejo": true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

5. Forgejo agent runs fail in scripts 🔗 Cross-repo conflict ≡ Correctness

ValidForgePlatform now accepts forgejo, but the agents repository has no Forgejo harness overlay
or script dispatcher branch. When a Codeberg or Gitea remote selects the new forge, the code and fix
harnesses supply no Forgejo-specific environment, and their post-scripts reject the forge.
Agent Prompt
## Issue description
Forgejo is accepted as an agent forge, but agents harnesses and post-scripts support only GitHub and GitLab.
## Fix Focus Areas
- internal/harness/forge.go[47-51]
- /cross_repos/agents/harness/code.yaml[111-160]
- /cross_repos/agents/scripts/lib/code-ops.lib.sh[17-26]
## Recommended Fix
Add Forgejo overlays and operation dispatch in agents, including the fix harness and scripts, before enabling Forgejo agent runs; otherwise keep unsupported runs blocked explicitly.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

Comment thread internal/cli/run.go
Comment on lines +1050 to +1052
} else if forgePlatform == repos.ForgeForgejo {
// Forgejo has no GitHub App mint endpoint; use FORGEJO_TOKEN / GITEA_TOKEN directly.
mintCleanup = func() {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

6. Forgejo scripts lack push credentials 🔗 Cross-repo conflict ≡ Correctness

runAgent skips minting for Forgejo but does not resolve FORGEJO_TOKEN or GITEA_TOKEN and
export the credential as PUSH_TOKEN to the runner environment. When only the documented Forgejo
credential is configured, the agents repository’s code and fix post-scripts reach their required
PUSH_TOKEN check without a token, while the sandbox may instead inherit an ambient GitHub token.
Agent Prompt
## Issue description
Forgejo client authentication can use `FORGEJO_TOKEN` or `GITEA_TOKEN`, but the agent run does not make that credential available as the `PUSH_TOKEN` required by its post-scripts.

## Fix Focus Areas
- internal/cli/run.go[1050-1055]
- internal/cli/forge_client.go[29-38]
- /cross_repos/agents/harness/code.yaml[89-94]
- /cross_repos/agents/scripts/post-code.sh[3627-3631]

## Recommended Fix
Add Forgejo agent credential setup analogous to `applyGitLabAgentCredentials`: resolve `FORGEJO_TOKEN` or `GITEA_TOKEN`, fail if neither is available, and use `setFlagEnv` to make the resolved credential available to runner scripts as `PUSH_TOKEN`. Coordinate this with Forgejo support in the agents repository, covering both the code and fix harnesses.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

@github-actions github-actions Bot closed this Nov 16, 2026
@github-actions

Copy link
Copy Markdown

Thank you for your interest in contributing to fullsend, @MrGeek0s.

This project uses a vouch system for first-time contributors. Before submitting a pull request, you need to be vouched by a maintainer.

To get vouched:

  1. Open a Vouch Request discussion.
  2. Describe what you want to change and why.
  3. Write in your own words — do not have an AI generate the request.
  4. A maintainer will comment /vouch if approved.
  5. Once vouched, open a new PR (preferred) or reopen this one.

See CONTRIBUTING.md for details.

@MrGeek0s

Copy link
Copy Markdown
Author

Watch note (ForgeOps)

This PR was auto-closed by the vouch gate for first-time contributor @MrGeek0s (see the vouch-check bot comment). DCO / Route / Harness were already green before close.

Next (human): open a Vouch Request in your own words, then reopen this PR or open a fresh one after /vouch.

Qodo High triage (will address after vouch, before re-requesting review):

  1. Map APPROVE → Forgejo APPROVED in CreatePullRequestReview
  2. CommitFilesToBranch — atomic tree commit or explicit ErrNotSupported for multi-file
  3. putFile — POST create vs PUT update when sha empty
  4. CompareCommits — bidirectional compare for behind/diverged
    5–6. Cross-repo agents harness / PUSH_TOKEN for Forgejo — either wire credentials or keep agent runs blocked until agents overlays exist

Medium items remain queued after the Highs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant