Skip to content

ci: add reviewed upstream sync workflow - #6

Merged
pai-scaffolde merged 1 commit into
mainfrom
chore/upstream-sync-workflow
May 23, 2026
Merged

ci: add reviewed upstream sync workflow#6
pai-scaffolde merged 1 commit into
mainfrom
chore/upstream-sync-workflow

Conversation

@pai-scaffolde

Copy link
Copy Markdown
Owner

Summary

  • Adds a scheduled/manual upstream-sync workflow for the pai-scaffolde/hermes-agent fork.
  • Opens or updates a PR from automation/upstream-sync instead of auto-merging upstream into main.
  • Uses GitHub App credentials so generated branch pushes can trigger the normal PR checks.

Verification

  • git diff --check
  • parsed .github/workflows/upstream-sync-pr.yml with Python YAML
  • actionlint unavailable locally; skipped

Policy

This keeps NousResearch upstream changes review-gated while preserving Scaffolde fork patches.

@github-actions

Copy link
Copy Markdown

🔎 Lint report: chore/upstream-sync-workflow vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9030 on HEAD, 9030 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 4777 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 041d5162c2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +61 to +62
git checkout -B "$BRANCH" origin/main
git merge --no-ff --no-edit upstream/main

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid resetting automation/upstream-sync on every run

git checkout -B "$BRANCH" origin/main resets automation/upstream-sync to origin/main on each execution, and the subsequent git merge --no-ff --no-edit upstream/main then creates a fresh merge commit even if upstream has not moved since the last run. In the common case where an upstream-sync PR is still open, this causes branch rewrites every 4 hours (retriggering CI repeatedly) and can overwrite manual conflict-resolution commits pushed to that branch. The workflow should preserve/reuse the existing sync branch (or detect that it already contains upstream/main) instead of forcibly recreating it each run.

Useful? React with 👍 / 👎.

fi

git checkout -B "$BRANCH" origin/main
git merge --no-ff --no-edit upstream/main

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep sync branch available when merge conflicts occur

With set -euo pipefail, a conflict in git merge --no-ff --no-edit upstream/main aborts the step before any push or PR update happens, so maintainers get no refreshable sync branch to resolve (despite the PR policy text saying conflicts should be resolved on this branch). In any upstream-vs-fork conflict scenario, this workflow fails hard and leaves the existing PR/branch stale instead of publishing a branch that can be fixed and reviewed.

Useful? React with 👍 / 👎.

Comment on lines +82 to +83
--head "$BRANCH" \
--base main \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Disambiguate PR lookup by head repository owner

gh pr list --head "$BRANCH" filters only by branch name, not by <owner>:<branch>, so this query can match open PRs from other forks that happen to use the same head ref name. In that case PR_NUMBER may target an unrelated PR and gh pr edit will update the wrong pull request instead of the automation PR. The lookup should also constrain head repository owner (e.g., via JSON fields like headRepositoryOwner) before selecting a PR number.

Useful? React with 👍 / 👎.

git checkout -B "$BRANCH" origin/main
git merge --no-ff --no-edit upstream/main

git push --force-with-lease origin "HEAD:$BRANCH"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fetch sync branch before relying on force-with-lease

The workflow force-pushes with --force-with-lease, but it only fetches origin main and never fetches origin/$BRANCH, so the lease check for automation/upstream-sync is not anchored to the latest remote-tracking value for that branch. As a result, updates pushed to the sync branch by reviewers/maintainers between runs can still be overwritten by this forced push. Fetch the branch first (or use --force-with-lease=<ref>:<expected_sha>) so the lease actually protects that ref.

Useful? React with 👍 / 👎.

@pai-scaffolde
pai-scaffolde merged commit 0936e9c into main May 23, 2026
8 checks passed
@pai-scaffolde
pai-scaffolde deleted the chore/upstream-sync-workflow branch May 23, 2026 15:22
pai-scaffolde pushed a commit that referenced this pull request May 28, 2026
…te + cell_size_check + synchronous=FULL)

Production corruption #6 left b-tree pages with zeroed headers but intact old cell content — the Bug E pattern. This fix applies three pragma calls on every connect():

- synchronous=FULL (was NORMAL): closes the WAL-checkpoint reordering window where a crash between WAL commit and main-DB write leaves a partially-written b-tree page header. Cost is <1ms per commit on local SSD; negligible at kanban write volume.

- secure_delete=ON: forces SQLite to zero freed page bytes on disk. If a torn write or hardware fault later corrupts a page, the underlying cell content is zero, so corruption is detectable and no stale rows can resurface as live data.

- cell_size_check=ON: adds a read-side guard so corrupt cells surface as errors at read time rather than as silent wrong-data returns.

All three are connection-scoped and re-applied on every connect(). secure_delete also writes a persistent flag into the DB header on the first call against a fresh DB, making the protection durable across processes for new DBs.

Tests added for all four required cases: each pragma active on a fresh connection, and all three re-applied after close+reopen. Also adds the required negative test (migration path does not reset pragmas).
pai-scaffolde added a commit that referenced this pull request Jun 14, 2026
pai-scaffolde added a commit that referenced this pull request Jun 20, 2026
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