From e88bfc0dc05410a7ab3fb0be65bfdcf065e507ff Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Fri, 16 Oct 2026 21:58:24 -0700 Subject: [PATCH] agents: document git archive export-subst, precondition, and daemon rules Agents recently broke release archives by passing raw tree SHAs to `git archive` (skipping `.gitattributes` `export-subst` expansion), masked broken CLI invocations with silent directory/file guards, and terminated background CI monitors prematurely by appending `&` in `run_command`. Record these invariants in the workflow, Python, and CI monitoring instructions so future sessions preserve `export-subst` expansion, trust caller preconditions, and launch long-running monitors with `IsDaemon: true`. --- .agents/rules/github_actions_workflows.md | 4 ++++ .agents/rules/python.md | 3 +++ .agents/skills/monitor-ci-results/SKILL.md | 6 ++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.agents/rules/github_actions_workflows.md b/.agents/rules/github_actions_workflows.md index b5b0d6ecb3..f53c69530f 100644 --- a/.agents/rules/github_actions_workflows.md +++ b/.agents/rules/github_actions_workflows.md @@ -15,6 +15,10 @@ globs: ".github/workflows/**" * **Event Payload Resolution**: For steps that are a single Python script, loading event details directly from `$GITHUB_EVENT_PATH` is required (strong suggestion otherwise) rather than passing fields via env vars or CLI flags. +* **Preserve `export-subst` in `git archive`**: Always pass a commit or tag ref + (never a raw `git write-tree` SHA) to `git archive` so `.gitattributes` + `export-subst` placeholders (such as `$Format:...$` in `python/features.bzl`) + expand. Use `--add-file` to include generated files. ## Workflow Python Scripts & Testing * **Executable Permissions**: Workflow step scripts must have `chmod +x` (mode diff --git a/.agents/rules/python.md b/.agents/rules/python.md index f2545abbe1..dbc134013f 100644 --- a/.agents/rules/python.md +++ b/.agents/rules/python.md @@ -8,6 +8,9 @@ ## CLI & Arguments * Use direct attribute access (e.g. `args.foo`) on `argparse.Namespace` with well-defined shapes. Avoid defensive `getattr()`. +* Assume caller-guaranteed preconditions hold (e.g., input directories exist + and contain files). Do not add silent no-op guards (`if path.is_dir():` or + `if not path.is_file(): continue`) that mask broken invocations. ## Interface & ABC Docstrings * In abstract base class / interface methods, always document `Args:`, diff --git a/.agents/skills/monitor-ci-results/SKILL.md b/.agents/skills/monitor-ci-results/SKILL.md index 2c30533f90..b5a0af7873 100644 --- a/.agents/skills/monitor-ci-results/SKILL.md +++ b/.agents/skills/monitor-ci-results/SKILL.md @@ -20,10 +20,12 @@ or when monitoring CI after PR updates: with `|| ... monitor_remote_ci.py ` in a single shell invocation, as `pgrep -af` will match the parent `bash -c` command string and exit `0`. 2. **Launch Monitoring Script**: If no monitor process is active for - ``, launch the script in the background: + ``, launch the script via `run_command` with `IsDaemon: true` and + `WaitMsBeforeAsync: 500` (do NOT append a trailing `&`, which causes the + shell to exit immediately and kills the background process): ```bash ./.agents/skills/monitor-ci-results/scripts/monitor_remote_ci.py \ - "" & + "" ``` ### ✨ Autonomous Subagent Orchestration