Skip to content

feat: code agent post-script and provider - #1

Closed
ben-alkov wants to merge 5 commits into
mainfrom
feat/code-agent-post-script
Closed

feat: code agent post-script and provider#1
ben-alkov wants to merge 5 commits into
mainfrom
feat/code-agent-post-script

Conversation

@ben-alkov

Copy link
Copy Markdown
Owner

Summary

  • Add .fullsend/providers/github.yaml — maps FULLSEND_CODE_BOT_TOKEN to GH_TOKEN on the host side (ADR-0017)
  • Add .fullsend/harness/code.yaml — wires agent, provider, post-script, and runner env vars
  • Add .fullsend/scripts/post-code.sh — pushes agent feature branch and opens a PR linking to the originating issue
  • Update dispatch/github/workflows/code.yml to export ISSUE_NUMBER and REPO_FULL_NAME

Depends on PR fullsend-ai#231 (fullsend run CLI) and Marta's repo extraction work.

Test plan

  • Verify YAML syntax: python3 -c "import yaml, sys; yaml.safe_load(open(sys.argv[1]))" .fullsend/harness/code.yaml
  • Verify shellcheck passes on post-code.sh
  • E2E test after repo extraction lands: mock runDir/repo/ with a feature branch, set env vars, run post-code.sh

@ben-alkov
ben-alkov force-pushed the feat/code-agent-post-script branch from 2155c47 to 5f1bded Compare April 17, 2026 13:32
Automation layer that takes the code agent's local commit from the
sandbox and turns it into a pushed branch and PR. Three files:
harness YAML, provider YAML, and a post-script shell script.

Depends on repo extraction (in-flight) and PR fullsend-ai#231 (fullsend run CLI).

Assisted-by: Claude Code (Opus 4.6)
Pushes the agent feature branch and opens a PR that auto-closes
the originating issue. Runs on the host after sandbox teardown
with access to the extracted repo and GH_TOKEN.

Assisted-by: Claude Code (Sonnet 4.6)
Wires the code agent to the GitHub provider, post-script, and
runner env vars (ISSUE_NUMBER, REPO_FULL_NAME). References
agents/code.md and policies/code.yaml which are out of scope
for this change.

Assisted-by: Claude Code (Sonnet 4.6)
Maps FULLSEND_CODE_BOT_TOKEN to GH_TOKEN on the host side.
The token is used by the post-script for push and PR creation
and never enters the sandbox (ADR-0017).

Assisted-by: Claude Code (Opus 4.6)
@ben-alkov
ben-alkov force-pushed the feat/code-agent-post-script branch from 5f1bded to 60a334c Compare April 22, 2026 23:13
@ben-alkov ben-alkov closed this Apr 23, 2026
@ben-alkov
ben-alkov deleted the feat/code-agent-post-script branch April 23, 2026 21:08
ben-alkov pushed a commit that referenced this pull request May 18, 2026
When a human submits a PR and the review agent requests changes, the fix
agent no longer auto-triggers. This is now the default behavior for
human-authored PRs. Bot-authored PRs (from the code agent) continue to
auto-trigger fixes as before.

Humans can opt in to the review-fix loop by adding the `fullsend-fix`
label to their PR. The existing `/fs-fix` command for manual invocation
is unaffected — it intentionally bypasses this gate so authorized users
can always trigger fix regardless of labels.

Changes across dispatch paths (reusable dispatcher, per-repo scaffold):
- Gate fix dispatch on PR author ending in [bot] OR presence of
  `fullsend-fix` label
- Add defense-in-depth check in reusable-fix.yml that verifies PR
  author and label before running the fix agent
- Add inline comment clarifying /fs-fix bypass (per review feedback)

Note: fullsend.yaml shim no longer needs this gate — upstream refactored
it to delegate all routing to the reusable dispatch workflow.

E2E tested in ascerra-fullsend-lab org (human-pr-fix-test repo):

1. Human PR, no label (PR #1) — fix agent SKIPPED
   - Review: https://github.com/ascerra-fullsend-lab/.fullsend/actions/runs/25836235094
   - Shim skipped dispatch-fix-bot: https://github.com/ascerra-fullsend-lab/human-pr-fix-test/actions/runs/25836370170

2. Human PR, fullsend-fix label (PR #2) — fix agent auto-triggered
   - Review: https://github.com/ascerra-fullsend-lab/.fullsend/actions/runs/25837485822
   - Shim dispatched fix: https://github.com/ascerra-fullsend-lab/human-pr-fix-test/actions/runs/25837620440
   - Fix agent succeeded: https://github.com/ascerra-fullsend-lab/.fullsend/actions/runs/25837623950

3. Bot PR, no label (PR fullsend-ai#4, author: ascerra-fullsend-lab-coder[bot]) — fix agent auto-triggered
   - Code agent created PR: https://github.com/ascerra-fullsend-lab/.fullsend/actions/runs/25838129538
   - Review requested changes: https://github.com/ascerra-fullsend-lab/.fullsend/actions/runs/25838396492
   - Shim dispatched fix (no label needed): https://github.com/ascerra-fullsend-lab/human-pr-fix-test/actions/runs/25838580565
   - Fix agent succeeded: https://github.com/ascerra-fullsend-lab/.fullsend/actions/runs/25838584099

Co-authored-by: Cursor <cursoragent@cursor.com>
ben-alkov pushed a commit that referenced this pull request Aug 6, 2026
…riables

Add HMAC-SHA256 signing of dispatch variables so API-triggered GitLab
pipelines can verify the variables were set by the trusted poller, not
forged by an attacker. This reduces the residual risk where CI_API_V4_URL
override could bypass bot identity verification (mitigation #1).

Go poller (dispatch.go):
- computeDispatchHMAC() signs canonical key=value pairs using
  FULLSEND_DISPATCH_SECRET
- signedDispatchKeys defines the canonical key list (sorted)
- FULLSEND_POLL_JOB_URL included in signed keys
- Once-per-run warning when FULLSEND_DISPATCH_SECRET is not set

Shell verifier (fullsend-agent.yml):
- HMAC verification block for API-triggered pipelines
- Secret passed via env var (not command line) to avoid /proc exposure
- Constant-time comparison via python3 hmac.compare_digest
- Fail-closed: missing HMAC or mismatch aborts the job
- Backward compatible: skipped when secret not configured

Tests:
- Cross-language test executing both Go and python3 HMAC against same
  test vector to verify identical output
- Key list parity test between Go signedDispatchKeys and shell printf
- HMAC determinism, tampering detection, missing keys
- Integration test covering all signed keys for MR events

Closes fullsend-ai#5572 (mitigation #2)

Signed-off-by: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Greg Allen <gallen@redhat.com>
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