Skip to content

Fix repo-memory pushes on shared branches - #66682

Merged
pelikhan merged 3 commits into
mainfrom
pelikhan-repo-memory-push-failure
Oct 7, 2026
Merged

pelikhan merged 3 commits into
mainfrom
pelikhan-repo-memory-push-failure

Conversation

@pelikhan

@pelikhan pelikhan commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Preserve files managed by sibling workflows on a shared repo-memory branch instead of deleting them when they do not match the current workflow's filters. Apply the same eligibility predicate to JSON normalization and the validator's disposable copy, and include normalized existing files in the scoped commit. Propagate Git authentication and the ambient environment through the ancestry probe and retry fetch/rebase operations.

Root cause

Addresses githubnext/gh-aw-rai#214.

Observed in run 37678745693, workflow revision 44d482df4239e62407b3b2d99040de0298430a91, using setup runtime v0.91.1:

  • The Jailbreak workflow shared memory/rai-dsb-validation with sibling validation workflows, but its file-glob selected only jailbreak-upia-*.jsonl.
  • push_repo_memory deleted 30 sibling files from the checkout. Those deletions were not included in the artifact-scoped commit.
  • Another writer advanced the remote head. Both signed replay and the retry rebase failed with cannot rebase: You have unstaged changes.
  • The ancestry probe also attempted an implicit partial-clone fetch without credentials, producing could not read Username.

The fix does not stage the sibling deletions, discard them, or stash around the failure: it prevents those destructive deletions in the first place.

Verification

  • Reproduced the original unstaged-change rebase error using a disposable local bare remote and two writers.
  • The regression passes with JSON formatting both disabled and enabled; it verifies sibling preservation, validator scope, normalized-file staging, clean worktrees, and a successful retry onto the concurrent head.
  • Eleven regression/unit cases passed using a dependency-free Node harness executing the test bodies, including validator mutation/timeout behavior and credential propagation.
  • make fmt-cjs, make lint-cjs, the Go build, module syntax checks, schema freshness, and git diff --check passed. Impacted Go validation found no changed Go files.

Remaining validation

The standard pinned JavaScript suite and type-check remain unverified: npm ci failed because pinned vite@8.3.2 was unavailable from both the configured registry and the approved 1ES feed. Dependencies were not changed. The final make agent-report-progress gate was run with the installed modern Bash and stopped at missing tsc after the other gates passed.

No workflow was dispatched and no hosted fix is claimed. The affected repository must consume a release of the corrected runtime before this changes its future runs.

Preserve sibling workflow files on shared memory branches and scope formatting and custom validation to eligible files. Include normalized existing files in the managed commit and pass Git authentication through ancestry and retry operations.

Related to githubnext/gh-aw-rai#214.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review October 7, 2026 20:36
Copilot AI balanced review requested due to automatic review settings October 7, 2026 20:36
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Lean already. Ship.

Generated by Ponytail Reviewer for #66682

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

No ADR enforcement needed for PR #66682: no 'implementation' label (has_implementation_label=false) and 0 new lines in default business logic directories (threshold 100, requires_adr_by_default_volume=false). Evidence: /tmp/gh-aw/agent/adr-prefetch-summary.json; no custom .design-gate.yml present (defaults used).

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

🔎 PR Code Quality Reviewer is reviewing code quality for this pull request...

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The validation copy can retain empty sibling directories outside the eligible scope.

1 open finding
What changed in this PR

Preserves sibling workflow files on shared repo-memory branches while keeping normalization, validation, staging, and retry authentication correctly scoped.

Changes:

  • Applies file eligibility consistently during normalization and validation.
  • Stages normalized existing files without deleting sibling files.
  • Propagates authentication and ambient environment through Git retry operations.
File Description
docs/​src/​content/​docs/​reference/​repo-memory.md Documents shared-branch eligibility behavior.
actions/​setup/​js/​push_signed_commits.cjs Authenticates partial-clone ancestry probes.
actions/​setup/​js/​push_signed_commits.test.cjs Tests ancestry-probe environment propagation.
actions/​setup/​js/​push_repo_memory.cjs Preserves siblings and scopes formatting, validation, and commits.
actions/​setup/​js/​push_repo_memory.test.cjs Adds shared-branch concurrency regression coverage.
actions/​setup/​js/​memory_custom_validation.cjs Filters disposable validation copies.
actions/​setup/​js/​memory_custom_validation.test.cjs Tests filtered validation without source mutation.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread actions/setup/js/memory_custom_validation.cjs

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /diagnosing-bugs (fallback heuristic used — triage agent not invoked given the diff's small, well-scoped surface area already fully analyzed). No blocking issues found.

📋 Key Themes & Highlights

Root cause addressed, not just symptoms

The fix threads an isEligibleFile predicate through formatJSONFiles, runCustomMemoryValidation's disposable copy filter, and the commit's managedPaths/literalPathspecs set, rather than deleting sibling files up front (the old filterIneligibleMemoryFiles call). This directly matches the root cause in the linked issue: destructive deletions of sibling-workflow files on a shared branch, not just the symptomatic rebase failure.

Strong regression coverage

The new it.each([false, true])("preserves sibling files through validation and concurrent-head retries ...") test in push_repo_memory.test.cjs is a genuine end-to-end regression test using a disposable bare remote and two writers — it reproduces the original unstaged-changes rebase failure, verifies sibling preservation, validation scope, normalized-file staging, and a successful retry onto a concurrent head. This is a textbook /diagnosing-bugs regression test: it would have failed before the fix and passes after.

Consistent env propagation fix

gitEnv = { ...process.env, ...(gitAuthEnv || {}) } in reconcileRepoMemoryRetry and the analogous fix in push_signed_commits.cjs's ancestry probe correctly address the could not read Username / lost PATH/HOME failure mode — previously execGitSync/getExecOutput received only gitAuthEnv (dropping ambient env), now both are merged, consistent with the existing pattern already used elsewhere in push_signed_commits.cjs (e.g. lsRemoteHeadOid, pushBranchAndResolveHead).

Positive highlights

  • ✅ isEligibleFile defaults to () => true in formatJSONFiles, preserving backward compatibility for the two other call sites (safe_outputs_handlers.cjs, validate_memory_step.cjs) that don't pass a predicate.
  • ✅ New literalPathspecs.length === 0 early-return in push_repo_memory.cjs cleanly handles the case where normalization touches no eligible files, avoiding an unnecessary git status/add on an empty pathspec set.
  • ✅ Docs updated (repo-memory.md) to describe the new shared-branch preservation behavior and clarify the validator copy now reflects "eligible" files only.
  • ✅ No unrelated changes; the diff stays tightly scoped to the three implicated files plus tests and docs.

I did not find actionable issues worth blocking on. The PR's own "Remaining validation" section is transparent about the unverified npm ci/tsc gate (pinned vite unavailable) — this is an environment constraint, not a code defect, and the described verification (Go build, lint-cjs, fmt-cjs, 11 passing regression/unit cases via a dependency-free harness) is reasonable compensating evidence.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 98 AIC · ⌖ 13.5 AIC · ⊞ 10.1K
Comment /matt to run again

@github-actions github-actions Bot mentioned this pull request Oct 7, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed with the impeccable skill's harden and audit modes (bug-fix PR touching edge-case eligibility filtering, credential propagation, and retry logic).

Scope reviewed: memory_custom_validation.cjs, push_repo_memory.cjs, push_signed_commits.cjs, their test files, and docs/repo-memory.md.

Findings: No blocking issues.

  • The isEligibleFile predicate is threaded consistently through formatJSONFiles, runCustomMemoryValidation's disposable copy, and scanDirectory's eligibility check, so sibling files from other workflows sharing a branch are no longer normalized, validated, or deleted — matching the stated root cause.
  • gitAuthEnv is now correctly merged into process.env (not replacing it) for fetch/rebase/rebase --abort in reconcileRepoMemoryRetry, and for the merge-base --is-ancestor ancestry probe in push_signed_commits.cjs — fixing the "could not read Username" and "unstaged changes" failures described in the linked issue.
  • managedPaths correctly includes ledgerActivity.normalized so normalized-but-unchanged-via-copy files are still staged/committed, and the new early return on literalPathspecs.length === 0 avoids an unnecessary git status/add/commit cycle while still writing the ledger summary.
  • New regression test (it.each([false, true])(...)) is thorough: verifies sibling preservation, scoped validation, normalization, clean worktree, retry onto a concurrent head, and credential/env propagation through mocked execGitSync.
  • Docs updated to describe the new shared-branch scoping behavior and the validator's "eligible files" copy.
  • Ran the affected vitest files directly; confirmed failures in push_repo_memory.test.cjs (17 on base vs 14 on this PR's head) are pre-existing, environment-dependent (network/cert, token-redaction formatting) and unrelated to this change — not introduced by it.

No actionable inline comments to add.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · copilot · sonnet50 · 135.4 AIC · ⌖ 13.1 AIC · ⊞ 8.1K

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (actions/setup/js/memory_custom_validation.cjs:258): The filter retains every directory unconditionally, so a sibling subtree containing only ineligible files is copied as an empty directory. Validators that enumerate memoryRoot will still see that sibling path (the new integration test itself expects an exact top-level listing), which means the disposable view is not actually scoped to eligible content. Please either copy eligible files into a fresh tree or prune directories that contain no eligible descendants. - Fix repo-memory pushes on shared branches #66682 (comment)
  3. Fix failing check Conclusion (FAILURE): https://github.com/github/gh-aw/actions/runs/37683291250/job/113008877782.
  4. Fix failing check JS Tests (shard 4/4) (FAILURE): https://github.com/github/gh-aw/actions/runs/37683291201/job/113004736839.

Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI.

Sous-chef head: 922bfee
Sous-chef work: 0509a06e077eaa83a372df3d162d9c78104040104e9d7f29c8e2b46a9cd1c083 06fbcf03cf3ab21f1f8a7c7014e45cd66006dec0f55f7be66790ef1ea2115f73 31f7e812d45f0792093269b7b90445aa9803225a204ec130694b9ceb0227d7cc
Sous-chef state: 64f89d126d21b7fa7194146f351b9174cd12c5abefdbbfa0bd2e09b40925a56b

Generated by 👨‍🍳 PR Sous Chef · pi · haiku45 · 4.45 AIC · ⌖ 7.88 AIC · ⊞ 1K · ◷
Comment /souschef to run again

Copilot AI and others added 2 commits October 7, 2026 21:15
…push-failure

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI requested a review from gh-aw-bot October 7, 2026 21:28
@pelikhan

pelikhan commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot run pr-finisher skill

@pelikhan
pelikhan merged commit de42ea6 into main Oct 7, 2026
1 of 2 checks passed
@pelikhan
pelikhan deleted the pelikhan-repo-memory-push-failure branch October 7, 2026 22:03
Copilot stopped work on behalf of pelikhan due to an error October 7, 2026 22:04
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.91.6

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.

4 participants