Skip to content

Let the assistant read the panes it launched, and stop teaching handback on commands - #13445

Merged
gregpriday merged 5 commits into
developfrom
feature/issue-13439-tighten-the-work-batch-skill-and-stop
Oct 16, 2026
Merged

gregpriday merged 5 commits into
developfrom
feature/issue-13439-tighten-the-work-batch-skill-and-stop

Conversation

@gregpriday

Copy link
Copy Markdown
Collaborator

Summary

  • The help assistant can read the last message of the panes it launched again. Since fix(mcp): let the help assistant read the last message of panes it can already type into #12883 its terminal.readLastMessageOwned went only by pinned-view membership and ignored the ownership ledger, so when that check answered no for a pane it had launched (as it did three times in the 2026-10-16 batch drain), the read was refused even though terminal.list and terminal.close worked. A pane this session created is now admitted by the ledger, as every other session's read is; the view check is asked only about panes it didn't create, and a hand-over still never admits this read.
  • Every pinned-view refusal now logs which side refused (no-view-workspace, unwired, not-in-workspace, view-changed, lookup-failed), with the session and terminal ids only. The transcript, the audit ring and the main log didn't say which part of the check failed in that run, so the next one will.
  • The assistant templates no longer teach handback on every launch and send. A slash command or skill takes no handback, since Daintree's instruction would join its arguments; its marker or screen shows the end, and an earlier stop is no reason to nudge. Without handback a notice fires once per arm, so the assistant re-arms terminal.notifyWhenIdle once the agent reads working again, the only state it arms in.
  • The work-batch skill names daintree.orchestration.work-in-waves (fix(runbooks): teach a user's own batch workflow in merge-gated waves assistant-backend#156) as the runbook that owns its rounds instead of asserting what its search query selects, and gives the exact gh issue view --json labels,title plus two jq reads for branch names. Splitting @tsv with IFS read collapsed an empty labels field and produced feature/issue-13382-.

Resolves #13439

Changes

  • sessionServer.ts: the ownership gate computes the ledger record for every origin; for the assistant's read the view is consulted only when there is none. Adoption is still excluded for this read.
  • httpLifecycle.ts: isTerminalInPinnedWorkspace logs a reason code on each refusal through a new main:McpPinnedView logger.
  • scripts/assistant-src/SHARED.tasks.md → regenerated assistant/CLAUDE.md and assistant/AGENTS.md. The Common Tasks lines were tightened to pay for the new guidance: both files stay under the 8,100-byte ratchet (8,053 and 8,099 bytes, four above where they were). Sentence prompts keep handback: true.
  • .daintree/assistant/.claude/skills/work-batch/SKILL.md: runbook ownership and the branch-name commands. Teardown is unchanged.

One review finding I left alone: a closed pane's ledger record isn't released by terminal.close, so a pane another project later launches under the same requestedId would be readable by this help session. Reaching it takes a plugin choosing that exact id, plugins are unsandboxed anyway, and the assistant has shell access to the same transcripts, so the pinned view is a scoping policy rather than a security boundary here. Every other session already reads by this ledger.

Testing

  • sessionServer.test.ts: the help and assistant-pane origins read a pane they created while the view check refuses, without asking the view; a pane they didn't create is still refused when the check is unwired; a hand-over is never admitted, including with the view refusing (this test fails if the adoption guard is removed).
  • httpLifecycle.test.ts: each refusal logs its reason once, and an admission logs nothing.
  • build-assistant-prompts.test.mjs: both prompts keep handback for sentences, drop it for commands and skills, carry the re-arm and no-nudge rules, and stay under the size ratchet.
  • 920 targeted tests pass locally across sessionServer, httpLifecycle, terminalStatus, build-assistant-prompts and helpSessionProjectMetadata; check:assistant reports no drift; Prettier and ESLint are clean on the changed files (the remaining warnings are on lines this PR doesn't touch). A scoped typecheck of the changed electron/ files is clean.
  • The skill's jq reads were run against an unlabelled issue, a bug label among others, a missing labels key, punctuation, non-ASCII and emoji-only titles, and titles over 40 characters.

…iew check says

- terminal.readLastMessageOwned from the help assistant admits a pane this
  session's ledger created, as every other session's read does; the
  pinned-view check is asked only about panes it did not create
- a hand-over still never admits this read
- each pinned-view refusal logs which side refused (view workspace,
  unwired, not in the workspace, view changed, lookup failed), since the
  refusal the assistant sees is uniform
- Common Tasks no longer shows handback on launchMany and sendCommandMany
- a slash command or skill takes no handback, since its instruction would
  join the arguments; its marker or screen shows the end, and an earlier
  stop is no reason to nudge
- without handback a notice fires once per arm, so re-arm
  terminal.notifyWhenIdle when the agent resumes
- both prompts stay under the 8,100-byte ratchet (8,050 and 8,096 bytes)
…reads in work-batch

- daintree.orchestration.work-in-waves owns the rounds, with
  daintree.foundation for the mechanics; the search stays as how they load
- branch prefix and slug come from one gh issue view --json labels,title
  and two jq reads, never IFS read over @TSV, which collapsed an empty
  labels field into feature/issue-<n>-
…ule in work-batch

- Common Tasks says a sentence takes handback and a slash command or skill
  none, and qualifies waitForReply as the short wait; still byte-neutral
  (8,050 and 8,096 bytes)
- the work-batch skill follows what its one runbook search selects, takes
  the rounds from itself when work-in-waves isn't among them, and no
  longer claims an older catalog from a missing result
- a title with no ASCII letters or digits gets the slug untitled
- test that a hand-over never admits the assistant's read, and correct two
  comments that still described the view as the whole boundary
…s working

- terminal.notifyWhenIdle arms only while the target reads working, so
  Common Tasks says so instead of 'when it resumes' (8,053 and 8,099 bytes)
- the read gate comment no longer says other owned tools use the ledger
  alone; several accept a hand-over
@gregpriday
gregpriday marked this pull request as ready for review October 16, 2026 15:02
@gregpriday
gregpriday merged commit 3c3169a into develop Oct 16, 2026
13 checks passed
@gregpriday
gregpriday deleted the feature/issue-13439-tighten-the-work-batch-skill-and-stop branch October 16, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tighten the work-batch skill, and stop the assistant templates teaching handback on commands

1 participant