Repository navigation
Description
Goal
Make claim preparation, confirmation, and closure observations explicit in the plan helper. Preserve all refusal messages, ordering and public records. Check the reusable fake GitHub server for related correlated state, keeping independent scheduled events independent.
Yolo: the user delegated every decision except the merge to the agent.
Mode: plan-and-implement
Research
At 2120ef6e, types.ts PlanIssue represents one write with three independently optional fields. commands.ts readPlanIssue prepares a claim. github.ts refuseChangedIssue checks the snapshot owners, the viewer and any confirmed claim. writeIssueIfUnchanged checks the stored ID; claimBeforeClose and retirePlan separately clear the pending ID. writeReopen derives its claim from the guarded pre-write assignees. The final GraphQL read must match them before mutation, even if an intervening change only adds the acting viewer. The command verifies the single owner again before posting its comment. Its final assignment to confirmedOwner has no later reader.
Decision: distinguish a read-only issue from a prepared write. Carry the identified viewer in the latter. Represent an existing owner, a pending claim and a confirmed claim explicitly. Move pending-to-confirmed to the successful stored-ID check. Preserve acceptance of the pending viewer by ID or login, and check the login after confirmation. Keep the checked snapshot owners and the reopen path's final owner read: neither is interchangeable with the pending claim. Reject a shared global phase and independent optional flags; neither represents which identity each write must prove. This is a local representation change that the child PR can revert.
Closure evidence: github.ts latestCloser has either no event or an event with both its timestamp and its nullable closer. Null means that an event existed without an identified closer. An unselected connection and a selected empty one have the same observable meaning. Compare timestamps and the existing displayed closer exactly as writeReopen and settleAndReopen do now. Do not substitute object identity or strengthen GitHub compatibility checks. A merged PR guarantees a validated merge timestamp; only then is its own-merge evidence relevant. Retain the same malformed-response checks and their order even for unmerged PRs.
Decision: use one optional close-event object and the existing merged flag as the PR discriminator. Keep issue state/reason separate from the last close: a reopened issue can retain its prior event. Do not add a phase store or change GraphQL selection, pagination, write order, refusal text or dates. Near commands.ts createPlan, an unsupported parent flag leaves one pending link. Keep the fallback parent with the creation result, instead of a Boolean outside the request. Native linking, no parent and all other request failures must keep their behavior.
Coverage: inspected all nine modules under cli/src/plan. records.ts already derives explicit statuses from the remote state, labels and history; step statuses and frozen work remain independent. reviews.ts separates review kinds, archive cycles, grants and fence scopes. checkout.ts and bytes.ts model path traversal and byte recovery, not issue states. repository.ts resolves paths; services.ts supplies per-command process, filesystem and wait services. Connection cursors and read counts in github.ts are progress data, not authority. types.ts, commands.ts and github.ts own the confirmed candidates.
Fixture coverage: cli/test/fixtures/gh-stub/gh launches the fixture. state.ts describes independent scheduled events, sparse and deliberately malformed remote replies. ghStub.ts applies changes at read, mutation-field, comment, and close boundaries; different boundaries can occur in the same scenario. cli/test/lib/plan/harness.ts starts the real public CLI against isolated fixture state. Keep these independent mechanisms and representations; do not tighten test input shapes so that malformed replies become untestable. Checked the plan CLI suites, particularly children, archive, reopen, writes and status.
Verification skill detection: docks-kit agent-docs verify-skill detect printed verify skill: present. The skill has no plan-claims flow. Reuse the checked-in executable CLI scenarios instead of duplicating fixtures in a new flow. They already isolate remote writes, check stdout/stderr and stored issue data, and cover conditions a live issue cannot safely reproduce. No real issue is a test target.
Tool versions: Bun 1.4.5, Vitest 5.1.2, Node 26.13.0, Git 2.53.0, gh 2.103.3 and docks-kit 0.31.0 (local version commands); Effect 4.1.7 and TypeScript 7.0.2 (installed manifests). TypeScript narrowing supports the phase-specific fields. Existing repository schemas, not a new API or dependency, define which input is valid.
Steps
| # | Id | Task | Files | Depends | Effect | Status | Done when |
|---|---|---|---|---|---|---|---|
| 1 | ownership | Prepare writable issues with an identified viewer and confirm each pending claim from stored evidence | cli/src/plan/types.ts, cli/src/plan/commands.ts, cli/src/plan/github.ts | - | local | done | Read-only snapshots cannot authorize a write. Later writes reject lost or foreign ownership. Reopen derives its claim from pre-write owners and requires the final read to agree. |
| 2 | evidence | Couple close and merge evidence and carry the pending child link with its created issue | cli/src/plan/types.ts, cli/src/plan/github.ts, cli/src/plan/commands.ts | 1 | local | done | No consumer can see a closer without its event or use an unmerged PR as merge proof. Only a successful fallback create needs a separate link. |
Acceptance
| ID | Command | Expected |
|---|---|---|
| A1 | Inspect git diff origin/main...HEAD -- cli/src/plan and run bun run check:types |
No independent claimant, confirmed-owner or event-time fields remain. Write functions require a prepared issue. Existing, pending and confirmed ownership remain distinct. Only a successful fallback create result carries a pending parent link; no flag escapes the creation request. All callers narrow before reading variant-specific evidence. Types and Effect diagnostics pass. |
| A2 | bun run test:unit cli/test/unit/plan/write-gates.test.ts cli/test/unit/plan/write-postconditions.test.ts cli/test/unit/plan/status.test.ts |
Public plan commands preserve acceptance, exact refusal output, no-write conditions and stored ownership through a racing change, missing claim or successful claim. |
| A3 | bun run test:unit cli/test/unit/plan/children.test.ts cli/test/unit/plan/archive-closer.test.ts cli/test/unit/plan/archive-landing.test.ts cli/test/unit/plan/archive-retire-list.test.ts cli/test/unit/plan/reopen.test.ts |
Native and fallback creation link once; failure leaves the same evidence. Archive and reopen preserve read counts, read order, lost-claim handling, identity checks, direct/commit/unknown close, earlier close and pending-close behavior. Fixtures capture actual CLI output and remote writes locally. |
| A4 | bun run lint cli/src/plan/commands.ts cli/src/plan/types.ts cli/src/plan/github.ts and bun fmt --no-script --check cli/src/plan/commands.ts cli/src/plan/types.ts cli/src/plan/github.ts |
Both pass. Run the skill source-range guard if a citation references a shortened module. |
| A5 | Request Full CI on the reviewed PR, verify the authorized ready event and first-attempt run, then check the tested merge parents, the current PR head and base, and GitHub's accepted required check |
All jobs succeed. The tested merge has the expected base and reviewed head as parents. The Actions check that GitHub evaluates for merging is the same run's successful Full CI; the current PR reports CLEAN. Report the full local gate separately; do not count a remote result as local. |
Do not touch
Keep external CLI behavior, public issue records, auth rules, refusal precedence, protocol fields, compatibility modes and independent fixture schedules unchanged. Do not send test data to GitHub. No release, deployment, dependency upgrade or global transition framework.
Open questions
Verification Results
Candidate 3e1d72864b783016767782993854b826e2e0de70 on base 2120ef6ebaa82eff6b71e7ded58d6e9d01781a05. A1: writable issue and required viewer replace three optional ownership fields. Pending, assigned and confirmed states distinguish admission from proof. A complete close event, merged-only evidence and a pending link replace independent fields and flags. bun run check:types passed.
A2/A3: all 174 tests passed in the eight acceptance suites. They start the public CLI against isolated GitHub fixtures. A4: targeted Oxlint and Bun formatting passed on all three paths. No project skill cites these module paths. The full local gate did not run. A5 requires the reviewed pull request.
After round 1, 4aaf78f74ea064e967c6e23758739d9622843ef0 passed bun run check:types, scoped lint and formatting, and all 181 tests across the same eight public CLI suites. The new tests cover same-viewer reassignment between reads, pending and confirmed ID-only reads, unmerged response validation order, and the parent side of child linking. They use only the isolated GitHub fixture. Write reads always select label IDs when requested; the comment writer receives the single owner verified by the final read.
After round 2, dc3104a6bb3122a6c0991af4d70cb58cd8fb3b88 passed types, scoped lint and formatting and all 182 tests across eight CLI suites. The additional reopen case uses an assigned viewer and confirms that the body-only read does not consume the later assignee response.
A5: PR #276, head dc3104a6bb3122a6c0991af4d70cb58cd8fb3b88, base main at 2120ef6ebaa82eff6b71e7ded58d6e9d01781a05. The authorized ready event started run 46557006144 on its first attempt. All 10 jobs passed. Tested merge 21c26cd52e0d2d1bea45142f5c1429bcd28d08a4 has that base and head as parents. GitHub accepts the matching Actions job 142336125073 as its required Full CI; the PR reports CLEAN. The full local gate did not run.
Activity
DocksDocks commentedon Nov 30, 2026
Delegation grant: yolo: next up is a yolo issue for "scan this codebase for any implicit state machines and make it explicit"
Parent event: 7294751276
DocksDocks commentedon Dec 1, 2026
Delegation grant: yolo: do all issues remaining following yolo skill without asking please.
DocksDocks commentedon Dec 1, 2026
Plan review round 1
Plan-review: repair
ownership-writeReopendecides whether to claim from the assignees returned by the guarded pre-write read, not from the final GraphQL read. It first requires those two reads to agree (cli/src/plan/commands.ts:1110–1134). If the acting viewer becomes the assignee between them, the current command refuses without writing. Basing the decision on the last read alone would reopen without claiming - State that the guarded pre-write owners determine the claim, and that the final GraphQL read must agree before any mutation - class: wrong source of ownership evidenceevidence; Acceptance A1 - A1 does not check whether the successful fallback create result carries its parent. A partial implementation could leavelinkByRestunchanged incli/src/plan/commands.ts:319–350and still satisfy A1. A3's existing child tests check calls and stored results, which the old Boolean already produces (cli/test/unit/plan/children.test.ts:167–261) - Make A1 inspect the candidate's create result and require that only a successful fallback result carries the parent for the separate link - class: structural outcome absent from acceptanceAGENTS.md:69–73requires the full unit and golden gate at the pre-commit or release boundary. A successfulFull CIrun starts after the commit, when the PR is marked ready (.github/workflows/parity.yml:1–5), so it cannot satisfy the pre-commit requirement for this no-release plan - Require a passingbun run checkat the pre-commit boundary and keep the protected CI check separate - class: required pre-commit gate made optionalAGENTS.md:81requires that confirmation before asking to merge. GitHub can evaluate the current test merge commit instead of the PR head, so the run can be green while the merge box still reports the check as expected (GitHub required-check documentation) - Require A5 to verify the ready event, first attempt, tested commits, and that GitHub accepts the matching ActionsFull CIresult on the commit it evaluates - class: workflow success substituted for required-check acceptanceDocksDocks commentedon Dec 1, 2026
Plan review round 2, delta
Plan-review: pass
None.
Previous findings:
ownership: resolved - Both now say the guarded pre-write assignees determine the claim and the final GraphQL read must agree before any mutation.evidenceand Acceptance A1: resolved - A1 now checks that only a successful fallback creation returns a pending parent link and that no separate flag escapes the creation request.Full CIcheck.Manager response to round 1
Repaired:
Redesigned: none.
Rejected:
DocksDocks commentedon Dec 1, 2026
Self-review
Correctness: The active public callers preserve contract, viewer, labels and mutation ordering. Close comparisons still use timestamp and displayed closer. No behavioral finding.
Spec and tests: The eight isolated CLI suites passed 174 cases. They run the actual CLI and verify stored remote state. No separate fixture transition is needed.
Text and safety:
readWritablePlantypes its connection parameter asSnapshotOptions, which also exposes the read-onlyactingandnamesOnlycontrols. No current caller passes those controls. Narrow the parameter and reusable archive connections to the write read'sSnapshotConnections; keep names-only lookup withnew.DocksDocks commentedon Dec 1, 2026
Code review round 1, lens correctness
Code-review: pass
Standards
None.
Spec
None.
Code review round 1, lens spec-and-tests
Code-review: pass
Standards
reopenmust refuse without writing. The existing foreign-owner test would still pass if the exact owner comparison were removed, because the earlier foreign-owner check rejects that fixture. - Add anafterIssueViewOncecase that assigns only the acting viewer and asserts the settle refusal, a still-closed issue, and no writes. - class: untested same-viewer ownership racenot merged. Both unmerged tests supply well-formed responses and would pass if the new early return moved ahead of those checks. - Use the existing response override to assert the exact refusal and no writes for malformed unmerged responses, including which error wins when both fields are malformed. - class: untested malformed-response precedencesubIssues. It still passes if the issue is wrongly attached to an existing parent, because the fixture stores the link on that parent. - Seed a possible parent and assert that creating a plan without--parentleaves it unlinked. - class: assertion checks wrong side of relationshipSpec
reopensuccessfully claims an unassigned plan, it verifies the stored viewer ID and the final sole owner, but passes the originalpendingissue to the comment writer. The runtime guards still work, but the representation does not follow the plan's decision to "Move pending-to-confirmed to the successful stored-ID check." - Represent the checked claim locally and pass verified reopen evidence to the comment writer after the final owner read, without restoring an unread assignment or changing the read order. - class: confirmed claim still represented as pendingCode review round 1, lens text-and-safety
Code-review: pass
Standards
readWritablePlanaccepts the read-onlynamesOnlyoption and passes it through to the write query and label decoder. If a caller reuses the options fromnew, the write read silently omits label IDs. Inference:statusorreopencould then try to create a phase label that already exists and fail. The current edit, status, step, archive, retire, and reopen callers and their CLI fixtures do not pass this option; onlynewuses it. - Narrow the write call sites toSnapshotConnectionsand make the write adapter select and decode label IDs explicitly. - class: read-only option leaks into write pathreadPullRequestreturns only its number andmerged: false, but the comment still describes the PR body and whether it closes the plan as part of the result. Archive and reopen already narrow correctly. - Document which fields are returned only for merged pull requests. - class: stale return contract commentSpec
None.
DocksDocks commentedon Dec 1, 2026
Code review round 2, delta
Code-review: pass
Previous findings
retire. The fixture uses the same node ID for the viewer and the loginless assignee.Standards
closesPlanBoolean, whichreopenuses to decide whether there is anything to reopen. - Say the merged result reports whether GitHub lists the plan among the issues the pull request closes. - class: stale return contract commentreopen's initial body-only view consumes it before JSON field selection. Inference: the later assignee read would then receive the normal login, so a test could miss the intended identity check. Only the tworetirecases arm the option today, and their target views select assignees. The option documents a view that lists the viewer as an assignee. - Consume the override only when the response includesassignees. - class: one-shot response override consumed before field selectionSpec
None.
Manager response to round 1
Commit
4aaf78f74ea064e967c6e23758739d9622843ef0contains the following repairs. All 181 tests in eight CLI suites passed at this head.Repaired:
commands.ts:1133–1153: the reopen CLI scenario exercises an intervening change to the acting viewer alone. Neither the earlier foreign-owner guard nor a missing mutation can satisfy the assertion.github.ts:974–989: unmerged responses with malformed closing references and merge data exercise decoder ordering through the public CLI.github.ts:799–817: check pending versus confirmed ownership using the fixture's legitimate viewer ID without a login on the pre-write read.children.test.ts:188–202: inspect the possible parent's stored links, not the new issue's children.commands.ts:1217–1243:postReopenCommentreceives the verified owner from the final read, not a pending plan. The recovery timestamp still belongs to the observed close. No extra read or write.commands.ts:198–203,github.ts:609–615: write reads select IDs explicitly. Query construction and decoding use the same selection; only read-only callers can ask for names.github.ts:957–958: document the distinct unmerged and merged results.Redesigned: none.
Rejected: none.
DocksDocks commentedon Dec 1, 2026
Code review round 3, delta
Code-review: pass
Previous findings
closesPlanBoolean returned at lines 1016-1019, not the closing references used to compute it.assignees. The public CLI test at cli/test/unit/plan/reopen.test.ts:833-848 checks that the body-only read leaves the override for the pre-write read, which refuses without reopening or writing.Standards
None.
Spec
None.
Manager response to round 2
Commit
dc3104a6bb3122a6c0991af4d70cb58cd8fb3b88addresses both findings. All 182 CLI tests passed at this head.Repaired:
github.ts:969–970: documentclosesPlanas the Boolean decision it actually returns.ghStub.ts:1343–1357: select the response fields before applying the one-time omission. A publicreopentest uses its real body-only view followed by an assignee view and checks the refusal, closed issue and empty write log.Redesigned:
closed.some(...). Document only the Boolean's repository-scoped meaning; the discriminated return type already defines the shapes. No public behavior changes.Rejected: none.
DocksDocks commentedon Dec 1, 2026
Archived with landing pull request #276