Repository navigation
Credit a running OpenCode subagent in the co-authorship check - #2807
Merged
Merged
Conversation
liveTaskFilesInCommit read only transcripts on disk, and a running OpenCode child has none until its stop hook exports it, so an IDLE parent whose background child wrote a file another session also claims was skipped as read-only. Agents can now report what a running subagent call has modified (agent.LiveSubagentFileReporter). OpenCode exports the child to a private staging file, cuts it to the running call and removes it, writing nothing a capture reads. Post-commit gives all subagent exports one 30s budget and the co-authorship checks a 10s share of it, so they cannot starve condensation's re-exports. The gate is memoized per session. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M53CTW9M0EBHK204XGKMCH71
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Live probes can incorrectly credit unsuccessful edits and bypass repository-resolution safety checks.
2 open issues
What changed in this PR
Enables Entire CLI to credit an idle OpenCode parent when its running subagent modified files committed alongside another session.
Changes:
- Adds a private, call-scoped live subagent probe.
- Shares export budgets across post-commit processing and memoizes co-authorship checks.
- Adds regression tests and updates documentation.
| File | Description |
|---|---|
| docs/architecture/sessions-and-checkpoints.md | Documents live-task co-authorship. |
| cmd/entire/cli/strategy/manual_commit_task_fetch_test.go | Tests reporting and budget limits. |
| cmd/entire/cli/strategy/manual_commit_hooks.go | Integrates budgeted, memoized probes. |
| cmd/entire/cli/integration_test/opencode_subagent_test.go | Tests running-child co-authorship. |
| cmd/entire/cli/integration_test/hooks.go | Adds configurable transcript timestamps. |
| cmd/entire/cli/agent/subagent_fetch.go | Shares deadline handling between fetch operations. |
| cmd/entire/cli/agent/opencode/subagent_export.go | Implements private live exports. |
| cmd/entire/cli/agent/opencode/subagent_export_test.go | Tests call scoping and staging cleanup. |
| cmd/entire/cli/agent/opencode/lifecycle.go | Asserts reporter interface implementation. |
| cmd/entire/cli/agent/opencode/AGENT.md | Documents probe behavior and budgets. |
| cmd/entire/cli/agent/capabilities.go | Adds built-in reporter capability lookup. |
| cmd/entire/cli/agent/agent.go | Defines the live file-reporting interface. |
Review effort: Balanced
- Kill the export's whole process group on cancel. opencode's npm launcher runs the real binary with inherited stdio, so a hung export outlived the co-authorship check's 10s share (42s in a repro). - The live probe counts only completed tool parts: a pending, running or failed edit is no evidence the subagent changed the file. - Document that a running subagent credits its session again on a later commit of the same file, as Claude's on-disk transcripts already do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M5AWNAYJYQGEFQMV87JK61FE
The read-only gate asked the live task records only for an IDLE session. A parent that keeps working after launching a background subagent is ACTIVE, so with another session claiming the committed file it was dropped although its running child wrote that file (an OpenCode parent's live transcript does not include its children). The evidence now comes from hasFreshLiveTaskRecord, any phase but ENDED; idleWithLiveTaskRecord still alone decides when to skip the overlap check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M5BB580JKSNB5YS2N45HC2E8
This was referenced Oct 20, 2026
…iew fixes - Post-commit set one 30s subagent fetch budget for the whole commit, so a second session condensing completed OpenCode tasks could find it spent and lose their transcripts. Only the co-authorship checks' 10s deadline is now commit-wide; each condensation keeps its own 30s, as on main. - LiveSubagentModifiedFiles returns the worktree error instead of falling back to the CWD. - One mockExportName helper holds the ENTIRE_TEST_OPENCODE_MOCK_EXPORT hook and its file name for both export paths. - Test the read-only gate's running-subagent credit for an ACTIVE parent of any agent; note what a forced second Ctrl-C leaves behind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M5DHSAQ4BW7BT4NRMKDWFDMH
…author # Conflicts: # cmd/entire/cli/strategy/manual_commit_hooks.go
The prepare-commit-msg check for a foreign session's running subagent could run an agent export per live task record with no deadline, so a slow or hung export held up git commit; this branch also widened that check to ACTIVE sessions. It now shares the commit's co-authorship deadline, as post-commit does, and never extends one already set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M5E15XYD0DXHVD121CAVH76N
Soph
approved these changes
Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

https://entire.io/gh/entireio/cli/trails/1602
An OpenCode session whose background subagent is still running can now be credited for a commit that another session also claims, whether the parent is IDLE or still in its turn (ACTIVE).
A running subagent's edits reach the parent's tracked files only when it stops. Until then, post-commit's read-only gate asks the live task records whether they touched a committed file (
liveTaskFilesInCommit). It read only transcripts on disk, and a running OpenCode child has none (its transcript exists only throughopencode export), so the parent was skipped as read-only and the commit lost its link to that session.Changes
agent.LiveSubagentFileReporter: reports the files a running subagent call has modified so far. OpenCode implements it by exporting the child to a private staging file, cutting it to the running call, and removing it. Only completed tool parts count: a pending, running or failed edit is no evidence. It writes nothing a capture reads, so a report that finishes after the call's stop cannot replace the stop's complete transcript.liveTaskFilesInCommituses the reporter for a live record with no transcript on disk. A report that fails, or runs out of budget, is no evidence.agent.SubagentFetchBudget), as onmain.sync.OnceValue), since each consultation may export.git commiteither.hasFreshLiveTaskRecord: any phase but ENDED), for every agent. A parent keeps working after launching a background subagent. For OpenCode this is what credits it at all, since its live transcript does not include its children; for Claude and others it applies when the parent's own transcript does not yet show the subagent's files and its on-disk transcript names a committed file. When to skip the overlap check is unchanged (idleWithLiveTaskRecord, IDLE only).AGENT.mdandsessions-and-checkpoints.md, including that a still-running subagent credits its session again on a later commit of the same file (as Claude's on-disk transcripts do on main).A commit made outside the parent's agent process (a terminal, another window) goes through #2668's foreign-session checks. #2668 has merged, and this PR switches both of them (the prepare-commit-msg staged-file overlap and post-commit's
liveTaskCoauthored) tohasFreshLiveTaskRecord, so an ACTIVE parent's running subagent counts there too, as #2668 already allowed for an IDLE one.This redoes the co-authorship part cut from #2390, rebuilt on what landed there:
readTaskTranscriptno longer re-exports live records, so the check uses its own non-writing probe instead.Tests
Live-tested with OpenCode 1.18.33 (
opencode serve, gpt-5.6-luna): an IDLE parent whose background child rewrote a file the coder session also claimed, committed while the child was still running: main 1 session, this PR 2; with Keep a running agent's session off commits it did not make #2668 merged in, also 2 (both sessions foreign). With Keep a running agent's session off commits it did not make #2668 merged in, also: an ACTIVE parent (still in its own turn) is credited (2 sessions), and a parent alone gets the trailer when its running child's file is committed.TestOpenCodeSubagentRunningChildCoauthorsCommit(integration): an IDLE parent with a running child that wrote a file another session claims is condensed into the commit. Fails without the change.TestLiveTaskFilesInCommit_AsksTheAgentForARunningSubagent: committed file, other files, failed report, spent budget.TestCommitFetchBudgets_CoauthorshipGetsAShare.TestLiveSubagentModifiedFiles_WritesNothingACaptureReads: reports only the running call's files and leaves nothing under.entire/tmp.TestOpenCodeSubagentRunningChildCoauthorsCommit_ActiveParent(integration): the same with the parent mid-turn. Fails without the change.TestHasFreshLiveTaskRecord_AnyPhaseButEnded.TestShouldCondense_RunningSubagentCreditsAnActiveParent: the read-only gate for an ACTIVE parent of any agent.TestCommitFetchBudgets_CondensationKeepsItsOwnBudget: condensation still re-exports after the co-authorship deadline has passed.TestCompletedToolParts_DropsUnfinishedEdits.TestRunOpenCodeExportToFile_CancelKillsTheLaunchersChild: a launcher-style fake returns at the deadline (30s without the fix).TestForeignCommit_RunningOpenCodeSubagentLinksActiveForeignParent(integration): an ACTIVE OpenCode parent, foreign to the commit, is credited through its running child. Fails without the switch tohasFreshLiveTaskRecord.TestCommitFetchBudgets_PrepareCommitMsgIsBounded.Diff: +675/−45 across 16 files.
🤖 Generated with Claude Code
Note
Medium Risk
Touches post-commit session linking and runs live
opencode exportduring commits with time budgets; incorrect attribution or budget starvation could mis-link checkpoints or skip co-authorship, but failures degrade to “no evidence” rather than hard errors.Overview
Post-commit can now treat an IDLE OpenCode parent as a co-author when a still-running background subagent has already edited files in the commit, even though those edits are not in
FilesToucheduntil the child stops.Adds
LiveSubagentFileReporterand OpenCode’sLiveSubagentModifiedFiles, which runs a scopedopencode exportinto a private staging file (no writes to.entire/tmpcache or the call’s declared transcript).liveTaskFilesInCommitfalls back to that probe when a live task record has no on-disk transcript; failed or budget-exhausted reports count as no evidence.Subagent fetch budgeting is refactored (
WithSubagentFetchDeadline, sharedsubagentFetchContext); each commit gets a 30s export budget with 10s reserved for co-authorship checks. The live-task gate is memoized per session viasync.OnceValue.Docs (
AGENT.md,sessions-and-checkpoints.md) and tests cover the running-child commit case, budget splitting, and the no-persistent-writes guarantee.Reviewed by Cursor Bugbot for commit 6c5727f. Configure here.