Repository navigation
fix: decisions name their full target; refuse stale-tab decisions on a reused port - #1729
Merged
Merged
Conversation
…ion_mismatch)
Each plan, annotate and review server (Bun and Pi) issues a random
serverSession nonce, advertised on /api/plan and the diff payloads. The
editor and review editor echo it on every decision (body, or ?serverSession=
on /api/exit); a server holding a different nonce answers 409
{ code: "session_mismatch" } before claiming or settling anything, and the
tab shows a reload prompt. A decision without the field (older clients) is
still accepted.
…, list targets in sessions A bare approval for releases-2026-10-04/QUESTIONS.md arrived as 'Plannotator: QUESTIONS.md — Approved.' with no path, and the agent took the File: line of an earlier decision about a different QUESTIONS.md. - The CLI names what it opened, in full, from its own state: target on the host result record, the ready line, the non-strict annotate --json and opencode-review records, and the sessions registry. - plannotatorDecisionHeading/plannotatorToolOpenedText take the target (Target: line); shared contract + mod copy, Pi and OpenCode 2 pass it. - The mod stores the target on its LaunchRecord (ready line, else its own resolution) as the fallback for older CLIs and logs when they differ. - plannotatorDistinctSubjects tells same-named open reviews apart. - plannotator sessions: pn- id + full target column, --json.
…dentity # Conflicts: # AGENTS.md # apps/hook/server/annotate-host-result.test.ts # apps/hook/server/annotate-output.ts # apps/hook/server/host-result.test.ts # apps/hook/server/index.ts
…dentity # Conflicts: # apps/hook/hooks/mod/controller.ts # packages/editor/App.tsx
…api/pr-action - Both review servers put the ACTIVE target on the decision (the PR URL after an in-place /api/pr-switch, the workspace root, or the working tree the active diff reads); the CLI record, opencode-review and Pi use it, and a decision about another PR is headed with that PR (plannotatorDecisionSubject). - The mod's old-CLI fallback target only takes what the words state exactly (URL, PR URL, absolute path, a review with no words); bare and relative names and review prose get no Target line. - /api/pr-action echoes and checks the serverSession nonce in both runtimes. - Docs: the non-strict --json dismissed record now carries target.
This was referenced Oct 6, 2026
1 task
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.
Problem
The pando-ops report: a reviewer approved
releases-2026-10-04/QUESTIONS.md. The approval reached the agent asPlannotator: QUESTIONS.md — Approved.\n\nThe user approved., with no path in it. The agent took theFile:line from an earlier feedback message about a differentQUESTIONS.mdand worked on the wrong file. The server's own records were correct.Root causes:
subjectForin the mod,annotateSubjectin Pi and OpenCode.plannotatorDecisionHeadinghas no target.annotateHostRecord).There is a second, separate bug. A stale tab on a reused port can approve a different file, because the decision POST carries no identity. A reused port happens with a fixed
PLANNOTATOR_PORT, with remote mode's 19432, or when a random port is reused. Reproduced: the new server accepted{ draftGeneration: N }.Changes
1. Every decision names its full target, as the server that decided resolved it
apps/hook/server/decision-target.ts):targettoHostResultRecord: the absolute file or folder, the URL, the bundle's files in order, the reviewed directory, patch file or PR URL, or the plan file. Annotate-last has no target.targetto the ready line (ServerReadyMetadata.targetviasetServerReadyTarget).--jsonrecord and theopencode-reviewrecord. Both changes are additive.The user approved.) and the strict-gate record are unchanged.packages/shared/plannotator-tool.ts; the mod copy stays byte-identical, guarded bytool.test.ts):plannotatorDecisionHeading(subject, id, outcome, target?)adds aTarget: <path>line after the heading. A bundle gets aTargets:line followed by one- <path>line per file.plannotatorToolOpenedText(..., target?)adds the same line.plannotatorTargetLines,plannotatorSameTarget,plannotatorDistinctSubjects.LaunchRecord.targetcomes from the ready line. For a CLI older than this change it falls back to the mod's own resolution of the words against the session directory, whichprivateDirArgvnow prints withpwd.$.ui.logline saying so.PLANNOTATOR_HOST_REVIEW_ID.targetfor annotate, review and plan reviews, andwithDecisionHeadingand the tool's opened text use it.File:line now uses the CLI's resolved path instead of the raw words.PLANNOTATOR_HOST_REVIEW_ID.2. Same-named open reviews are told apart
plannotatorDistinctSubjectsgives each one the shortest path tail that is unique. Example:releases-2026-10-04/QUESTIONS.mdandreleases-2026-09-20/QUESTIONS.md. A subject such aschanges in webkeeps its words and becomeschanges in a/app/web. The new names show in headings, the status line and toasts in the mod, Pi and OpenCode 2.3. Stale-tab guard (
session_mismatch)serverSessionnonce when it starts. This covers Bun and the Pi mirrors./api/planand on the diff payloads./api/exitas?serverSession=.409 { code: "session_mismatch" }before it claims or settles anything. The tab then shows "This review was replaced — reload".packages/core/server-session.tsand in AGENTS.md.4.
plannotator sessionsSessionInfogetsreviewId(thepn-id) andtarget.--jsonoption prints the list as a JSON array on stdout.Compatibility
#1728approve-with-note change is merged in.formatAnnotateOutcomenow takes its notes context and the target through one parameter.Tests
apps/hook/hooks/mod/targets.test.ts:pn-id reaches the CLI's environment.apps/hook/server/host-result.test.tsanddecision-target.test.ts: the target field on records.apps/hook/server/annotate-host-result.test.ts: a real process checks the ready line, the registry,sessions --json, the table and the record.packages/shared/plannotator-tool.test.ts: target lines,plannotatorDistinctSubjectsandplannotatorSameTarget.packages/server/server-session-guard.test.ts: 409 on a wrong nonce, accept on a match, accept when the nonce is missing. Covers Bun and Pi for plan, annotate and review.ServerSessionReplacedBanner.test.tsx: DOM test, added to the DOM_TESTS list.Results:
bun teston apps/hook, opencode-plugin, pi-extension and packages/{shared,server,core,ai}: 4337 pass, 2 skip, 0 fail.bun run typecheckis clean.scripts/test-claude-code-mod.sh, with a temporaryCLAUDE_CONFIG_DIR): 17 pass.Not changed