Skip to content

gate, web-inbox, guard, lease and wt come to public aisync (opt-in); 0.2.5 - #9

Merged
MaxonT merged 2 commits into
mainfrom
port-p1-gate-landq-webinbox
Nov 12, 2026
Merged

MaxonT merged 2 commits into
mainfrom
port-p1-gate-landq-webinbox

Conversation

@MaxonT

@MaxonT MaxonT commented Nov 12, 2026

Copy link
Copy Markdown
Owner

Ports five modules from the private ai-sync through the whitelist port (3-way merge + privacy scan).

  • gate: push-time test gate, opt-in via gate_hook = true
  • web-inbox: import web-Claude events from the web-inbox branch; web_inbox_secs = 0 is off
  • guard + lease: one Claude Code session per repo, opt-in via guard_hook = true; fails open
  • wt: a session's own worktree; wt land pushes to main only with --yes
  • landq: per-repo landing queue used by wt and gate
  • Stale git lock fix kept; Atomic ingest and tigeridea stay private
  • Privacy scan: owner's public author/committer name exempt by digest; address still scanned
  • Version 0.2.5

Tests: 416 passed, 1 skipped (CI runs the same suite). History privacy scan: 0 hits.

…-in); 0.2.5

Ported from the private ai-sync through tools/public_port (3-way merge + privacy scan):
- gate: push-time test gate, opt-in via gate_hook = true (pre-push hook runs check.sh --fast)
- web-inbox: import web-Claude events from the web-inbox branch; web_inbox_secs = 0 is off
- guard + lease: one Claude Code session per repo, opt-in via guard_hook = true; fails open
- wt: a session's own worktree; wt land pushes to main only with --yes
- landq: per-repo landing queue used by wt and gate
- stale git lock fix (1b19ff2) kept; Atomic ingest and tigeridea stay private
- privacy scan: author and committer names shown on the owner's commits are exempt by digest

Agent: claude-code
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T05:34:18.874967Z a2879c7 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: a2879c744a

ℹ️ 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 thread ai_sync/worktree.py
Comment on lines +112 to +115
ahead = _git(wt, "rev-list", "--count", f"origin/main..{br}").stdout.strip()
if ahead in ("", "0"):
note = _follow_origin(key)
_cleanup(key, wt, br, cfg)

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 Preserve the worktree when the ahead-count command fails

When origin has no fetched main branch—for example, a repository whose remote only has master—the ahead-count command fails with empty stdout. Treating that as zero commits calls _cleanup, removes the worktree, and deletes its branch even though its commits were never pushed. I reproduced land returning success while removing a worktree containing an unpushed commit. The deletion is forced (git branch -h describes -D as “delete branch (even if not merged)”). Check the command's return code and preserve the worktree on failure; only a successful count of 0 should trigger this cleanup.

Useful? React with 👍 / 👎.

Comment thread ai_sync/hooks.py

def apply() -> None:
write_git_hooks(dest)
write_git_hooks(dest, gate=cfg.gate_hook)

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 Re-plan the pre-push hook when gate_hook changes

For users whose Git hooks are already installed, plan_git returns None whenever all hook files exist and commit-msg matches; it never compares the installed pre-push body with the requested gate_hook setting. Consequently, enabling gate_hook = true and running aisync install-hooks --only git --yes reports that everything is installed but leaves the gate disabled. Disabling the setting likewise leaves an installed gate active. Include the expected pre-push contents in the stale-hook check so the new setting actually reaches this writer.

Useful? React with 👍 / 👎.

Comment thread ai_sync/worktree.py
if rb.returncode != 0:
_git(wt, "rebase", "--abort")
return False, f"与 main 冲突,未落地,worktree 保留在 {wt}:{(rb.stderr or rb.stdout).strip()[-200:]}"
ok = _git(key, "merge", "--ff-only", br).returncode == 0

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 Re-run the test gate after rebasing a local landing

In a repository without origin, when local main has advanced since the worktree was created, _gate(wt) tests the old worktree commit before the rebase, but the rebased result is merged without another check. I reproduced two individually passing branches whose combined tree fails check.sh: land still returns success and cleans up the worktree. Run the gate again after the successful rebase and before this merge so the commit actually being landed is the one that passed.

Useful? React with 👍 / 👎.

@MaxonT
MaxonT merged commit d7c540d into main Nov 12, 2026
2 of 6 checks passed
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