Skip to content

feat: add durable push-gate lease workflow#3

Draft
homatthew wants to merge 124 commits intomainfrom
mh-netflix
Draft

feat: add durable push-gate lease workflow#3
homatthew wants to merge 124 commits intomainfrom
mh-netflix

Conversation

@homatthew
Copy link
Copy Markdown
Owner

What am I trying to do?

Replace the old time-window push-gate token with a durable branch lease flow that reduces approval toil while still checking that an agent push matches the intended branch, remote, and PR context.

Why did I do it this way?

The new helper centralizes lease storage, guard evaluation, push assertions, and remote-topology defaults in one place so the shell wrapper, Claude hook, and Codex hook all enforce the same behavior. The guard now allows valid worktree/refspec flows, supports upstream-vs-origin defaults from remote topology, and keeps explicit rewrite protection for --force-with-lease.

Are there any tests?

Yes. I added tests/push-gate-regression.sh and ran it end to end. It covers durable lease approval, guarded pushes, rewrite enforcement, bootstrap no-PR flow, upstream feature pushes, worktree/refspec pushes, detached HEAD:<target> pushes, and remote-topology defaults for PR repo selection and push remote selection.

How would I use the new code?

Generate a lease draft with pg draft-approve, approve the generated /tmp/pg-approve-...sh script, then push through pg push --assert-flow .... In repos with both origin and upstream, PR lookup defaults to upstream while push remote stays sticky to the tracked remote or prefers writable upstream before falling back to origin.

homatthew and others added 30 commits January 20, 2026 17:03
- Add statusline.sh script showing [Model] branch | X% left
- Configure statusLine in settings.json
- Add worktree instructions to CLAUDE.md for proper branch tracking
- Add root CLAUDE.md documenting repo structure and sync workflow

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add claude-deploy shell function (repo → ~/.claude)
- Add ghe-fix-proxy to allowed bash commands in settings.json
- Update docs to show both deploy and sync workflows

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fix terminal title to show "dirname (branch)" instead of "claude" when
running Claude Code in Ghostty terminal.

Changes:
- Add ghostty/config with shell-integration-features = no-title
- Replace chpwd with set_terminal_title hook in zsh/personal.zsh
- Add Ghostty config symlink to setupPermissions.sh
- Document ghostty/ in repo structure

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Switch from unreliable `gh pr` commands to `gh api --hostname` for
Netflix GitHub Enterprise. The gh pr subcommands don't reliably detect
the GHE hostname even after proxy setup.

Changes:
- commit-push-pr: Use gh api for PR creation
- create-nflx-pr: Use gh api, add repo path guidance
- update-pr-description: Use gh api for PR updates
- CLAUDE.md: Add gist creation instructions for GHE

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Enable persisting architectural insights to ~/repos/dump/second-brain/.
The second-brain acts as a knowledge cache for cross-repo patterns.

Changes:
- Add second-brain agent for persisting insights (haiku model)
- Add second-brain skill for topic management
- Integrate second-brain check into cross-repo-context agent

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Skill for analyzing PRs and proposing atomic commit strategies for
stacked diffs. Supports two execution strategies: rebase (in-place)
or reconstruct (fresh branch, preserves original).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Skill for reviewing and cleaning common AI-generated code issues:
dead code, over-verbose patterns, unnecessary comments, pattern
deviations, test quality problems, and premature abstractions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add one-pager skill: Interactive memo writing assistant with question-driven discovery
- Reorganize CLAUDE.md with Skills Quick Reference table for quick lookup
- Update PR-related skills with improved instructions (commit-push-pr, create-nflx-pr, update-pr-description)
- Add address-comments-by skill documentation
- Minor: Update Netflix shell function (namespace) and settings

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Remove ghe-cli submodule and all ghe-fix-proxy/gh api --hostname
workarounds. Netflix's gh fork uses metatron auth natively for
git.netflix.net, so standard gh commands work directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Notifications now fire automatically on Stop and Notification events
via hooks instead of requiring manual /notify invocation. Uses
terminal-notifier with Claude.app icon (-sender), Pop sound, and
click-to-activate for VS Code/Ghostty. Removes old notify skill,
notify-done.sh, and manual terminal-notifier permission.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Shell functions (ralph, ralph-init, ralph-plan) for autonomous Claude Code
loops with scoped --allowedTools. Security measures:
- Git limited to add/commit/status/diff/log (no push/reset/force)
- No interpreter access (python/node/npm broad/npx/make removed)
- .ralphrc validated to only allow RALPH_TOOLS and RALPH_MAX_ITER
- Per-project .ralphrc with auto-detection (Gradle, Node, Python)

Also adds ralph-setup and ralph-plan skills, and beads task memory aliases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Eliminate the two-step ralph-plan → PROMPT.md → ralph workflow by
letting ralph accept plan files directly and generate prompts in-memory.
Add gum-based TUI with styled headers, spinners, and progress boxes
(graceful fallback to plain text when gum is unavailable). Replace
ralph-plan skill with ralph-handoff for outputting ready-to-run commands.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update ralph, CLAUDE.md, and skills (architect, split-pr, ralph-handoff)
to use the global plansDirectory instead of project-local .claude/plans/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update ralph-setup skill and ralph-init to stop creating PROMPT.md.
ralph-init now only creates .ralphrc; ralph-setup guides users to
plan mode + ralph instead of the intermediate file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace gum spin (hides all output) with tee + tail -5 so you see
the last few lines streaming in real-time. Read completion signal
from log file instead of captured variable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds Ralph Handoff subsection to Plan Mode Preference in CLAUDE.md
with keyword trigger ("ralph", "ralph it") and post-plan-approval
reminder. Updates skill description for better keyword matching.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove explicit rich>=13.0 — textual bundles it as a transitive dep.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…view

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…idebar

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tion

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
homatthew and others added 30 commits March 4, 2026 21:38
Ralph's system prompt now explicitly states pushes are blocked and
instructs it to commit locally only. Matches the push-gate enforcement
layer so Ralph doesn't waste iterations retrying blocked pushes.

Also defaults RICH=1 (rich mode).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Track per-iteration tool counts, files touched, step progress
- Color-code iteration results (green/yellow/red by outcome)
- Warn after 60s silence (stuck detection)
- Print end summary with total tools and steps completed
- Restore cursor in finally block (fixes hidden cursor on kill)
- Handle "failed" status in meta.json

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Removed gsd-context-monitor.js (PostToolUse), gsd-check-update.js
(SessionStart), and gsd-statusline.js (statusLine) — all referenced
files that don't exist. Restored statusline.sh as the status line.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New skill that analyzes branch topology, maps commits to PRs, detects
stale branches/PRs, and guides sequential pushing with push-gate
approval between each branch.

Also blocks CHECKSTYLE_SKIP/VERIFY_SKIP/SPOTLESS_SKIP in bash-safety-guard.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove broken explanation_summary import. Replace with direct
plan_certain_explained + extract_baseline_plan output showing
top plans, family graph traits, and excuses grouped by bottleneck.
Update narration guidance to reference actual output fields.
- Rewrite llm/notes/gh-image.md for local fork workflow, GHES support,
  codesigning, and install caveats
- Update update-pr-description skill embedding images section for GHES

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Ported from araman's ngp-skills jira plugin. Covers interactive
acli usage, metatron mTLS API for automation, ADF formatting
reference, and common JQL patterns.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fba-deploy now links google-* skills from the
cursor-google-workspace-skills repo into both harness skill dirs.
README documents external skill projection, shared venv, and
credential paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…dology

Points to second-brain methodology doc and template scripts in
antigravity-core. Covers phase design, skew checks, attribution
discipline, query reference, chart rendering, gist workflow.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Move agnostic hooks (bash-safety-guard, dgw-write-guard, notify,
  notify-slack, push-gate) from claude/hooks/ to llm/hooks/. Keep
  Claude-only hooks (beads-prime, worktree-create) in claude/hooks/.
- Add project_shared_hooks() in bin/fba-deploy so both harnesses project
  from the same source; Codex hook list is no longer hardcoded.
- Register shared_hooks_dir in llm/manifest.json and document the layout
  in llm/README.md + claude/CLAUDE.md.
- notify-slack.sh: add ahead/behind marker in header (↑N↓N vs upstream,
  origin/main, or origin/master). Fix emit_success returning non-zero
  under set -e (caused Stop-hook to exit 1).
- New slack-push-event.sh (PostToolUse Bash): threaded reply on git push
  / gh pr create / gh pr merge. Silent-exits on failure, unrelated
  commands, or missing thread anchor.
- Wire Codex Stop to notify-slack.sh; add PostToolUse Bash hooks for
  slack-push-event.sh in both claude/settings.json and codex/hooks.json.

Co-Authored-By: Claude Opus 4.7 (1M context) <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.

1 participant