Skip to content

fix(#9714): deliver full shim template on GitHub ref upgrade - #9717

Merged
waynesun09 merged 4 commits into
mainfrom
agent/9714-full-shim-on-ref-upgrade
Nov 19, 2026
Merged

waynesun09 merged 4 commits into
mainfrom
agent/9714-full-shim-on-ref-upgrade

Conversation

@fullsend-ai-coder

@fullsend-ai-coder fullsend-ai-coder Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes repos install on GitHub so a fullsend_ref upgrade delivers the full new shim template in one run. Before, the first run changed only the uses: pins and left the pull_request_target trigger in place. A second run was needed to repair it. The dry run also promised a content-drift repair that the live run dropped.

Related Issue

#9714

Changes

internal/repos/converge.go:

  • Root cause (verified): on GitHub, convergeRefFiles queues a pin-only rewrite (replaceShimRef) of the shim and thin callers. Those paths went into refFileSet, and convergeContentDriftFiles skips every path in it. So the template at the new ref was never queued. On a dry run convergeRefFiles returns no files, so the skip set was empty and the repair was reported.
  • collectConvergeScaffoldFiles: on GitHub, pin-only ref paths are now left out of the content-drift skip set. The live and dry runs now use the same skip set. Missing-component repair paths stay in the skip set.
  • New supersedePinOnlyRefFiles: a drift repair for a pin-only path replaces the queued file in place, so one commit carries both the new pin and the template change. If the shim repair uses the other workflow extension (.yml vs .yaml), it replaces the shim at its installed path instead of adding a second shim. Other repairs are appended as before.
  • GitLab is unchanged, since its ref upgrades already rewrite templates wholesale.
  • Updated a comment above withoutLegacyOpenAIConsumer that said a pin-only rewrite excludes the shim from drift repair, which is no longer true.

Pin style (takeover commit): when a drift repair supersedes a pin-only file, the pin the ref upgrade wrote is re-applied (withQueuedPin). The drift template renders a semver target as <sha> # tag, while the ref upgrade keeps the repository's style: a plain tag stays a plain tag and a branch stays a branch, as the repo-management docs promise. The template uses the tag only in the uses: pin, so nothing else depends on it.

Template fetch failure (takeover commits): content drift falls back to the running binary's embedded templates when the fetch at the pinned ref fails (or no resolver exists). Those can belong to another release, so during a GitHub ref upgrade they no longer replace the shim (either extension) or the thin callers: the pin-only rewrite is delivered, the repair count and actions say the same in dry and live runs, and a note says template fetch at the target ref failed: delivering the pin upgrade only; run install again to deliver template changes. A legacy OpenAI shim also waits for a run whose fetch succeeds. The required-upgrade docs name this fallback.

Behaviour note: on a ref upgrade, a locally edited thin caller (prioritize.yml) is now reset to the template in the same commit. Before, the pin-only rewrite kept the edit until the next install, which reset it.

Testing

  • New TestConverge_RefUpgradeDeliversFullShimTemplate: a shim on pull_request_target at v1.0.0 with fullsend_ref: v2.0.0.
    • Live run: exactly one shim file is committed, with the pull_request trigger and the v2.0.0 pin. No shim content drift remains.
    • Dry run: reports both the ref upgrade and the shim repair.
    • The live subtest fails without the fix.
  • New TestSupersedePinOnlyRefFiles: covers in-place replacement, the extension-mismatch case, and append behavior.
  • TestConverge_RefUpgradeDeliversFullShimTemplate now serves templates at v2.0.0 that differ from the embedded ones and resolves the tag to a SHA, so the live subtest proves the target ref's template lands with the plain-tag pin kept. Fetch-failure subtests (live and dry run, .yaml and .yml) cover the fallback.
  • Unit tests: withQueuedPin early returns (no pin, nil pattern, pattern without a group) and withoutRefPathRepairs.
  • New TestSupersedePinOnlyRefFiles_KeepsPinStyle: plain-tag, SHA-with-tag and branch pins survive the supersede. Reverting to the raw drift content fails all three cases.
  • go test ./internal/repos/... ./cmd/fullsend/... passes. gofmt and go vet ./... are clean. The secret scan passed.
  • pre-commit could not fetch remote hook repositories in the sandbox (TLS verification failure). Instead, gofmt and go vet were run directly. semgrep-scan was skipped because its ruleset download was blocked.

Live validation

On public scratch repo nonflux/tmp-v057-upgrade-manifest: the shim was reset to the v0.56.1 install (pull_request_target, pinned 27c1d6ce… # v0.56.1). Then, with a binary built from this branch, repos set github.fullsend_ref f24e7d3bb… (main with #9230; v0.57.0 is not tagged yet) followed by one repos install:

  • Converging repos to desired state
    [nonflux/tmp-v057-upgrade-manifest] Checking installation status
    [nonflux/tmp-v057-upgrade-manifest] Upgrading 27c1d6ce1d384fa8b85b6789653fb3505d93c9d3 → f24e7d3bb03c44371e58653f0fd051ed9c445b0f
    [nonflux/tmp-v057-upgrade-manifest] Repairing 1 files with content drift
  ✓ Created PR #3: https://github.com/nonflux/tmp-v057-upgrade-manifest/pull/3
  ✓ Install complete: 0 installed, 1 converged, 0 already current, 0 failed

PR #3 changes pull_request_target: → pull_request: and both uses: pins to f24e7d3bb… in one commit. After merging it:

REPO                               REF      STATUS          DRIFT
nonflux/tmp-v057-upgrade-manifest  f24e7d3  installed       none

A second repos install --dry-run reports 1 already current. The same steps were re-run with a binary built at c4310b2 (PR #4 on the same repo) with the same result. Before this fix the same steps needed a second install for the trigger (the repro in #9714).

Out of scope: the repos status warning for an installed pull_request_target shim mentioned under "Related" in the issue. Triage suggested it as a separate follow-up.

🤖 Generated with Claude Code


Closes #9714

Post-script verification

  • Branch is not main/master (agent/9714-full-shim-on-ref-upgrade)
  • Secret scan passed (gitleaks — f24e7d3bb03c44371e58653f0fd051ed9c445b0f..HEAD)
  • PR body secret scan passed (gitleaks — no-git)
  • Final PR description secret scan passed (gitleaks — no-git)

On GitHub, convergeRefFiles queues a pin-only rewrite of the shim and
thin callers. Those paths went into refFileSet, which content drift
skips, so the template at the new ref (for example the pull_request
trigger that replaced pull_request_target) was never queued. A second
repos install then had to repair the drift. The dry run queues no ref
files, so it reported a repair the live run dropped.

On GitHub, collectConvergeScaffoldFiles now leaves pin-only ref paths
out of the content-drift skip set, which matches the dry run. A drift
repair for such a path replaces the queued pin-only file in place via
supersedePinOnlyRefFiles. A shim repair rendered at the other workflow
extension (.yml vs .yaml) replaces the shim at its installed path
instead of adding a second shim. GitLab ref upgrades already rewrite
templates wholesale and are unchanged.

When drift supersedes a pin-only file, the pin form comes from the drift
render (resolveTargetRef), the same form install and unchanged-ref drift
repair already write.

Note: pre-commit could not fetch remote hook repositories (TLS
certificate verification failed). gofmt and go vet were run directly
and passed. semgrep-scan was skipped (ruleset download blocked). Secret
scan passed.

Closes #9714

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@waynesun09

Copy link
Copy Markdown
Member

/fs-fix-stop

@github-actions github-actions Bot added the fullsend-no-fix Skip bot-triggered fix agent runs label Nov 19, 2026
@github-actions

Copy link
Copy Markdown

Fix agent disabled for this PR. Remove the fullsend-no-fix label or use /fs-fix to re-engage.

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ⚠️ Cancelled · Started 8:54 PM UTC · Completed 9:03 PM UTC

Commit: fdd0a8c · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.36

This review was superseded by a newer commit. Check the current pull request HEAD's review status before merging.

…edes

The content-drift template renders a semver target as "<sha>  # tag",
while the ref upgrade keeps a repository's own pinning style: a plain tag
stays a plain tag and a branch stays a branch. When a drift repair
supersedes a queued pin-only file, re-apply the pin the ref upgrade wrote,
so delivering the full template in one pass does not also change the pin
style.

Add a test for plain-tag, SHA-with-tag and branch pins.

Assisted-by: Claude
Signed-off-by: Wayne Sun <gsun@redhat.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 9:05 PM UTC · Completed 9:11 PM UTC

Commit: b757ec5 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.30

@fullsend-ai-review fullsend-ai-review Bot added the risk/moderate PR risk: moderate label Nov 19, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Modest 3-file bug fix by an established bot author with no protected or security-sensitive paths, balanced by high recent churn and coupling in convergence logic, with tight issue alignment yielding moderate risk.

Previous run

Risk Assessment: moderate (2/5)

Details

Targeted bug fix with no protected paths or dependency changes, but high recent churn and regression history in internal/repos/converge.go elevate risk to moderate.

Previous run (2)

Risk Assessment: moderate (2/5)

Details

Small bug fix with 50% test file ratio and no protected paths, but high recent churn and regression history in internal/repos/converge.go elevate risk to moderate.

Previous run (3)

Risk Assessment: moderate (2/5)

Details

Small bug fix with 50% test coverage and no protected paths, but high recent churn and regression history in internal/repos/converge.go elevate the risk to moderate.

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Review

Findings

Low

  • [pattern-inconsistency] internal/repos/converge.go:3533 — convergeContentDriftFiles now has named results (files, actions, targetTemplates), but the named result files is never assigned or used: the function declares a separate local repairFiles and returns it explicitly. Sibling functions in converge.go use unnamed result types.
    Remediation: Rename the first result to repairFiles and drop the local declaration, or go back to unnamed results and declare targetTemplates/actions locally.
  • [logic-error] internal/repos/converge.go:4031 — The template-fetch fallback guard only fires when the current run has a ref/upgrade action. After the first failed fetch, the pin-only rewrite is committed. On the next run the pin is already current, so no upgrade is emitted and the guard is skipped. If the remote fetch still fails, content drift repairs the shim and thin callers from the binary's embedded templates, which is the cross-version mismatch the guard is meant to prevent. This matches pre-existing behavior for non-upgrade runs, so the PR does not introduce it, but the new note ("run install again to deliver template changes") implies the retry is safe.
    Remediation (optional hardening): also suppress shim and thin-caller repairs when targetTemplates is false and an explicit remote pin is set, even with no ref upgrade in this run, and add a two-pass test that commits the pin-only result, keeps the fetch failing, and asserts the second run does not commit embedded templates.

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR
Previous run

Review

Findings

High

  • [sub-agent-failure] N/A — The security sub-agent did not return findings: the run errored with an authentication failure (HTTP 401, expired access token) before producing output. The security dimension was therefore not evaluated for this head; this is an incomplete review, not a clean security result.

Earlier findings

  • internal/repos/converge.go — logic-error — resolved: the fetch-failure filter now drops repairs for both shim workflow extensions and all thin-caller paths.
  • internal/repos/converge.go — logic-error — resolved: live and dry runs share one exclusion predicate, including a shim removed by withoutLegacyOpenAIConsumer.

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR
Previous run (2)

<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJyZXF1ZXN0LWNoYW5nZXMiLCJmaW5kaW5ncyI6W3sic2V2ZXJpdHkiOiJtZWRpdW0iLCJjYXRlZ29yeSI6ImxvZ2ljLWVycm9yIiwiZmlsZSI6ImludGVybmFsL3JlcG9zL2NvbnZlcmdlLmdvIiwiaWQiOiJmXzFhNzU5ZTU5YzFkMWRkMTkiLCJsaW5lIjo0MDIzLCJhY3Rpb25hYmxlIjp0cnVlLCJkaW1lbnNpb24iOiJjb3JyZWN0bmVzcyJ9LHsic2V2ZXJpdHkiOiJtZWRpdW0iLCJjYXRlZ29yeSI6ImxvZ2ljLWVycm9yIiwiZmlsZSI6ImludGVybmFsL3JlcG9zL2NvbnZlcmdlLmdvIiwiaWQiOiJmX2I1N2NlZGVmNDMxMDFiMTUiLCJsaW5lIjo0MDI2LCJhY3Rpb25hYmxlIjp0cnVlLCJkaW1lbnNpb24iOiJjb3JyZWN0bmVzcyJ9XX0= -->

Review

Findings

Medium

  • [logic-error] internal/repos/converge.go:4023 — The fetch-failure guard misses shims installed as fullsend.yml. pinOnlyPaths holds the installed .yml path, but convergeContentDriftFiles emits repairs at the template path (fullsend.yaml), so the exact-path skip keeps the embedded-template repair. supersedePinOnlyRefFiles then matches the two extensions and overwrites the queued shim. A failed target-template fetch can therefore deliver another release template instead of the promised pin-only upgrade. The existing fetch-failure tests do not cover a .yml shim.
    Remediation: Match workflow-path aliases when filtering fallback repairs (consistent with supersedePinOnlyRefFiles), or carry the installed path through repair planning. Add a fetch-failure regression test with an installed fullsend.yml shim.

  • [logic-error] internal/repos/converge.go:4026 — After a template-fetch failure, dry-run drops every shim and thin-caller repair, while the live run drops only paths in pinOnlyPaths. withoutLegacyOpenAIConsumer removes credential-incompatible consumers from the live queue so their full repairs stay deliverable, but dry-run still hides those repairs. The preview omits changes the live run commits, contradicting the "dry run and live run in step" comment.
    Remediation: Compute the same would-be pin-only path set for dry-run and live planning, including the legacy-consumer exclusions, and use it for both filters. Cover a fetch failure with an incompatible OpenAI consumer in both modes.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR
Previous run (3)

<!-- fullsend:review-diff-hash:b28ae1afc48ed0fce3a5b3f22984eb753abafdb71a231eb8aa30c54ea5b4df64 -->
<!-- fullsend:review-head:b757ec5fbccebdb90d4101d752011ab76056725d -->
<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJhcHByb3ZlIiwiZmluZGluZ3MiOltdfQ== -->

Looks good to me


Labels: PR fixes repos install convergence logic in Go.

Previous run (4)

<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJhcHByb3ZlIiwiZmluZGluZ3MiOltdfQ== -->

Looks good to me


Labels: PR fixes repos install convergence logic in Go.

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review fullsend-ai-review Bot added ready-for-merge All reviewers approved — ready to merge component/install CLI install and app setup go Pull requests that update go code labels Nov 19, 2026
…navailable

convergeContentDriftFiles falls back to the running binary's embedded
templates when the GitHub fetch at the pinned ref fails. Those templates
can belong to another release, so they must not replace the pin-only shim
and thin callers of a ref upgrade. convergeContentDriftFiles now reports
whether its templates match the target ref; when they do not, the repairs
for the ref-upgrade paths are dropped (with their actions, so the dry run
says the same), the pin-only rewrite is delivered, and a progress note
says to run install again.

A live run drops only repairs for files actually queued as pin-only, so a
shim withoutLegacyOpenAIConsumer left out still gets its repair. Guard
withQueuedPin against a pattern without a capture group.

Tests: the end-to-end test now serves the templates at the target ref and
resolves the tag to a SHA, so it exercises the plain-tag pin path for real;
new subtests cover the fetch failure in live and dry runs, plus unit tests
for withQueuedPin's early returns and withoutRefPathRepairs.

Assisted-by: Claude (fix, review), DeepSeek (review)
Signed-off-by: Wayne Sun <gsun@redhat.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 9:16 PM UTC · Completed 9:23 PM UTC

Commit: c4310b2 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.29

@fullsend-ai-review fullsend-ai-review Bot removed the ready-for-merge All reviewers approved — ready to merge label Nov 19, 2026
fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review
fullsend-ai-review Bot dismissed their stale review November 19, 2026 21:23

Superseded by updated review

The fetch-failure guard skipped only queued pin-only paths in a live run,
but the shim repair is always rendered at fullsend.yaml, so a shim
installed at fullsend.yml slipped through and still got the embedded
template; the dry run (which filtered by path) reported no repair. Both
runs now drop the shim (either extension) and thin-caller repairs after a
failed fetch during a GitHub ref upgrade. A legacy OpenAI shim waits for a
run whose fetch succeeds instead of taking another release's template.

Also:
- report the drift repair count after the filter, so "Repairing N files"
  matches what is committed or previewed;
- print the fallback note only when a repair was dropped;
- treat a pinned render without fetched templates (no resolver) like a
  failed fetch;
- docs: name the pin-only fallback in the required-upgrade section.

Tests: .yml variants of the fetch-failure live and dry-run subtests, a
pattern without a capture group, and the end-to-end live subtest now
serves a template that differs from the embedded one and asserts it lands.

Assisted-by: Claude (fix, review), DeepSeek (review), Gemini (docs review)
Signed-off-by: Wayne Sun <gsun@redhat.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🤖 Review · ❌ Terminated · Started 9:39 PM UTC · Ended 9:47 PM UTC

Commit: efd7c56 · View workflow run →

@github-actions

Copy link
Copy Markdown

Site preview

Preview: https://2d66c297-site.fullsend-ai.workers.dev

Commit: efd7c56ecb9b82e4fbf86ea5c59e81355f634451

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 9:39 PM UTC · Completed 9:47 PM UTC

Commit: efd7c56 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.52

@waynesun09

Copy link
Copy Markdown
Member

/fs-review

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 10:23 PM UTC · Completed 10:33 PM UTC

Commit: efd7c56 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $2.40

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

See the review comment for full details.

Comment thread internal/repos/converge.go Resolved
Comment thread internal/repos/converge.go Resolved

@waynesun09 waynesun09 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Verified at efd7c56: one repos install now moves a v0.56.1 shim to pull_request and the new pin in one commit (live run on a test repo, repos status clean after merge, second dry run already current). Pin style is kept, and a failed template fetch falls back to the pin-only upgrade with a note. test fails only on TestWorkflowSHAUsesAreTrusted, which is main's breakage from #9206 and is being fixed separately; I'll enqueue once that lands.

@waynesun09
waynesun09 dismissed fullsend-ai-review[bot]’s stale review November 19, 2026 22:35

Latest review summary lists only 2 LOWs; both were answered and resolved. No MEDIUM+ findings remain.

@waynesun09
waynesun09 added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit b373cae Nov 19, 2026
91 of 94 checks passed
@waynesun09
waynesun09 deleted the agent/9714-full-shim-on-ref-upgrade branch November 19, 2026 23:11

This branch had an error being deployed

1 failed, 1 active, and 1 inactive deployments
site-preview — efd7c56e Deployed Nov 19, 2026 by github-actions[bot]
dev — efd7c56e Deployed Nov 19, 2026 by waynesun09 via behaviour #20773
forgejo-dev — efd7c56e Deployed Nov 19, 2026 by waynesun09 via forgejo-behaviour #20773
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/install CLI install and app setup fullsend-no-fix Skip bot-triggered fix agent runs go Pull requests that update go code ready-for-review Triggers review agent dispatch risk/moderate PR risk: moderate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

repos install: a ref upgrade rewrites only the shim pin, so the pull_request trigger needs a second run

1 participant