You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
work-loop: escalation record write is blocked when the lane runs as a background job #4598
A /work-items:work-loop lane launched as a Claude Code background job (session claude.ai/code/session_01YXxu4tpPEWHkH44Y2JdS1i, instance melo-lap-001-wsl-1, 2026-09-27) could not write any escalation record. The step-5 Write-tool write to .claude/lane-escalations/<stamp>-<item>-work-loop.json was refused with: "parent bg session hasn't isolated yet, so writes to the shared checkout are blocked". Five kind=ratify-c3 / kind=escalated markers were posted (#3351, #3526, #3589, #3612, #3614) with no record written.
Why it matters
The background-job harness blocks file edits in the shared checkout until the session calls EnterWorktree. The work-loop skill forbids exactly that: the lane runs on the default-branch checkout, and EnterWorktree would transition the orchestrator session. Step 0 of the cycle makes the directory git-ignored, but the harness block applies anyway. So every escalation's out-of-band notification leg is lost whenever the lane runs as a background job. The tracker comment stays the escalation of record.
Possible directions
Write the record under a path outside the checkout (for example under $CLAUDE_JOB_DIR or a user-scope lane directory) that a notification hook can still key on.
Document that background-job launches lose the record leg, and name the launch mode that keeps it.
Evidence
plugins/work-items/skills/work-loop/SKILL.md "Cycle shape" step 5 (record path relative to the checkout, Write tool required).
Verified (at the contract level). The work-loop "Cycle shape" step 5 writes the escalation record with the Write tool to a path relative to the session's checkout (.claude/lane-escalations/…), and step 0 only git-ignores that directory. Ignoring the path does not lift a harness write block on the shared checkout, so the reported refusal fits the text. I did not reproduce the background-job refusal itself here.
Scope is wider than work-loop. The record path and the Write-tool rule are part of the loop-lane convention (escalation record section and its example notification hook, which matches Edit(/.claude/lane-escalations/**)). The babysit-loop cycle shape and the escalation-marker reference restate the same contract. Any fix applies to every lane that writes the record.
Why a human decides. Both directions in the report change a published contract:
Move the record out of the checkout (for example the job directory or a user-scope lane directory). Keeps the notification leg under background jobs, but every consumer's hook matcher keyed on the project-relative path stops firing until it is updated. That is a schema/contract change across lanes and consuming repos.
Document the limitation. State that background-job launches lose the record leg, name the launch mode that keeps it, and leave the tracker comment as the escalation of record. No consumer breakage, but the out-of-band signal stays unavailable in that mode.
Recommendation: option 1 with a versioned record location (keep the checkout path when writable, else fall back to a user-scope directory), plus a matching update to the convention's example hook. That is judgment, not measured. Picking the option unblocks a scoped implementation brief.
Reporter severity was not stated. priority: medium because the tracker comment remains the escalation of record, so no escalation is lost; only the notification is.
Data point from a second lane: instance melo-lap-001-wsl-2, also a background job, launched in the lane worktree /home/kyle/worktrees/cc-plugins-lane-2 (not under .claude/worktrees/). There, three Write-tool calls to .claude/lane-escalations/<stamp>-<item>-work-loop.json succeeded on 2026-09-27 at about 18:32Z, for #4351, #4345, and #4346. So the block does not happen in every background-job lane. It may depend on whether the session's working directory counts as the shared checkout or as an already-isolated worktree. Please check that before choosing between moving the record path and documenting the lost record leg.
Fix PR #5325 (Refs #4598) is docs accuracy only: it words the limitation as "observed, conditional on isolation". It does not decide the question.
Decision needed (owner)
Question: how should loop lanes keep the out-of-band escalation record when Claude Code runs them as background jobs?
Options:
A. Move the record to a versioned fallback location outside the shared checkout (triage's recommendation; needs a scoped brief naming the location and the hook consumer).
C. Document and recommend launching the background job from an isolated lane worktree once the check confirms it (cheapest, changes no code).
B and C can combine.
RECOMMENDED (a recommendation, not a decision): run the check first. If a background job from an isolated worktree reliably keeps the Write, choose C with B as the fallback statement; pick A only if operators cannot launch from lane worktrees. Basis: this issue's second comment (three successful Writes), triage's non-reproduction, judgment on cost. No official Claude Code doc read supports either claim yet.
Operator steps for the check (needs a live session): from the default-branch checkout, start the work-loop as a background job with one item that forces an escalation, then repeat from an isolated lane worktree. In each run, look for a file under .claude/lane-escalations/ and for the harness error text.
Unblocks: a scoped implementation brief for the chosen option. needs-human and work-class: structural stay on the issue.
Correction to the decision packet above: it says no official Claude Code doc read supports either claim yet. That is wrong. The work-loop SKILL.md verification record on PR #5325 cites https://code.claude.com/docs/en/agent-view#how-file-edits-are-isolated, which says writes to the shared checkout are blocked until the session moves into a worktree and that the move is skipped when the session is already inside a linked git worktree. That agrees with the conditional-on-isolation reading; the refusal itself is still not reproduced.
Update from the 2026-09-29 audit remediation: the babysit-loop skill restated the escalation-record write (plugins/source-control/skills/babysit-loop/SKILL.md, escalation section) without the background-job caveat. PR #5317 (merged) adds a pointer there to the loop-lane convention's "Background-job launch mode" paragraph, so the third restatement now points at the same interim wording as work-loop (PR #5325) and docs/conventions/loop-lane/README.md. No option is chosen; the decision stays open here.
Owner decision (2026-09-29): Option C with B as the fallback statement, after a live check. Owner's words: "Accept recommendation: C with B as fallback statement, after a live check". That means: document and recommend launching background jobs from an isolated lane worktree, and keep the documented limitation (as worded in #5325) for sessions that are not isolated. Option A (moving the record location) is not chosen.
Next: the live check stays with the owner: run the work-loop as a background job that forces an escalation, once from the default-branch checkout and once from an isolated lane worktree, and record whether a file appears under .claude/lane-escalations/ plus any harness error text. needs-human stays until the result is posted here. If the isolated launch keeps the Write, the C doc edits follow (doc-only, no code). If it does not, this comes back to the owner for a re-decision.
Goal. Find out whether a work-loop lane launched as a Claude Code background job can write .claude/lane-escalations/<stamp>-<item>-work-loop.json, and if it can, update the docs to name the launch mode that keeps the record leg. This is the live check the owner asked for on 2026-09-29 (option C, with B as the fallback wording).
Steps.
Probe from a scratch worktree under .work/, not the live checkout. Use a minimal prompt that exercises the same Write path as work-loop step 5: "Use the Write tool to create .claude/lane-escalations/probe-.json containing {}; then report the exact tool result or error text."
Run 1: claude --bg --name probe-default "<prompt>" from a plain default-branch checkout that is not a linked worktree.
Run 2: create an isolated lane worktree outside .claude/worktrees (as cc-plugins-lane-2 was) and run the same claude --bg from inside it.
Read the results with claude agents or the job transcript. Record whether the file exists, where it landed (checkout or worktree path), and the harness error text if refused.
Post the results on this issue. Per https://code.claude.com/docs/en/agent-view#how-file-edits-are-isolated, a background session moves into an isolated worktree before its first edit and skips the move when already in a linked worktree. So Run 1 may succeed but write into the auto-created worktree, which matters for hook matchers on the project-relative path. Run 2 should write in place.
If Run 2 keeps the Write, make a doc-only follow-up: edit docs/conventions/loop-lane/README.md ("Background-job launch mode"), plugins/work-items/skills/work-loop/SKILL.md and the babysit-loop SKILL.md to recommend launching from an isolated lane worktree, and keep the B wording for non-isolated sessions. Add the verification record and ## Next section the skill-bodies rule requires. Open a draft PR with Closes #4598.
If Run 2 fails, return the issue to the owner for re-decision (option A).
Acceptance criteria.
Both probe runs are recorded on this issue with file existence, path, and exact error text.
The docs state which launch mode keeps the escalation record, matching the probe results.
The doc edits carry the verification record and ## Next section, and the PR uses the Conventional Commits title and the PR body contract.
No change to work-loop behavior beyond docs, and no EnterWorktree in the orchestrator.
Notes. Prerequisites checked on origin/main: #5325 is merged and the convention already has the interim B wording. The probes are local and non-destructive but spend plan usage; if probing from an agent is unwanted, the owner can run them by hand.
Prompt in both runs: "Use the Write tool to create .claude/lane-escalations/probe-.json containing {}; then report the exact tool result or error text."
Run 1 (plain, non-linked default-branch clone): not run. I made a plain git clone --local -b main of the repo under .work/probe-4598/default. claude --bg --name probe-4598-default ... refused to start there:
Workspace not trusted. Run `claude` in <clone path>/.work/probe-4598/default once and accept the trust prompt, then retry.
Trust is recorded per path in ~/.claude.json, and only the live checkout is trusted. Accepting the prompt is a user-scope config write, so I did not do it, and running the probe in the live checkout is excluded. No file, path or harness error text exists for this run. The owner needs to accept the trust prompt for a plain clone (or run the probe by hand) to complete it.
Run 2 (linked lane worktree outside .claude/worktrees): the Write was kept, in place. The worktree was git worktree add --detach .work/probe-4598/lane origin/main from the live repo (a linked worktree of the trusted repo, so the trust prompt did not apply). claude --bg --name probe-4598-lane ... was started from inside it.
Tool result: Wrote 1 line to .claude/lane-escalations/probe-lane-1.json (permission line: "Allowed by auto mode classifier"). No refusal and no "hasn't isolated yet" text.
File exists: yes, {} (2 bytes).
Absolute path where it landed: /home/kyle/repos/github.com/melodic-software/claude-code-plugins/.work/probe-4598/lane/.claude/lane-escalations/probe-lane-1.json, the lane worktree itself. No auto-created worktree appeared, and no copy was found elsewhere under /home/kyle.
Job state (claude agents --json): probe-4598-lane, state: done.
So the isolated-lane launch keeps the record leg, matching the docs and the cc-plugins-lane-2 data point. The refusal in the original report is still not reproduced. Run 1 is what would show it, and it is still open.
Cleanup: the probe clone, the lane worktree and both probe background sessions are removed after this comment.
Owner decision (2026-10-01): approved the recommendation ("go with recommended", the owner's reply to the batch decision page that listed this question and its recommendation).
Question: close #4598 as done on probe Run 2 plus the docs merged in #5549 and drop probe Run 1, or keep it open until Run 1 is run?
Chosen option A: close as completed and drop Run 1. Run 2 (isolated linked worktree) kept the Write in place, which was the condition for the doc edits, and #5549 shipped them. The docs already hedge the non-linked launch ("may have the Write refused or landed in an auto-created worktree"), so Run 1 cannot change the advice. The owner waives the Run 1 acceptance criterion.
Next: closing this issue as completed. If a lane later hits a refusal, reopen or file a new issue.
Activity
kyle-sexton commentedon Sep 27, 2026
This was generated by AI during triage.
Triage: Bug,
priority: medium, human-gated (open contract decision).Verified (at the contract level). The work-loop "Cycle shape" step 5 writes the escalation record with the Write tool to a path relative to the session's checkout (
.claude/lane-escalations/…), and step 0 only git-ignores that directory. Ignoring the path does not lift a harness write block on the shared checkout, so the reported refusal fits the text. I did not reproduce the background-job refusal itself here.Scope is wider than work-loop. The record path and the Write-tool rule are part of the loop-lane convention (escalation record section and its example notification hook, which matches
Edit(/.claude/lane-escalations/**)). The babysit-loop cycle shape and the escalation-marker reference restate the same contract. Any fix applies to every lane that writes the record.Why a human decides. Both directions in the report change a published contract:
Recommendation: option 1 with a versioned record location (keep the checkout path when writable, else fall back to a user-scope directory), plus a matching update to the convention's example hook. That is judgment, not measured. Picking the option unblocks a scoped implementation brief.
Reporter severity was not stated.
priority: mediumbecause the tracker comment remains the escalation of record, so no escalation is lost; only the notification is.kyle-sexton commentedon Sep 27, 2026
This was generated by AI during work-loop.
Data point from a second lane: instance
melo-lap-001-wsl-2, also a background job, launched in the lane worktree/home/kyle/worktrees/cc-plugins-lane-2(not under.claude/worktrees/). There, three Write-tool calls to.claude/lane-escalations/<stamp>-<item>-work-loop.jsonsucceeded on 2026-09-27 at about 18:32Z, for #4351, #4345, and #4346. So the block does not happen in every background-job lane. It may depend on whether the session's working directory counts as the shared checkout or as an already-isolated worktree. Please check that before choosing between moving the record path and documenting the lost record leg.docs(work-items): document background-job escalation record limit (#4598
docs(loop-lane): point background-job launch mode at the work-loop sk…
fix(source-control): point babysit-loop at the background-launch cave…
docs(loop-lane): state no launch-mode condition for the escalation re…
kyle-sexton commentedon Sep 29, 2026
Reopened. This comes from the 2026-09-29 audit of the Cursor run, and the audit chooses no option.
What the audit found
.claude/lane-escalations/(Three skill descriptions exceed the 1024-codepoint limit and fail check-skill #4351, docs(babysit-prs): stuck-checks reference routes label fixes to the deleted select-runner workflow #4345, playbooks: regenerate the fable-5 doctrine for Fable 5.1 #4346). The trigger looks like "session not yet isolated", not "background job".Fix PR #5325 (Refs #4598) is docs accuracy only: it words the limitation as "observed, conditional on isolation". It does not decide the question.
Decision needed (owner)
Question: how should loop lanes keep the out-of-band escalation record when Claude Code runs them as background jobs?
Options:
B and C can combine.
RECOMMENDED (a recommendation, not a decision): run the check first. If a background job from an isolated worktree reliably keeps the Write, choose C with B as the fallback statement; pick A only if operators cannot launch from lane worktrees. Basis: this issue's second comment (three successful Writes), triage's non-reproduction, judgment on cost. No official Claude Code doc read supports either claim yet.
Operator steps for the check (needs a live session): from the default-branch checkout, start the work-loop as a background job with one item that forces an escalation, then repeat from an isolated lane worktree. In each run, look for a file under
.claude/lane-escalations/and for the harness error text.Unblocks: a scoped implementation brief for the chosen option.
needs-humanandwork-class: structuralstay on the issue.kyle-sexton commentedon Sep 29, 2026
Correction to the decision packet above: it says no official Claude Code doc read supports either claim yet. That is wrong. The work-loop SKILL.md verification record on PR #5325 cites https://code.claude.com/docs/en/agent-view#how-file-edits-are-isolated, which says writes to the shared checkout are blocked until the session moves into a worktree and that the move is skipped when the session is already inside a linked git worktree. That agrees with the conditional-on-isolation reading; the refusal itself is still not reproduced.
docs(conventions): revert agent rulings on owner-reserved issues and …
fix(source-control): repair audit findings in linkage, worktree, conf…
kyle-sexton commentedon Sep 29, 2026
Update from the 2026-09-29 audit remediation: the babysit-loop skill restated the escalation-record write (
plugins/source-control/skills/babysit-loop/SKILL.md, escalation section) without the background-job caveat. PR #5317 (merged) adds a pointer there to the loop-lane convention's "Background-job launch mode" paragraph, so the third restatement now points at the same interim wording aswork-loop(PR #5325) anddocs/conventions/loop-lane/README.md. No option is chosen; the decision stays open here.#5317
kyle-sexton commentedon Sep 29, 2026
Owner decision (2026-09-29): Option C with B as the fallback statement, after a live check. Owner's words: "Accept recommendation: C with B as fallback statement, after a live check". That means: document and recommend launching background jobs from an isolated lane worktree, and keep the documented limitation (as worded in #5325) for sessions that are not isolated. Option A (moving the record location) is not chosen.
Next: the live check stays with the owner: run the work-loop as a background job that forces an escalation, once from the default-branch checkout and once from an isolated lane worktree, and record whether a file appears under
.claude/lane-escalations/plus any harness error text.needs-humanstays until the result is posted here. If the isolated launch keeps the Write, the C doc edits follow (doc-only, no code). If it does not, this comes back to the owner for a re-decision.fix(work-items): resolve audit findings for work-loop, adapter releas…
kyle-sexton commentedon Sep 30, 2026
Resolution (2026-09-29, owner-approved consensus)
Goal. Find out whether a work-loop lane launched as a Claude Code background job can write
.claude/lane-escalations/<stamp>-<item>-work-loop.json, and if it can, update the docs to name the launch mode that keeps the record leg. This is the live check the owner asked for on 2026-09-29 (option C, with B as the fallback wording).Steps.
.work/, not the live checkout. Use a minimal prompt that exercises the same Write path as work-loop step 5: "Use the Write tool to create .claude/lane-escalations/probe-.json containing {}; then report the exact tool result or error text."claude --bg --name probe-default "<prompt>"from a plain default-branch checkout that is not a linked worktree..claude/worktrees(ascc-plugins-lane-2was) and run the sameclaude --bgfrom inside it.claude agentsor the job transcript. Record whether the file exists, where it landed (checkout or worktree path), and the harness error text if refused.docs/conventions/loop-lane/README.md("Background-job launch mode"),plugins/work-items/skills/work-loop/SKILL.mdand the babysit-loopSKILL.mdto recommend launching from an isolated lane worktree, and keep the B wording for non-isolated sessions. Add the verification record and## Nextsection the skill-bodies rule requires. Open a draft PR withCloses #4598.Acceptance criteria.
## Nextsection, and the PR uses the Conventional Commits title and the PR body contract.EnterWorktreein the orchestrator.Notes. Prerequisites checked on origin/main: #5325 is merged and the convention already has the interim B wording. The probes are local and non-destructive but spend plan usage; if probing from an agent is unwanted, the owner can run them by hand.
kyle-sexton commentedon Sep 30, 2026
This was generated by AI during work-loop.
Live check for the Resolution comment, run 2026-09-29 with Claude Code 2.1.285 (
claude --bg, auto mode). Reference: https://code.claude.com/docs/en/agent-view#how-file-edits-are-isolatedPrompt in both runs: "Use the Write tool to create .claude/lane-escalations/probe-.json containing {}; then report the exact tool result or error text."
Run 1 (plain, non-linked default-branch clone): not run. I made a plain
git clone --local -b mainof the repo under.work/probe-4598/default.claude --bg --name probe-4598-default ...refused to start there:Trust is recorded per path in
~/.claude.json, and only the live checkout is trusted. Accepting the prompt is a user-scope config write, so I did not do it, and running the probe in the live checkout is excluded. No file, path or harness error text exists for this run. The owner needs to accept the trust prompt for a plain clone (or run the probe by hand) to complete it.Run 2 (linked lane worktree outside
.claude/worktrees): the Write was kept, in place. The worktree wasgit worktree add --detach .work/probe-4598/lane origin/mainfrom the live repo (a linked worktree of the trusted repo, so the trust prompt did not apply).claude --bg --name probe-4598-lane ...was started from inside it.Wrote 1 line to .claude/lane-escalations/probe-lane-1.json(permission line: "Allowed by auto mode classifier"). No refusal and no "hasn't isolated yet" text.{}(2 bytes)./home/kyle/repos/github.com/melodic-software/claude-code-plugins/.work/probe-4598/lane/.claude/lane-escalations/probe-lane-1.json, the lane worktree itself. No auto-created worktree appeared, and no copy was found elsewhere under/home/kyle.claude agents --json):probe-4598-lane,state: done.So the isolated-lane launch keeps the record leg, matching the docs and the
cc-plugins-lane-2data point. The refusal in the original report is still not reproduced. Run 1 is what would show it, and it is still open.Cleanup: the probe clone, the lane worktree and both probe background sessions are removed after this comment.
chore(work-items,source-control): bump versions and changelogs for is…
docs(work-items): recommend isolated-worktree launch for background l…
kyle-sexton commentedon Oct 1, 2026
Owner decision (2026-10-01): approved the recommendation ("go with recommended", the owner's reply to the batch decision page that listed this question and its recommendation).
Question: close #4598 as done on probe Run 2 plus the docs merged in #5549 and drop probe Run 1, or keep it open until Run 1 is run?
Chosen option A: close as completed and drop Run 1. Run 2 (isolated linked worktree) kept the Write in place, which was the condition for the doc edits, and #5549 shipped them. The docs already hedge the non-linked launch ("may have the Write refused or landed in an auto-created worktree"), so Run 1 cannot change the advice. The owner waives the Run 1 acceptance criterion.
Next: closing this issue as completed. If a lane later hits a refusal, reopen or file a new issue.