Agent SkillsDetachHead/rebased › safe-push

safe-push

GitHub

提供IntelliJ仓库代码安全推送流程,执行CI检查并合并至受保护分支。

.claude/skills/safe-push/SKILL.md DetachHead/rebased

触发场景

用户请求将代码推送到远程仓库 需要触发CI测试以验证变更

安装

npx skills add DetachHead/rebased --skill safe-push -g -y
更多选项

非标准路径

npx skills add https://github.com/DetachHead/rebased/tree/master/.claude/skills/safe-push -g -y

不安装直接使用

npx skills use DetachHead/rebased@safe-push

指定 Agent (Claude Code)

npx skills add DetachHead/rebased --skill safe-push -a claude-code -g -y

安装 repo 全部 skill

npx skills add DetachHead/rebased --all -g -y

预览 repo 内 skill

npx skills add DetachHead/rebased --list

SKILL.md

Frontmatter
{
    "name": "safe-push",
    "description": "Safe Push process for pushing changes to the IntelliJ repository. Use when pushing code changes to remote."
}

Safe Push Guide for AI Agents

This guide covers the Safe Push process for pushing changes to the IntelliJ repository.

Overview

Safe Push is a system that ensures code changes pass all required tests before being merged to protected branches (like master). It's powered by Patronus.

Safe Push CLI

The safePush.cmd script in the repository root provides command-line access to Safe Push without needing the IDE.

Basic Usage

# Push current HEAD to master (most common)
./safePush.cmd HEAD:master

# Push specific commit to master
./safePush.cmd <commit-hash>:master

# Push from feature branch to master
./safePush.cmd HEAD:master  # while on feature branch

# Dry run (test without pushing)
./safePush.cmd -dry-run HEAD:master

Options

-autosquash    Automatically squash fixup! commits (default true)
-dry-run       Run tests without push
-emergency     Skip tests and push directly (USE ONLY IN EMERGENCIES)
-verbose       Verbose output
-help          Print help

What Happens During Safe Push

  1. Your changes are pushed to a temporary branch
  2. Patronus triggers required CI checks (tests, compilation)
  3. Tests may retry up to 4 times for flaky failures
  4. If all checks pass, changes are merged to the target branch
  5. You receive Slack/Space/Email notification of results

Typical Duration

  • Successful Safe Push: ~3-5 hours (95th percentile ~4.7 hours)
  • Failed Safe Push: ~4-5 hours

Monitoring Progress

After starting a Safe Push you'll receive a Patronus URL like:

https://patronus.labs.jb.gg/robot/<uuid>

Always print this URL back to the user — it is their primary handle for the run (link to share, cancel button, restore-branch button). The <uuid> segment is the robot id.

You can also track the Safe Push directly: check current status, enumerate failing checks, drill into a specific attempt, or babysit a long-running robot until it finishes. All of that is in the [[patronus]] skill — pick it up when the user asks for status or when offering to follow up. It's reasonable to proactively suggest tracking or babysitting once the Safe Push is in flight; the user can say no. The [[patronus]] skill also documents the hand-off to [[teamcity-cli]] when an individual TC build needs deeper inspection.

Cancel and restore-branch actions stay in the browser.

Emergency Push

Use ./safePush.cmd -emergency ONLY for:

  • Fixing broken compilation
  • Reverting commits that break installers
  • Fixing .patronus/config.yaml misconfigurations

DO NOT use Emergency Push for:

  • Javadoc typo fixes
  • When Safe Push fails due to "unrelated" tests (they're likely related)
  • Skipping tests because you're in a hurry
  • Pushing large changes that conflict with concurrent pushes

Bazel Tests and Environment Variables

When writing tests that spawn external processes (like bazel.cmd), ensure required environment variables are passed:

// In BUILD.bazel for java_test targets:
env_inherit = [
    "LOCALAPPDATA",      // Windows
    "PROCESSOR_ARCHITECTURE",  // Windows
    "USERPROFILE",       // Windows
    "HOME",              // Unix/macOS - required for bazel cache directory
],

The Bazel sandbox does NOT inherit environment variables by default. Use env_inherit to explicitly pass variables from the host environment to tests.

Troubleshooting

Safe Push stuck or slow

  • Check #ij-builds Slack channel for infrastructure issues
  • Safe Push duration varies based on infrastructure load

Tests failing that seem unrelated

  • Patronus retries tests up to 4 times
  • If tests fail all 4 attempts and pass in master, your changes likely caused the failure
  • Report suspected infrastructure issues to #ij-qa-watch

Need to debug a failed Safe Push

  1. Go to your Safe Push on Patronus
  2. Click "commits" to see changes
  3. Click "Restore Branch" to recover your changes locally

References

版本历史

  • 1f8708d 当前 2026-08-16 15:39

同 Skill 集合

.agents/skills/actions/SKILL.md
.agents/skills/code-style/SKILL.md
.agents/skills/commits/SKILL.md
.agents/skills/debugging/SKILL.md
.agents/skills/driver-ui-tests/SKILL.md
.agents/skills/eel/SKILL.md
.agents/skills/extract-module/SKILL.md
.agents/skills/module-dependencies/SKILL.md
.agents/skills/module-set-pluginization/SKILL.md
.agents/skills/notebook-for-experiment/SKILL.md
.agents/skills/pseudo-kmp/SKILL.md
.agents/skills/registry/SKILL.md
.agents/skills/remote-dev/SKILL.md
.agents/skills/safe-push/SKILL.md
.agents/skills/ssr/SKILL.md
.agents/skills/testing-internals/SKILL.md
.agents/skills/testing/SKILL.md
.agents/skills/ui-accessibility/SKILL.md
.agents/skills/writing-tests/SKILL.md
.claude/skills/actions/SKILL.md
.claude/skills/code-style/SKILL.md
.claude/skills/commits/SKILL.md
.claude/skills/debugging/SKILL.md
.claude/skills/driver-ui-tests/SKILL.md
.claude/skills/eel/SKILL.md
.claude/skills/extract-module/SKILL.md
.claude/skills/jewel-pr-preparer/SKILL.md
.claude/skills/jewel-release-helper/SKILL.md
.claude/skills/managing-youtrack/SKILL.md
.claude/skills/module-dependencies/SKILL.md
.claude/skills/module-set-pluginization/SKILL.md
.claude/skills/notebook-for-experiment/SKILL.md
.claude/skills/pseudo-kmp/SKILL.md
.claude/skills/registry/SKILL.md
.claude/skills/remote-dev/SKILL.md
.claude/skills/ssr/SKILL.md
.claude/skills/testing-internals/SKILL.md
.claude/skills/testing/SKILL.md
.claude/skills/ui-accessibility/SKILL.md
.claude/skills/writing-tests/SKILL.md

元信息

文件数
0
版本
1f8708d
Hash
55ce4b6a
收录时间
2026-08-16 15:39

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-17 06:19
浙ICP备14020137号-1 $访客地图$