Skip to content

feat(platform): add Forgejo repository and PR delivery - #1066

Open
xfdzcoder wants to merge 15 commits into
Tencent:mainfrom
xfdzcoder:feature/forgejo
Open

xfdzcoder wants to merge 15 commits into
Tencent:mainfrom
xfdzcoder:feature/forgejo

Conversation

@xfdzcoder

@xfdzcoder xfdzcoder commented Nov 18, 2026 •

Copy link
Copy Markdown

What changed

Related to #128. Git SSH can already clone and push Forgejo repositories, but it does not create pull requests or track delivery. This adds an explicit Forgejo binding and API v1 adapter so conversations and SOPs can deliver their pushed work through a PR and refresh its state.

  • Bind an SSH clone URL and matching HTTPS repository URL in project settings or Quick access. Administrators enable trusted instance roots through AGENTFLOW_FORGE_INSTANCES. Personal access tokens are stored per user and instance.
  • In native conversation workspaces, workbench_forgejo_pr_submit verifies the checkout and pushed commit, follows the current MCP write approval mode, and creates or updates a same-repository PR. Completed SOP workspaces can use the current Forgejo binding when their original SSH remote still matches.
  • SOP MR nodes receive a scoped HTTP MCP capability for their run, node, actor, generation and attempt. The platform supplies the frozen branches and reads the responsible user's Forgejo token. MR gates verify that an open or merged PR carries the pushed tip, including reused work branches.
  • Scheduled SOPs align and merge their integration branches through Forgejo PRs, respecting branch protection and the expected source commit. Delivery polling uses the saved delivery actor's token.

Scope

  • Platform core / API / runner
  • Public adapter / deployment
  • Classic
  • Portable
  • Shared behavior contract
  • Installer / CLI
  • Documentation only

Compatibility

Preserves upstream host-scoped Git HTTPS credentials and GitHub Enterprise/GitLab delivery URL handling. Forgejo Git transport continues to use SSH, and its PR token stays on the platform.

Forgejo API v1, exercised with Forgejo 17.0.1. Git transport uses the existing personal SSH key and pinned host-key configuration. SOP capabilities travel through the existing HTTP MCP asset format. The new node capability requires the same AGENTFLOW_SESSION_SECRET on API instances and workers.

The two additive SQL scripts are 039_forge_credentials.sql and 040_forge_delivery_actor.sql, after upstream migration 038. They create user_forge_tokens and add mr_delivery_states.forge_user_id; deployments using the existing incremental schema setup receive these additions through GORM. Manual SQL deployments can apply the scripts themselves.

This PR covers Forgejo repository and PR delivery. Forgejo Issue import, Gitea API support and automatic promotion tracking from the integration branch to the default branch remain follow-up work.

Validation

  • NODE_OPTIONS=--no-experimental-webstorage bash scripts/build-chatbot.sh — production build and 401 frontend tests.
  • go test -p=2 ./... -count=1 -timeout=600s — full Go suite, matching the updated upstream CI timeout. The HTTP package takes about 240 seconds on this host.
  • NODE_OPTIONS=--no-experimental-webstorage npm --prefix webtest test — 213 console tests, including English credential labels and host-scoped HTTPS credentials.
  • go vet -p=2 ./...
  • python3 scripts/check-public.py
  • bash scripts/scan-secrets.sh
  • Build the runtime image from the tracked Git snapshot and run the isolated container acceptance harness through the public Playwright suite, including 3 first-run and 23 other passing browser cases, runtime compatibility and persistence after container recreation. Three paid-model cases and the live Forgejo browser case were skipped by configuration.
  • Regression coverage uses real Git over SSH and local HTTPS fixtures for PR creation/reuse, approval denial, legacy SSH workspaces, actor refresh, node capability revocation, and merged-PR delivery refresh.
  • Paid-model journeys and the opt-in live Forgejo browser case were not rerun during this final review. Earlier Forgejo 17.0.1 acceptance exercised SSH, PR creation/reuse, protected integration branches and merge restrictions.

Safety

  • I did not include credentials, internal endpoints, production data, or organization-specific infrastructure.
  • I preserved user files and unrelated changes.
  • I updated generated Classic host bundles when applicable.
  • I documented third-party content and licensing changes when applicable.

Classic/Portable bundles and third-party assets are outside this change.

Keep the run checkout and branch settings frozen. After an SSH push, allow the current Forgejo binding to open a PR only if it still belongs to the same project and uses the same SSH remote.
Adapt Forgejo PR submission to native Git workspaces and scoped SOP MCP calls. Preserve upstream write approvals and verify PRs against the pushed head. Move Forgejo SQL scripts past upstream migrations.
Bind SOP PR capabilities to the responsible user and reject them after reassignment. Refresh the saved delivery actor when an existing conversation PR is updated.
Preserve Forgejo delivery alongside host-scoped HTTPS credentials and external MR URL handling. Renumber the additive Forgejo migrations after upstream scripts.
Complete the English credential panel and updated Git address hints. Use the shared credential dialog dispatch without a redundant check.
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