Skip to content

Commit 4302628

Browse files
author
igor
committed
agents.md: document upstream PR prep via agent-helpers/upstream-pr-prep.sh
Adds a new 'Upstream PR prep' section to the agent-facing build/run/test instructions, pointing at the helper script shipped in this session (commit 77532cf, merged to master via 89f87b5). Covers: - Script invocation with all mode flags (prep, build, push, cleanup, dry-run) - Prerequisites: gh auth login, jq installed - Commit message review flow (agent prepares, operator confirms in chat, script reads file verbatim) - Worktree strategy (not git switch -c, to keep agent-helpers/ intact) - /tmp-tmpfs workaround via --worktree /var/tmp/... - Explicit 'never run travis-install-build-deps.sh' - Convention: strip Co-Authored-By, no Signed-off-by - Cross-references to auto-memory reference_upstream_pr_workflow.md and the lab parking doc at lab/cncmill1/memory/parked-linuxcnc-upstream-teleop-pr.md
1 parent 89f87b5 commit 4302628

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

agents.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,60 @@ Revert to regular build:
198198
```bash
199199
cd src && ./configure --with-realtime=uspace && make clean && make -j$(nproc) && cd ..
200200
```
201+
202+
---
203+
204+
## Upstream PR prep
205+
206+
When a fix exists on fork `master` and needs to go upstream as a PR
207+
against `LinuxCNC/linuxcnc`, use the helper script — not raw cherry-pick
208+
commands:
209+
210+
```bash
211+
agent-helpers/upstream-pr-prep.sh \
212+
--commit <fork-sha> \
213+
--branch <pr-branch-name> \
214+
--message /tmp/upstream-commit-msg.txt \
215+
--worktree /var/tmp/linuxcnc-pr-<branch> \
216+
[--build] [--push] [--cleanup] [--dry-run]
217+
```
218+
219+
Default (no mode flag) runs prep: `git fetch upstream`, `git worktree add`
220+
off `upstream/master`, `git cherry-pick --no-commit`, strict diff
221+
verification, commit with dynamically-resolved GitHub-noreply author
222+
(via `gh api user`), and post-commit verification. Add `--build` to run
223+
`autogen`+`configure`+`make` matching upstream CI exactly. Add `--push`
224+
to push the PR branch to `origin` and print the compare URL. `--cleanup`
225+
tears down the worktree after the PR is open. `--dry-run` combines with
226+
any mode to print the would-be commands without executing.
227+
228+
Prerequisites (one-time setup):
229+
- `gh auth login` — the script calls `gh api user` at commit time to
230+
resolve the commit author dynamically as `<login> <id+login@users.noreply.github.com>`.
231+
Never hardcoded, never cached.
232+
- `jq` installed — used to parse `gh api user` JSON output.
233+
234+
Workflow notes for agents:
235+
- **Commit message is prepared by the agent, reviewed by the operator
236+
in chat, then handed to the script via `--message <file>`.** The
237+
script never prompts interactively — all review happens in chat.
238+
- **Worktree, not `git switch -c`.** A naive `git switch -c … upstream/master`
239+
from the main working tree would wipe `agent-helpers/` (not on
240+
upstream/master), breaking the wrapper on the next invocation. The
241+
helper uses `git worktree add` so the main fork working tree stays
242+
intact with `agent-helpers/` present.
243+
- **Pass `--worktree /var/tmp/linuxcnc-pr-<branch>`** on every invocation
244+
if `/tmp` is tmpfs on the machine (the build artifacts are hundreds
245+
of MB and would eat RAM). The script warns at preflight but doesn't
246+
refuse.
247+
- **Never run `scripts/travis-install-build-deps.sh`** — that's what
248+
upstream CI runs to set up a fresh container, and it installs system
249+
packages via apt. The script never invokes it; rely on system deps
250+
already installed from prior fork builds.
251+
- **Strip `Co-Authored-By:` trailers** from commit messages — absent
252+
from recent upstream motion-area commits, stripping matches convention.
253+
- **No `Signed-off-by:`** needed — no DCO convention in LinuxCNC.
254+
255+
See also: `reference_upstream_pr_workflow.md` in auto-memory, and
256+
`lab/cncmill1/memory/parked-linuxcnc-upstream-teleop-pr.md` for the full
257+
procedure with a worked example (PR #3933).

0 commit comments

Comments
 (0)