Repository navigation
running-in-ci: skill-edit recipe should use worktree under $TMPDIR - #328
Conversation
The 'How to propose' recipe ran 'cd .claude && mv /tmp/... SKILL.md', which satisfies the harness write-guard but fails the read-only bind-mount the sandbox places on .claude/. tend-mention sessions hit 'Read-only file system' and ad-libbed unsafe workarounds. Mirror the pattern review-runs already documents: do the edit, commit, and push from a git worktree under $TMPDIR. Both restrictions (read-only mount and harness write-guard) are now explained inline so a future reader knows why the worktree is mandatory. Triggered by max-sixty/worktrunk#2416 (worktrunk-bot's permission-request issue) and worktrunk run 24926120125.
tend-agent
left a comment
There was a problem hiding this comment.
The previous recipe used mkdir -p skills/running-tend so the same shape worked for both editing an existing skill and creating a new one. The new recipe drops that, but step 3 still contemplates new-skill creation (the YAML frontmatter snippet immediately above). For a brand-new skill, cd "$TMPDIR/skill-fix/.claude/skills/<new>" fails with "No such file or directory". Inline suggestion to restore the mkdir -p.
Note this gap also exists in review-runs/SKILL.md, but that skill is purely an editing flow so it's defensible there.
|
|
||
| # Use the Write tool to author the new skill file to /tmp/running-tend-new.md. | ||
| # Then move it into place from inside the worktree: | ||
| cd "$TMPDIR/skill-fix/.claude/skills/running-tend" && mv /tmp/running-tend-new.md SKILL.md |
There was a problem hiding this comment.
| cd "$TMPDIR/skill-fix/.claude/skills/running-tend" && mv /tmp/running-tend-new.md SKILL.md | |
| mkdir -p "$TMPDIR/skill-fix/.claude/skills/running-tend" | |
| cd "$TMPDIR/skill-fix/.claude/skills/running-tend" && mv /tmp/running-tend-new.md SKILL.md |
There was a problem hiding this comment.
Good catch — pushed fd3f7a6 with mkdir -p "$TMPDIR/skill-fix/.claude/skills/running-tend" before the cd. The worktree mirrors HEAD, so for a brand-new skill the directory genuinely doesn't exist and the bare cd fails. The dogfood test plan only exercised the existing-skill path, which is why this slipped through.
The previous recipe used `mkdir -p skills/running-tend` so the same shape worked for both editing an existing skill and creating a new one. The worktree rewrite dropped that, but step 3 still contemplates new-skill creation (the YAML frontmatter snippet immediately above). For a new skill, `cd "$TMPDIR/skill-fix/.claude/skills/<new>"` fails with "No such file or directory" because the worktree mirrors HEAD, where the directory doesn't exist yet. Restore `mkdir -p` before the `cd`. Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
did we test whether this approach works? |
|
Yes — re-verified in this session by running the recipe end-to-end against this checkout: All four steps succeeded: worktree create, Skipped Limitation: I can't independently verify the PR-description claim that 02a28bc and fd3f7a6 were originally authored from a worktree — git doesn't record which working tree a commit came from — but the commits exist on this branch and the mechanical steps reproduce. |
## Summary Extend the CI-polling helper's exclusion filter so it also drops check runs whose `workflowName` matches `$GITHUB_WORKFLOW`. Without this, a `tend-mention` session that pushes a commit or replies to an inline review comment ends up polling for its own queued sibling — a deadlock that only the 15-min cap breaks. ## Why Run [24927643947](https://github.com/max-sixty/tend/actions/runs/24927643947) (`tend-mention` on PR [#328](#328)) ran 18 minutes / $1.16 — about 4× the cost of an equivalent fix-and-reply session. The session log shows ~3 minutes of productive work followed by 15 minutes of polling that never converged, with the bot logging: > CI still running after 15 minutes > ... > handle tend-mention PENDING The PENDING `handle` job belonged to a *sibling* `tend-mention` run [24927689625](https://github.com/max-sixty/tend/actions/runs/24927689625), triggered by the bot's own reply to the inline review comment via `POST /pulls/{n}/comments/{id}/replies`. `tend-mention.yaml`'s handle job uses concurrency group `tend-mention-handle-{PR#}` with `cancel-in-progress: false`, which queued the sibling behind the current run. Result: the sibling waited for the current run to finish; the current run's polling waited for the sibling's `handle` to start — a guaranteed deadlock until the 15-min timer expired. Verified the chain: - 09:19:50Z — `tend-mention` 24927643947 started (review submission with inline comment). - 09:21Z — bot pushed `fd3f7a6` and posted reply via the `/replies` endpoint. - 09:22:23Z — `tend-mention` 24927689625 created (`pull_request_review` event, queued by concurrency group). - 09:22:29Z — `ci` for the new commit completed. - 09:23:55Z — `tend-review` 24927685808 completed. - 09:23Z onwards — only thing left non-terminal in the rollup was sibling 24927689625's `handle` job. - 09:37:59Z — current run timed out after 15 minutes of polling. - 09:39:10Z — sibling 24927689625 finally ran (4 turns, silent self-conversation exit, $0.30) once the concurrency lock cleared. The sibling's `verify` job (no concurrency) ran promptly and was COMPLETED by ~09:23, so it didn't gate polling. Only the queued `handle` job did. `tend-mention.yaml` already documents (lines ~17–28) that GitHub fires both `pull_request_review` and `pull_request_review_comment` for every newly-created inline comment, and the workflow correctly avoids the duplicate by *not* subscribing to `pull_request_review_comment.created`. The remaining `pull_request_review.submitted` subscription is the trigger for the sibling, and silencing that would drop legitimate user follow-up reviews. The proportionate fix is at the polling helper. ## Fix Add a same-workflow filter to `pending()` in `plugins/tend-ci-runner/skills/running-in-ci/SKILL.md`: ```jq | select((.workflowName // "") != $wf) ``` with `$wf = $GITHUB_WORKFLOW`. Same-workflow check runs are subject to concurrency rules (queueing for `cancel-in-progress: false` workflows like `tend-mention`, or cancelled-on-supersede for `cancel-in-progress: true` workflows like `tend-review`) and don't represent independent CI signals. For `cancel-in-progress: true` workflows, the filter is a no-op — older siblings are cancelled and already not in IN_PROGRESS state. The fix is targeted to the deadlock case while remaining benign elsewhere. The accompanying comment block explains the failure mode in-place so a future reader doesn't re-derive it from the symptom. ## Gate assessment - **Evidence level**: Critical — 1 occurrence sufficient. Concrete cost ($1.46 across the deadlocked pair), reproducible from the workflow's documented event-firing behavior plus its handle-job concurrency group. Same-condition runs are guaranteed to repeat the failure. - **Classification**: Structural. The deadlock is not a model decision — it's a deterministic consequence of two GitHub Actions properties (event firing on bot replies; serialized concurrency group with `cancel-in-progress: false`). - **Change type**: Targeted (one extra `jq` filter line + comment). Normal evidence bar; passes. - **Both gates**: pass. ## Test plan - [ ] CI on this PR passes (lint, test). - [ ] Next time `tend-mention` replies to an inline review comment + polls CI on the same PR, the polling helper exits within 1–2 minutes after non-mention checks complete (rather than timing out at 15 min). Co-authored-by: tend-agent <[email protected]>
Summary
Update the
running-in-ci"How to propose" recipe so a bot updating.claude/skills/can actually write to disk. The current recipe (cd .claude && mv /tmp/... SKILL.md) satisfies the Claude Code harness write-guard (anthropics/claude-code#37157) but fails the read-only bind-mount the sandbox places on.claude/. Mirror the patternreview-runsalready documents: do the edit, commit, and push from a git worktree under$TMPDIR. Both restrictions are now explained inline so a future reader knows why the worktree is mandatory.Why
worktrunk-bothit this in worktrunk run 24926120125 (atend-mentionsession triggered by an explicit maintainer instruction to update repo skill guidance). The bot followed the bundled recipe, hitmv: ... Read-only file system, retried withcp(same error), retried withtouch(same error), then ad-libbedgit hash-object -wplusgit update-index --cacheinfoto write the blob and stage it directly to the index — a workaround that left the working tree showing the file as modified after the fact. ~7 wasted bash cycles before producing worktrunk PR #2415.worktrunk-botfollowed the new bundled-skill-defect flow (introduced in #324 yesterday) and opened permission-request issue max-sixty/worktrunk#2416 on the consumer side. This PR is the corresponding tend-side fix surfaced byreview-reviewersrather than waiting on the permission round-trip — the diagnosis is unambiguous and the fix is small.What changes
The "Draft a minimal edit" step (step 3 of "How to propose"):
cd .claude && mv /tmp/... SKILL.mdrecipe that fails on the read-only mount.review-runsalready carries explaining (a) the read-only bind-mount of.claude/and (b) the harness write-guard from claude-code#37157, so a reader sees both barriers and why a worktree clears both.git worktree add "$TMPDIR/skill-fix"pattern, parameterised on<topic>-$GITHUB_RUN_IDfor the branch name.The frontmatter snippet is moved up so the recipe sits at the bottom of step 3 with no interleaving.
Test plan
$TMPDIR/skill-fixusing exactly the recipe being landed; commit and push worked end-to-end. Worktree under$TMPDIRis writable, noRead-only file systemerrors.review-runsSKILL.md prose to confirm the two skills now agree on the recipe shape.Independent of #327 (different concern in the same file: external-tool verification, lines ~498 — no overlap with this edit at lines ~568).