feat(#4912): add --config and --config-hash preset install flags - #5953
Conversation
Add support for vendor-curated configuration presets in per-repo setup. When --config is provided with a local file path or HTTPS URL, the installer fetches the preset and commits it as .fullsend/config.base.yaml in the target repository. A stub .fullsend/config.yaml overlay with comments and minimal fields is generated alongside. The optional --config-hash flag accepts a SHA-256 hex digest. When supplied, the fetched preset content is validated against the hash before any commit; a mismatch aborts the operation. Without --config, the existing per-repo setup behavior is unchanged — a full config.yaml is generated from CLI flags. Implementation details: - preset.go: fetchPreset (local file / HTTPS), validatePresetHash (SHA-256), and stubConfigYAML constant - github.go: configPreset/configHash fields on githubSetupConfig, flag registration, validation, and integration into runGitHubSetupPerRepo - preset_test.go: unit tests for fetch, hash validation, CLI flag presence, hash-without-config error, dry-run with preset, dry-run with hash match/mismatch, file layout verification (base + stub committed), backward compatibility (no base without --config), and missing-file error handling Note: pre-commit could not run in sandbox (network restriction during hook init). Post-script runs authoritative pre-commit. Closes #4912
|
🤖 Finished Review · ✅ Success · Started 7:47 PM UTC · Completed 8:04 PM UTC |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
ReviewFindingsLow
Previous runReviewFindingsHigh
Medium
Low
Labels: PR adds new --config/--config-hash install flags to the github setup CLI command Next steps:
|
|
/fs-fix |
|
🤖 Finished Fix · ✅ Success · Started 5:55 AM UTC · Completed 6:06 AM UTC |
- Add CheckRedirect policy to reject non-HTTPS redirects (SSRF fix) - Reject --runtime/--agents when --config is set (silent flag ignoring) - Reject --config/--config-hash in per-org mode (per-repo only) - Add YAML syntax validation before committing preset content - Enforce presetMaxSize limit in fetchPresetLocal (parity with HTTPS) - Warn when remote preset fetched without --config-hash - Expand --config flag description to "local file path or HTTPS URL" - Add --config and --config-hash to CLI reference flags table - Add vendor preset section to getting-started and advanced-setup docs - Add tests for all new validations Addresses review feedback on #5953
🔧 Fix agent — iteration 1 (human-triggered)Addressed all 10 review findings: SSRF redirect protection, flag interaction validation (--runtime/--agents with --config, --config in per-org mode), YAML syntax validation, symmetric size limits, remote-without-hash warning, flag description clarity, and documentation updates across CLI reference, getting-started guide, and advanced setup guide. Added tests for all new validations. Fixed (10):
Tests: passedNext steps:
|
|
🤖 Review · ❌ Terminated · Started 6:08 AM UTC · Ended 6:21 AM UTC |
Site previewPreview: https://c5185f56-site.fullsend-ai.workers.dev Commit: |
Superseded by updated review
|
🤖 Finished Review · ✅ Success · Started 6:08 AM UTC · Completed 6:21 AM UTC |
|
🤖 Finished Retro · ✅ Success · Started 8:50 AM UTC · Completed 9:04 AM UTC |
Retro: PR #5953 —
|
| Time (UTC) | Event |
|---|---|
| Aug 5 19:27 | ifireball triggers /fs-code on issue #4912 |
| Aug 5 19:28–19:46 | Code agent produces implementation (772 additions, 6 files, 85% patch coverage) |
| Aug 5 19:46 | PR #5953 created by fullsend-ai-coder[bot] |
| Aug 5 19:47 | Two review runs dispatched; first cancelled in 17s, second runs to completion |
| Aug 5 20:04 | Review completes with 10 findings: 1 high (stale docs), 3 medium (SSRF-TLS-downgrade, silent flag ignoring, missing guide), 6 low |
| Aug 6 05:54 | ifireball triggers /fs-fix |
| Aug 6 05:55–06:06 | Fix agent addresses all 10 findings in a single pass (~11 min) |
| Aug 6 06:07–06:21 | Second review approves — only informational low-severity items remain |
| Aug 6 08:09 | ifireball approves |
| Aug 6 08:48 | PR merged |
Assessment
This workflow performed well. The pipeline produced a solid outcome in two iterations (code → fix), which is the ideal minimum when the first review has legitimate findings.
Review quality was strong. The review agent caught a genuine security issue (SSRF via TLS-downgrade through HTTP redirect chain in fetchPresetHTTPS), three documentation gaps across docs/cli/github.md, docs/guides/getting-started/configuring-github.md, and docs/guides/infrastructure/advanced-setup.md, and several UX improvements (flag conflict validation, YAML syntax check, warning for unhashed remote presets). No false positives wasted human time. The second review correctly calibrated remaining low-severity items as acceptable for the local CLI threat model.
Fix agent was excellent. All 10 review findings were addressed in a single 11-minute pass, with no rework. The fix added SSRF redirect protection, flag conflict validation, YAML validation, size limit enforcement, a remote-without-hash warning, and complete documentation updates.
Code agent did well on implementation, less well on docs and security hardening. The initial 772-line implementation was functionally correct with comprehensive tests (514-line test file, 85% patch coverage). The gaps were: (1) three documentation files not updated when adding new CLI flags, and (2) using Go's default http.Client without a redirect policy for user-provided URLs.
Evidence for existing issues
- #5848 (AGENTS.md CLI flag docs guidance): Direct evidence. The code agent added
--configand--config-hashflags but did not updatedocs/cli/github.md. Note: AGENTS.md: add guidance to update docs/cli/ when changing CLI flag behavior #5848 scopes todocs/cli/only, but this PR also misseddocs/guides/pages — the guidance should cover all ofdocs/to be fully effective. - #3024 (AGENTS.md secure HTTP client guidance): Direct evidence. The code agent used a default
http.Clientwith no redirect policy, creating an SSRF-TLS-downgrade vector that the review agent caught. - #1733 (Code agent proactive docs updates): Supporting evidence. The code agent did not update getting-started or infrastructure guides despite adding a user-facing feature.
- #1452 (Deduplicate review dispatches for same HEAD SHA): Minor evidence. Two review runs were dispatched within 11 seconds of each other for the same HEAD SHA at PR creation; one was cancelled after 17 seconds.
No new proposals
All improvement opportunities identified are already tracked by open issues. Implementing #5848 (broadened to cover all docs/ paths) and #3024 would likely have eliminated the fix iteration entirely, as the code agent would have updated documentation and used a secure HTTP client pattern in the initial implementation.
Summary
Adds
--configand--config-hashflags tofullsend github setup <owner/repo>for installing vendor-curated configuration presets per ADR 0069 Decision 3.When
--config <path-or-url>is provided, the installer:--config-hash <sha256>when supplied (hash mismatch aborts before commit).fullsend/config.base.yamlin the target repository.fullsend/config.yamlwith comments and minimal empty override fieldsWithout
--config, the existing per-repo setup behavior is unchanged.Changes
internal/cli/preset.go:fetchPreset(local/HTTPS),validatePresetHash(SHA-256), andstubConfigYAMLconstantinternal/cli/github.go:configPreset/configHashfields, flag registration,--config-hash requires --configvalidation, and preset integration inrunGitHubSetupPerRepointernal/cli/preset_test.go: Unit tests covering fetch (local file, HTTPS, missing, empty, unsupported scheme), hash validation (match, mismatch, uppercase, invalid length/hex), CLI flag presence, flag validation errors, dry-run paths, file layout verification (base + stub committed, no base without--config), and error handlingTesting
githubCLI tests pass (go test -race -run "TestGitHub|TestParseTarget|TestRunGitHub|TestConfig|TestFetchPreset|TestValidatePresetHash")go vet ./internal/cli/passesTestPostScriptEnv_NoSchemaAppendedWhenNoValidationLoopis unrelated (run_test.go)Closes #4912
Post-script verification
agent/4912-config-preset-flags)8549ba72c380c8d969a6620c0a94f2abd30898d5..HEAD)