Skip to content

fix(sync): Use token-authenticated URL for git push to consumer repos#228

Merged
stranske merged 1 commit intomainfrom
fix/sync-workflow-auth
Dec 27, 2025
Merged

fix(sync): Use token-authenticated URL for git push to consumer repos#228
stranske merged 1 commit intomainfrom
fix/sync-workflow-auth

Conversation

@stranske
Copy link
Copy Markdown
Owner

@stranske stranske commented Dec 27, 2025

Automated Status Summary

Scope

  • Scope section missing from source issue.

Tasks

  • Tasks section missing from source issue.

Acceptance criteria

  • Acceptance criteria section missing from source issue.
  • Head SHA: 130b894
  • Latest Runs: ⏳ queued — Gate
  • Required: gate: ⏳ queued
  • | Workflow / Job | Result | Logs |
  • |----------------|--------|------|
  • | Agents PR meta manager | ❔ in progress | View run |
  • | CI Autofix Loop | ✅ success | View run |
  • | Copilot code review | ❔ in progress | View run |
  • | Gate | ⏳ queued | View run |
  • | Health 40 Sweep | ✅ success | View run |
  • | Health 44 Gate Branch Protection | ❔ in progress | View run |
  • | Health 45 Agents Guard | ✅ success | View run |
  • | Health 50 Security Scan | ❔ in progress | View run |
  • | Maint 52 Validate Workflows | ❌ failure | View run |
  • | PR 11 - Minimal invariant CI | ✅ success | View run |
  • | Selftest CI | ❔ in progress | View run |
  • Head SHA: df56f4f
  • Latest Runs: ❔ in progress — Gate
  • Required: gate: ❔ in progress
  • | Workflow / Job | Result | Logs |
  • |----------------|--------|------|
  • | Agents PR meta manager | ❔ in progress | View run |
  • | CI Autofix Loop | ✅ success | View run |
  • | Copilot code review | ❔ in progress | View run |
  • | Gate | ❔ in progress | View run |
  • | Health 40 Sweep | ✅ success | View run |
  • | Health 44 Gate Branch Protection | ❔ in progress | View run |
  • | Health 45 Agents Guard | ✅ success | View run |
  • | Health 50 Security Scan | ❔ in progress | View run |
  • | Maint 52 Validate Workflows | ✅ success | View run |
  • | PR 11 - Minimal invariant CI | ✅ success | View run |
  • | Selftest CI | ❔ in progress | View run |

Head SHA: 1acaa14
Latest Runs: ❔ in progress — Gate
Required: gate: ❔ in progress

Workflow / Job Result Logs
Agents PR meta manager ❔ in progress View run
CI Autofix Loop ✅ success View run
Copilot code review ❔ in progress View run
Gate ❔ in progress View run
Health 40 Sweep ✅ success View run
Health 44 Gate Branch Protection ✅ success View run
Health 45 Agents Guard ✅ success View run
Health 50 Security Scan ❔ in progress View run
Maint 52 Validate Workflows ✅ success View run
PR 11 - Minimal invariant CI ✅ success View run
Selftest CI ✅ success View run

The sync workflow was failing with 'could not read Username for
https://github.com' because the consumer repo clone (via gh) doesn't
inherit git credentials for push operations.

Fix by pushing directly with the token embedded in the URL:
  git push https://x-access-token:${GH_TOKEN}@github.com/$repo.git

This ensures the SYNC_TOKEN is used for authentication when pushing
to each consumer repository.
Copilot AI review requested due to automatic review settings December 27, 2025 23:54
@stranske stranske temporarily deployed to agent-high-privilege December 27, 2025 23:54 — with GitHub Actions Inactive
@agents-workflows-bot
Copy link
Copy Markdown
Contributor

⚠️ Action Required: Unable to determine source issue for PR #228. The PR title, branch name, or body must contain the issue number (e.g. #123, branch: issue-123, or the hidden marker ).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes authentication failures in the Maint 68 Sync Consumer Repos workflow that occurred when pushing changes to consumer repositories. The workflow was failing with "could not read Username" errors because cloned repositories didn't inherit git credentials for push operations.

Key Changes:

  • Updated git push command to use token-embedded URL for direct authentication
  • Added git credential helper configuration (though redundant with the new push approach)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +682 to +686
# Configure git with token-based authentication for push
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config credential.helper store
echo "https://x-access-token:${GH_TOKEN}@github.com" > ~/.git-credentials
Copy link

Copilot AI Dec 27, 2025

Choose a reason for hiding this comment

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

The git credential helper configuration is redundant since the push command on line 705 uses a token-embedded URL directly. When using a token-embedded URL, git doesn't need to look up credentials from the credential helper. These lines can be removed to simplify the code and avoid writing credentials to disk unnecessarily.

Suggested change
# Configure git with token-based authentication for push
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config credential.helper store
echo "https://x-access-token:${GH_TOKEN}@github.com" > ~/.git-credentials
# Configure git identity for commits
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"

Copilot uses AI. Check for mistakes.
Comment on lines +682 to +686
# Configure git with token-based authentication for push
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config credential.helper store
echo "https://x-access-token:${GH_TOKEN}@github.com" > ~/.git-credentials
Copy link

Copilot AI Dec 27, 2025

Choose a reason for hiding this comment

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

Storing credentials in ~/.git-credentials creates a security risk in GitHub Actions. Even though the runner is ephemeral, credentials should not be written to disk when they can be passed directly in the command (as done on line 705). Additionally, the format is incorrect - the file should contain the full URL including the protocol, but this line is missing the path component after the domain. The correct format would be "https://x-access-token:${GH_TOKEN}@github.com" as a complete line.

Suggested change
# Configure git with token-based authentication for push
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config credential.helper store
echo "https://x-access-token:${GH_TOKEN}@github.com" > ~/.git-credentials
# Configure git author for commit
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown
Contributor

Automated Status Summary

Head SHA: 8aedd66
Latest Runs: ⏳ pending — Gate
Required contexts: Gate / gate, Health 45 Agents Guard / Enforce agents workflow protections
Required: core tests (3.11): ⏳ pending, core tests (3.12): ⏳ pending, docker smoke: ⏳ pending, gate: ⏳ pending

Workflow / Job Result Logs
(no jobs reported) ⏳ pending

Coverage Overview

  • Coverage history entries: 1

Coverage Trend

Metric Value
Current 77.97%
Baseline 0.00%
Delta +77.97%
Minimum 70.00%
Status ✅ Pass

Updated automatically; will refresh on subsequent CI/Docker completions.


Keepalive checklist

Scope

No scope information available

Tasks

  • No tasks defined

Acceptance criteria

  • No acceptance criteria defined

@github-actions
Copy link
Copy Markdown
Contributor

🤖 Keepalive Loop Status

PR #228 | Agent: Codex | Iteration 0/5

Current State

Metric Value
Iteration progress [----------] 0/5
Action wait (missing-agent-label)
Gate success
Tasks 0/34 complete
Keepalive ❌ disabled
Autofix ❌ disabled

🔍 Failure Classification

| Error type | infrastructure |
| Error category | resource |
| Suggested recovery | Confirm the referenced resource exists (repo, PR, branch, workflow, or file). |

@stranske stranske merged commit d533e7e into main Dec 27, 2025
63 checks passed
@stranske stranske deleted the fix/sync-workflow-auth branch December 27, 2025 23:57
stranske pushed a commit that referenced this pull request Feb 24, 2026
Five interacting bugs caused the keepalive loop to prematurely stop
productive Codex agents on PRs #223, #224, #225, #228:

1. Off-by-one task credit: updateKeepaliveLoopSummary used stale
   checkbox counts from the evaluate step (before autoReconcile ran).
   Now re-reads the live PR body after autoReconcile and recalculates
   rounds_without_task_completion with authoritative counts.

2. agent:retry doesn't reset counters: adding the label bypassed
   max_iterations but left rounds_without_task_completion and
   consecutive_zero_activity_rounds at their stale values, causing
   the agent to hit progress-review or stop after one more quiet round.
   Now resets both counters when forceRetry is active.

3. totalsStable gate zeroed legitimate credit: when parent-child
   cascade or manual edits changed the total checkbox count,
   tasksCompletedSinceLastRound was forced to 0 even when tasks were
   genuinely completed. Removed the totalsStable gate — any positive
   unchecked-count delta now counts as progress.

4. Two-round productivity memory: productivityScore only considered
   last_files_changed and prev_files_changed. An agent with a strong
   track record was treated as unproductive after 2 quiet rounds.
   Added a cumulative total_tasks_completed counter that gives credit
   for historical productivity.

5. Rolling window caps too small: ATTEMPT_HISTORY_LIMIT (5) and
   ATTEMPTED_TASK_LIMIT (6) caused loss of historical context and
   re-suggestion of already-tried tasks. Raised both to 20.

Also adds an append-only, collapsible Work Log comment per PR that
records every keepalive round (agent, action, result, files changed,
tasks credited, commit, gate status). This provides complete
observability without the 5-entry rolling window limitation.

https://claude.ai/code/session_012WnYCcttvFEY3FETnhVcNL
stranske pushed a commit that referenced this pull request Feb 24, 2026
Addresses 6 root causes identified in PR #228 post-mortem where the
coding agent claimed 42/42 tasks complete when multiple acceptance
criteria were unmet:

Fix 1 - Require verification PASS before stopping:
  The stop decision now requires the verifier to return PASS. If
  verification fails, the agent is re-run to fix gaps (up to 2 attempts).
  Previously, verification was attempted once and ignored on failure.

Fix 2 - Raise confidence thresholds in analyzeTaskCompletion:
  Keyword match threshold raised from 0.35 to 0.50 for HIGH confidence.
  Now requires 2+ matching words (not just percentage) to avoid
  single-word false positives. fileMatch tightened to require 2+ keywords
  or explicit file references. commitMatch requires 2+ substantive words.

Fix 3 - Gate cascade logic for acceptance criteria:
  cascadeParentCheckboxes now detects acceptance criteria section headings
  and disables cascading within them. Each acceptance criterion must be
  independently checked — a checked parent no longer auto-checks children
  in acceptance sections.

Fix 5 - Different verifier context:
  Verification steps now switch to the alternate agent (codex→claude or
  claude→codex) to avoid the structural problem where the same model that
  produced the work also verifies it. Configurable via verifier_agent.

Fix 6 - Mechanical scope enforcement:
  New extractScopePatterns/validateScopeCompliance functions parse file
  patterns from the scope section and validate the PR diff against them.
  Scope violations block the tasks-complete stop decision. The verifier
  prompt now includes a mandatory Scope Check section.

Fix 7 - Separate task/acceptance criteria tracking:
  Tasks and acceptance criteria are now counted independently. The stop
  decision requires BOTH allTasksDone AND allCriteriaMet. Auto-reconciliation
  only operates on task checkboxes, never acceptance criteria.

Also fixes pre-existing duplicate fixAttemptMax declaration in Counter_Risk.

https://claude.ai/code/session_01VtzHmRoYTL2kcxaacDgSqQ
stranske added a commit that referenced this pull request Feb 24, 2026
* fix: prevent premature task completion claims in keepalive loop

Addresses 6 root causes identified in PR #228 post-mortem where the
coding agent claimed 42/42 tasks complete when multiple acceptance
criteria were unmet:

Fix 1 - Require verification PASS before stopping:
  The stop decision now requires the verifier to return PASS. If
  verification fails, the agent is re-run to fix gaps (up to 2 attempts).
  Previously, verification was attempted once and ignored on failure.

Fix 2 - Raise confidence thresholds in analyzeTaskCompletion:
  Keyword match threshold raised from 0.35 to 0.50 for HIGH confidence.
  Now requires 2+ matching words (not just percentage) to avoid
  single-word false positives. fileMatch tightened to require 2+ keywords
  or explicit file references. commitMatch requires 2+ substantive words.

Fix 3 - Gate cascade logic for acceptance criteria:
  cascadeParentCheckboxes now detects acceptance criteria section headings
  and disables cascading within them. Each acceptance criterion must be
  independently checked — a checked parent no longer auto-checks children
  in acceptance sections.

Fix 5 - Different verifier context:
  Verification steps now switch to the alternate agent (codex→claude or
  claude→codex) to avoid the structural problem where the same model that
  produced the work also verifies it. Configurable via verifier_agent.

Fix 6 - Mechanical scope enforcement:
  New extractScopePatterns/validateScopeCompliance functions parse file
  patterns from the scope section and validate the PR diff against them.
  Scope violations block the tasks-complete stop decision. The verifier
  prompt now includes a mandatory Scope Check section.

Fix 7 - Separate task/acceptance criteria tracking:
  Tasks and acceptance criteria are now counted independently. The stop
  decision requires BOTH allTasksDone AND allCriteriaMet. Auto-reconciliation
  only operates on task checkboxes, never acceptance criteria.

Also fixes pre-existing duplicate fixAttemptMax declaration in Counter_Risk.

https://claude.ai/code/session_01VtzHmRoYTL2kcxaacDgSqQ

* chore: sync template scripts

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
stranske added a commit that referenced this pull request Feb 24, 2026
* fix: prevent premature task completion claims in keepalive loop

Addresses 6 root causes identified in PR #228 post-mortem where the
coding agent claimed 42/42 tasks complete when multiple acceptance
criteria were unmet:

Fix 1 - Require verification PASS before stopping:
  The stop decision now requires the verifier to return PASS. If
  verification fails, the agent is re-run to fix gaps (up to 2 attempts).
  Previously, verification was attempted once and ignored on failure.

Fix 2 - Raise confidence thresholds in analyzeTaskCompletion:
  Keyword match threshold raised from 0.35 to 0.50 for HIGH confidence.
  Now requires 2+ matching words (not just percentage) to avoid
  single-word false positives. fileMatch tightened to require 2+ keywords
  or explicit file references. commitMatch requires 2+ substantive words.

Fix 3 - Gate cascade logic for acceptance criteria:
  cascadeParentCheckboxes now detects acceptance criteria section headings
  and disables cascading within them. Each acceptance criterion must be
  independently checked — a checked parent no longer auto-checks children
  in acceptance sections.

Fix 5 - Different verifier context:
  Verification steps now switch to the alternate agent (codex→claude or
  claude→codex) to avoid the structural problem where the same model that
  produced the work also verifies it. Configurable via verifier_agent.

Fix 6 - Mechanical scope enforcement:
  New extractScopePatterns/validateScopeCompliance functions parse file
  patterns from the scope section and validate the PR diff against them.
  Scope violations block the tasks-complete stop decision. The verifier
  prompt now includes a mandatory Scope Check section.

Fix 7 - Separate task/acceptance criteria tracking:
  Tasks and acceptance criteria are now counted independently. The stop
  decision requires BOTH allTasksDone AND allCriteriaMet. Auto-reconciliation
  only operates on task checkboxes, never acceptance criteria.

Also fixes pre-existing duplicate fixAttemptMax declaration in Counter_Risk.

https://claude.ai/code/session_01VtzHmRoYTL2kcxaacDgSqQ

* fix: increment verification attempt_count and tighten acceptance heading pattern

Address two bugs identified in sync PR #244 code review:

1. Verification retry logic never incremented attempt_count, causing
   infinite retry loops on verification failures. Now both
   'verify-acceptance' and 'fix-verification-gaps' reasons increment
   the counter so the exhausted-retries path is reachable.

2. The /acceptance/i heading pattern was overly broad, matching any
   heading containing "acceptance" (e.g. "User Acceptance Testing").
   Changed to /^acceptance$/i for exact match only.

Also updates 3 test expectations to match the stricter task-completion
thresholds already in the codebase.

https://claude.ai/code/session_01VtzHmRoYTL2kcxaacDgSqQ

* fix: remove overly broad /^acceptance$/i heading pattern

The bare /^acceptance$/i pattern matched any heading containing only
"Acceptance", which could false-positive on headings like "User
Acceptance Testing" or "Acceptance Rate Analysis", incorrectly
disabling cascade for unrelated sections.  The remaining patterns
(/acceptance\s*criteria/i, /definition\s*of\s*done/i, /done\s*criteria/i)
are specific enough to correctly identify acceptance criteria sections.

Addresses Copilot review comment on sync PR #244.

https://claude.ai/code/session_01VtzHmRoYTL2kcxaacDgSqQ

---------

Co-authored-by: Claude <noreply@anthropic.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.

2 participants