docs: agent temp artifact cleanup guidance and detection (#261)

Add runbook section, root-level .gitignore patterns, and detection helper
for _encode_/_emit_/_inline_ throwaway scripts. Surface non-blocking
warnings from assess_preflight_status and gitea_lock_issue.

Closes #261

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
2026-07-06 14:42:33 -04:00
co-authored by Claude Opus 4.8
parent f464716e89
commit 850b7c34b6
6 changed files with 159 additions and 24 deletions
+24 -20
View File
@@ -316,6 +316,30 @@ may edit another issue's branch folder unless explicitly assigned to that issue.
No LLM may clean another issue's branch folder unless the PR is merged or closed
and cleanup is explicitly part of the task.
## Agent temp artifact cleanup (#261)
Failed or aborted MCP commit attempts sometimes leave throwaway helper scripts in
the **repository root**. These are not part of any issue scope and pollute
`git status`, which can break `gitea_lock_issue` and preflight checks.
**Patterns (repo root only, untracked):**
- `_encode_*.py` — base64 payload encoders
- `_emit_*.py` — commit payload emitters
- `_inline_*.py` — inline encoding helpers
**Required cleanup (after MCP commit completes or aborts):**
1. Delete any matching files at the repo root (`rm ./_encode_*.py` etc.).
2. Confirm `git status` is clean on the orchestration checkout before
`gitea_lock_issue`.
3. Prefer native `gitea_commit_files` / gated commit paths — do not leave shell
encoding fallbacks behind.
Root-level matches are listed in `.gitignore` so they never get committed.
`gitea_get_runtime_context` and `gitea_lock_issue` surface **warnings** (not
hard blocks) when these artifacts are still present.
Implementation work and review work must use separate branch folders. For
example, an implementation branch might live under
`branches/fix-issue-123-example`, while a review branch for the resulting PR
@@ -370,26 +394,6 @@ git branch -d fix/issue-123-example
All three helpers accept `--dry-run` to print the exact commands/paths without
touching anything.
### Agent temp artifact cleanup (#261)
Failed or exploratory agent runs sometimes leave throwaway helper scripts in the
repo root (for example `_encode_commit_payload.py`, `_emit_payload.py`,
`_inline_commit.py`). These files are **not** part of any issue scope. They
pollute `git status`, break `gitea_lock_issue`, and can trigger preflight
fail-closed gates if created before `gitea_whoami`.
**After every MCP commit attempt** (success or abort):
1. Delete any root-level `_encode_*.py`, `_emit_*.py`, or `_inline_*.py` helpers
the agent created for payload preparation.
2. Run `git status --porcelain` in the **author worktree** and confirm no
unexpected tracked or untracked files remain before `gitea_lock_issue`.
3. Do not commit these helpers; stage only issue-scoped paths (`git add <files>`).
The repo `.gitignore` ignores these patterns so accidental leftovers stay
untracked. Ignored files still block issue-lock if they appear as tracked edits —
delete them instead of leaving them in the tree.
### Create an issue / child issues
- **Profile:** issue-manager or author (any profile allowed to create issues).