Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.47.24 - 2026-11-17

- Let stack sync report a verified, consistent adoption as a read-only no-op with the next rebuild or push previews. Keep explicit adoption guidance for stale source history. Explain why absorb cannot edit pinned history and preserve its patch while naming an existing draft as the destination.

## 0.47.23 - 2026-11-16

- Evaluate the latest verified check run per workflow and check name for PR merges. Report superseded runs as informational while preserving blocks for current failures, pending checks, distinct workflows and ambiguous history. Apply the same selection to required checks.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Keep many long-lived pull requests clean, rebuildable, and publishable from one
manifest.

Current version: `0.47.23`
Current version: `0.47.24`

`syncwheel` is a small CLI and workflow model for maintainers who carry several
PR branches against an upstream repository and need those branches to stay
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.47.23
0.47.24
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1826,7 +1826,7 @@
<div class="hero-stage" id="top">
<section class="hero" aria-labelledby="hero-heading">
<div class="hero-copy">
<span class="eyebrow"><span class="ai-sigil" aria-hidden="true"></span>AI-ready Git coordination <span class="hero-version">v<!-- syncwheel-version:start -->0.47.23<!-- syncwheel-version:end --></span></span>
<span class="eyebrow"><span class="ai-sigil" aria-hidden="true"></span>AI-ready Git coordination <span class="hero-version">v<!-- syncwheel-version:start -->0.47.24<!-- syncwheel-version:end --></span></span>
<h1 id="hero-heading"><span class="title-line">Move at</span><span class="title-line">machine speed.</span><span class="title-line accent">Stay in control.</span></h1>
<p class="subhead">Syncwheel coordinates every Git lane used by humans, AI agents, CI and delivery systems—without sacrificing review, safety or recovery.</p>
<div class="actions">
Expand Down Expand Up @@ -2602,7 +2602,7 @@ <h2 class="section-title">Your first verified plan in minutes.</h2>
</main>

<footer>
<span>syncwheel v<!-- syncwheel-version:start -->0.47.23<!-- syncwheel-version:end --> · MIT · a NestDevLab project</span>
<span>syncwheel v<!-- syncwheel-version:start -->0.47.24<!-- syncwheel-version:end --> · MIT · a NestDevLab project</span>
<a class="logo-link" href="https://www.nestdev.it/" aria-label="NestDevLab">
<img src="https://www.nestdev.it/assets/logo-nestdev.png" width="22" height="22" alt="">
</a>
Expand Down
22 changes: 19 additions & 3 deletions docs/stack-adoption.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,25 @@ the entire `BASE..TIP` graph as declared stack history. The source ref advances
locally to the reviewed commit without replay or reconstruction. Adoption
leaves worktree registration and cleanup to their own commands.

Review a new tip or base through another explicit adoption. `stack sync` and
`stack absorb` refuse to change an adopted history, and automatic reconciliation
refuses to rebuild or realign its source branch. If resume finds an undeclared
Review a new tip or base through another explicit adoption. When the manifest,
pinned commits and direct source ref still match the adoption, `stack sync`
succeeds without changing anything: the stack is adopted and has nothing to
sync. It prints integration rebuild and stack push previews as next steps.
A missing, symbolic or changed source ref remains a stale adoption and requires
explicit review of the base and tip. Pending adoption, control recovery and
promotion operations must still be resolved before synchronization.

`stack absorb` cannot edit pinned adopted history. For a consistent adoption it
leaves the selected patch intact and names absorption into an existing,
non-adopted draft, using `-N -m MESSAGE` for a new commit. Select a draft you own
and keep the printed manifest and path selection. Existing primary ownership and
staged-path guards still apply: unrelated staged work must be preserved for its
owner, and can block this follow-up. This refusal is not a request
to repeat the completed adoption, and does not claim the patch was absorbed.
A stale adoption retains the explicit base/tip review remedy.

Automatic reconciliation refuses to rebuild or realign the adopted source
branch. If resume finds an undeclared
integration commit likely owned by the adopted stack, it requests manual review
and preserves the adopted history.

Expand Down
2 changes: 1 addition & 1 deletion openpack.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"schemaVersion": 2,
"name": "NestDevLab/syncwheel",
"version": "0.47.23",
"version": "0.47.24",
"provides": [
{
"type": "skills",
Expand Down
49 changes: 44 additions & 5 deletions scripts/syncwheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@
from syncwheel_stacks import (
StackLifecycle,
ordinary_empty_draft_close,
require_stack_absorb_amendable,
stack_closed_payload,
manifest_scope_options,
stack_close_command,
Expand Down Expand Up @@ -15817,7 +15816,9 @@ def stack_absorb_preflight(args):
manifest, _ = _manifest_storage.load_manifest(repo_root, path)
if manifest is not None and manifest.get('repository_mode') != 'journal':
stack = require_stack(manifest, args.stack)
require_stack_absorb_amendable(stack, args)
_stack_lifecycle(repo_root).require_stack_absorb_allowed(
stack, args, shlex.join(manifest_path_remedy_options(repo_root, path)),
)
_stack_lifecycle(repo_root).require_empty_stack_absorb_base(stack)


Expand All @@ -15826,7 +15827,31 @@ def command_stack_absorb(args):
manifest, _ = _manifest_storage.load_manifest(repo_root, manifest_path)
if manifest is None:
raise SyncwheelError(f'manifest not found: {manifest_path}')
return _stack_lifecycle(repo_root).command_stack_absorb(args, manifest, manifest_path)
return _stack_lifecycle(repo_root).command_stack_absorb(
args, manifest, manifest_path, shlex.join(manifest_path_remedy_options(repo_root, manifest_path)),
)


def observed_adopted_stack_command(args):
if args.func == command_stack_sync:
args._stack_sync_selection = resolve_stack_sync_selection(args)
root, path = resolve_command_manifest_selection(args)
manifest, _ = _manifest_storage.load_manifest(root, path)
if not manifest or manifest.get('repository_mode') == 'journal':
return None
stack = require_stack(manifest, args.stack)
if not stack.get('adopted_history'):
return None
validate_selected_primary_authority_path(root, path)
selection = shlex.join(manifest_path_remedy_options(root, path))
stack_adoption_preflight(args)
refuse_stack_sync_control_recovery(root, path, 'adopted stack command')
lifecycle = _stack_lifecycle(root)
lifecycle.refuse_pending_stack_sync_promotion(path, selection)
if args.func == command_stack_sync:
return lifecycle.observe_adopted_stack_sync(args, stack, selection)
lifecycle.require_stack_absorb_allowed(stack, args, selection)
raise SyncwheelError('adopted stack changed during observation; inspect and retry')


def resolve_stack_absorb_location(repo_root, manifest_path, manifest, stack, args):
Expand Down Expand Up @@ -20125,7 +20150,7 @@ def governed_worktree_preflight(args):
return
if args.func in {command_stack_sync, command_stack_absorb}:
if require_stack(manifest, args.stack).get('adopted_history'):
raise SyncwheelError('adopted history requires explicit stack set --base BASE --adopt-tip TIP')
raise SyncwheelError('stack adoption changed after observation; inspect the selected manifest and retry')
if args.func == command_stack_set and (getattr(args, 'base', None) or getattr(args, 'adopt_tip', None)):
# Adoption has an exact plan and never cleans up lanes.
return
Expand Down Expand Up @@ -20578,6 +20603,9 @@ def main():
parser.error('unrecognized arguments: ' + ' '.join(extras))
args.specs = [*args.specs, *extras]
args.git_args = passthrough
if args.func == command_stack_absorb:
args.paths.extend(passthrough)
args.git_args = []
# Syncwheel owns the managed branches, so its own child Git processes are
# allowed to rewind them. The guard exists to stop every other caller.
guard_callback = args.func in {
Expand All @@ -20587,12 +20615,23 @@ def main():
}
global SYNCWHEEL_OWNS_REF_MOVES, SYNCWHEEL_REF_AUTH_REPO
desk_release = args.func == command_stack_release_desk
adopted_metadata = False
readonly_diagnostics = (
args.func == command_worktree_list
or (args.func in {command_status, command_check} and not args.fetch)
or (desk_release and not args.apply)
)
try:
if args.func in {command_stack_sync, command_stack_absorb}:
adopted_metadata = True
observation = _READONLY_DIAGNOSTICS.set(True)
try:
result = observed_adopted_stack_command(args)
finally:
_READONLY_DIAGNOSTICS.reset(observation)
if result is not None:
return result
adopted_metadata = False
if desk_release:
args.repo = args.repo or os.environ.get(ENV_REPO)
if readonly_diagnostics or desk_release:
Expand Down Expand Up @@ -20682,7 +20721,7 @@ def main():
print(f'error: {exc}', file=sys.stderr)
return 2
finally:
if not readonly_diagnostics and not desk_release:
if not readonly_diagnostics and not desk_release and not adopted_metadata:
if SYNCWHEEL_REF_AUTH_REPO:
clear_ref_authorizations(SYNCWHEEL_REF_AUTH_REPO)
SYNCWHEEL_REF_AUTH_REPO = None
Expand Down
66 changes: 60 additions & 6 deletions scripts/syncwheel_stacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@


def require_stack_absorb_amendable(stack, args):
if stack.get('adopted_history'):
raise SyncwheelError('adopted history requires explicit stack set --base BASE --adopt-tip TIP')
if args.amend and not stack['commits']:
raise SyncwheelError(
f"stack {stack['id']!r} has no commits to amend; "
Expand Down Expand Up @@ -2366,12 +2364,68 @@ def refuse_pending_stack_sync_promotion(self, manifest_path, remedy_selection):
f'syncwheel stack promote {quoted([pending_stack])} {remedy_selection}'
)

def consistent_stack_adoption(self, stack, remedy_selection):
adopted = validate_stack_adoption(stack)
if not adopted:
return None
root = self.repository.root
ref = f"refs/heads/{stack['branch']}"
offline = {'GIT_NO_LAZY_FETCH': '1', 'GIT_ALLOW_PROTOCOL': '', 'GIT_OPTIONAL_LOCKS': '0'}

def observe(*args, allowed=(0,)):
result = self.repository.git(root, *args, check=False, env=offline)
if result.returncode not in allowed:
raise SyncwheelError(
f'cannot verify adopted history: Git {args[0]} failed; inspect repository objects before retrying'
)
return result

stale = (
observe('symbolic-ref', '--quiet', ref, allowed=(0, 1)).returncode == 0
or observe('rev-parse', '--verify', '--quiet', ref, allowed=(0, 1)).stdout.strip() != adopted['tip']
or any(observe('cat-file', '-t', oid).stdout.strip() != 'commit'
for oid in (adopted['base'], adopted['tip']))
)
if not stale and adopted['tip'] != adopted['base']:
parents = observe('rev-list', '--parents', '-n', '1', adopted['tip']).stdout.split()[1:]
contained = [parent for parent in parents
if observe('merge-base', '--is-ancestor', parent, adopted['base'], allowed=(0, 1)).returncode == 0]
stale = contained != [adopted['base']]
if stale:
raise SyncwheelError(
'adopted history is stale; use explicit '
f"syncwheel stack set {quoted([stack['id']])} --base BASE --adopt-tip TIP {remedy_selection}"
)
return adopted

def require_stack_absorb_allowed(self, stack, args, remedy_selection):
if self.consistent_stack_adoption(stack, remedy_selection):
mode = ['--staged'] if args.staged else []
paths = ['--', *args.paths] if args.paths else []
remedy = quoted(['syncwheel', 'stack', 'absorb', 'DRAFT', *mode, '-N', '-m', 'MESSAGE'])
raise SyncwheelError(
'stack is adopted; cannot absorb into its pinned history. Patch remains unchanged. '
'Use an existing non-adopted draft; primary ownership and staged-path guards still apply. '
'Replace DRAFT and MESSAGE in: '
f'{remedy} {remedy_selection} {quoted(paths)}'
)
require_stack_absorb_amendable(stack, args)

def observe_adopted_stack_sync(self, args, stack, remedy_selection):
if not self.consistent_stack_adoption(stack, remedy_selection):
return None
print(f'{args.stack}: stack is adopted; nothing to sync. Next: int rebuild / push')
print(f' syncwheel int rebuild --dry-run {remedy_selection}')
print(f' syncwheel stack push {quoted([args.stack])} --dry-run {remedy_selection}')
return 0

def command_stack_sync(self, args, manifest, manifest_path, remedy_selection):
repo_root = self.repository.root
stack = require_stack(manifest, args.stack)
if stack.get('adopted_history'):
raise SyncwheelError('adopted history requires explicit stack set --base BASE --adopt-tip TIP')
self.refuse_pending_stack_sync_promotion(manifest_path, remedy_selection)
observed = self.observe_adopted_stack_sync(args, stack, remedy_selection)
if observed is not None:
return observed
commits = self.repository.rev_list(
repo_root, f"{stack['base']}..{stack['branch']}", offline=True,
)
Expand Down Expand Up @@ -2403,10 +2457,10 @@ def require_empty_stack_absorb_base(self, stack):
return base, tip


def command_stack_absorb(self, args, manifest, manifest_path):
def command_stack_absorb(self, args, manifest, manifest_path, remedy_selection=''):
repo_root = self.repository.root
stack = require_stack(manifest, args.stack)
require_stack_absorb_amendable(stack, args)
self.require_stack_absorb_allowed(stack, args, remedy_selection)
empty_start = self.require_empty_stack_absorb_base(stack)
integration_branch = stack.get('integration_branch') or manifest['integration']['branch']
current_branch = self.repository.get_current_branch(repo_root)
Expand Down
Loading
Loading