Repository navigation
Description
Problem
Slice 05 of #327 ports the writer report at packages/agents/source/skills/write-prose-fix/shared/scripts/context.sh:25. Full findings, notes and numbered text must remain in the writer's context rather than the caller summary.
Acceptance criteria
- AC1: Outside Git or without workflow evidence, context emits the corresponding BLOCKED message and exits 0.
- AC2: A target mismatch emits the existing target-specific BLOCKED message and exits 0.
- AC3: Nonempty run-specific notes appear instead of legacy notes.
- AC4: When run notes are absent or empty, nonempty legacy notes appear.
- AC5: The valid report retains section order and numbered document text.
- AC6: Partial output from a failing lint command appears in findings with report status 0.
- AC7: A silent lint command produces the existing empty-output marker.
- AC8: When Vale is absent, both probe sections contain the existing unavailable notice.
- AC9: When Bash cannot start, findings contains one executor-unavailable BLOCKED line and later sections still follow.
- AC10: Non-functional: read-only fixtures leave the document and evidence unchanged.
- AC11: Non-functional: native context cases pass on macOS, Linux and Windows.
- AC12: For the missing-target, omitted-lint, command-terminator, Vale scope and replacement-count fixtures in Verify plan, the complete report matches the existing shell output and exit status, including BLOCKED, ERROR, UNSCOPED, Covered and Unknown explanations and counts of matching lines rather than occurrences.
Scope and non-goals
Add agentrepo prose context, retaining the command boundary at --, distinct state checks, scope explanations and replacement-line counting. Non-goal: editing prose, running replacements or writers, broader permissions, stronger state policy, caller switches or frozen-file changes. No new shell logic. Canonical sources generate the packages and deployments; generated copies are never edited by hand. No edits to shared libraries, guard scripts, merge scripts, ownership rules, workflow files or harness configuration.
Approach
Reuse #889's probe/executor helper while preserving the reports' different text and stopping rules. Use the concrete Verify plan fixtures to record omitted lint, missing file, empty notes, command terminator, valid/error scope probes and replacement counts against the shell before porting those branches. Do not substitute another template or count occurrences instead of lines.
Observed: outside Git and missing state returned BLOCKED/0; target mismatch named both documents and returned BLOCKED/0. A valid run printed numbered second draft and partial lint note despite a failing lint command, with report status 0. true produced (nothing). Notes printed current decision while legacy old decision existed; absent or empty run notes select the legacy notes through the shell fallback; the absent-notes run printed old decision. With Vale absent both final probe sections printed (vale not on PATH). Executor-start failure is the explicit new outcome from #889, not claimed frozen-shell parity.
Dependencies
Blocked on: #886
Blocked on: #889
Blocked on: #753
#886 supplies workflow evidence, #889 supplies the probe/executor helper, and #753 blocks this issue because its agentrepo subcommand registration path must be available for this command. #321 owns the shared launcher; #333/#544 are rollout-only prerequisites for #892. Keep these dependencies recorded in prose; changes to native dependency links wait on #655. This draft changes no native relationships.
Size
M. Existing context report: 101 scc code lines. Counts use scc 4.1.0; generated package/deployment output and token metadata are excluded, while source, tests, fixtures and frozen copies count. One PR with fewer than 800 changed code lines and at most 2,000 prose lines. No unbuilt Go size is claimed: measure the actual staged diff before publication and split again if the cap is exceeded.
Verify plan
Run go test ./internal/agentrepo -run '^TestProseContext' -count=1 -v for every fixture below. Compare complete stdout, stderr and exit status against the original shell for AC1 through AC8 and AC12; the planned fixtures are the contract to implement, not claims of completed tests. Baseline: a temporary Git repository, matching nonempty workflow target evidence for draft.md, document bytes first line\nsecond draft\n, no notes, an available Bash executor, lint command true, and Vale absent. Unless a row overrides them, retain these inputs. Shell-parity fixtures expect report status 0 and empty stderr; diagnostics from lint and Vale appear inside stdout. Capture full outputs to check exact text, blank lines, section order and line-number spacing.
For invocation checks, use a lint stub that appends one entry to a fixture-only call log and creates a fixture-only sentinel. An early refusal must leave both absent, proving lint never ran. Keep stub effects separate from the document and workflow evidence inventories.
- AC1: fixtures
outside-git,state-not-supplied,state-directory-missing,target-evidence-absentandtarget-evidence-emptyuse the named input, each with the lint sentinel stub supplied. Outside Git emits onlyNot a git repository. Report BLOCKED.; the other four emit onlyNo fix-prose workflow state was supplied. Report BLOCKED and stop.. Each exits 0 with empty stderr and no lint call log or sentinel. - AC2: fixture
target-mismatchsupplies targetdraft.mdand evidence whose first line isother.md; expect onlyWorkflow state belongs to other.md, not draft.md. Report BLOCKED and stop., status 0, empty stderr and no lint call log or sentinel. - AC3: fixture
run-notes-winsupplies run notescurrent decisionand legacy notesold decision; expect the caller-notes section containing onlycurrent decision, with no legacy text. - AC4: fixtures
run-notes-absentandrun-notes-emptyrespectively omit the run notes file and supply a zero-byte file, each with nonempty legacy notesold decision; both emit the caller-notes section containingold decision. - AC5: fixture
ordered-numbered-reportuses the baseline document and run notescurrent decision; expect sections in this order: target, caller notes, numbered document, findings, silence/coverage explanation, replacement explanation. Assert both document lines with the shell's five-column numbers and two-space separator. - AC6: fixture
partial-failing-lintuses lint that printspartial stdoutto stdout andpartial stderrto stderr, then exits 7; expect both lines in findings in that order, no report stderr, later sections retained and report status 0. - AC7: fixture
silent-lintuses executedtrue; expect(nothing)in findings, later sections retained and report status 0. The call-log variant records exactly one successful lint invocation, distinguishing execution from an executor-start failure. - AC8: fixture
vale-unavailableexcludes Vale from the controlled search path while retaining Git, Bash and other report prerequisites; expect(vale not on PATH)once in each of the last two sections. - AC9: fixture
bash-start-unavailableretains Git and matching evidence but removes Bash from the supported executor search path; expect exactly one executor-unavailable BLOCKED line in findings, the later sections in their normal order, report status 0 and no lint call log or sentinel. This is the new helper outcome, not shell parity. - AC10: fixture
read-only-artifactsruns the baseline and each notes variant withtrueand controlled read-only Vale stubs; compare before/after path inventories, file bytes and modes for the document, workflow evidence and legacy notes. Expect no changes. Record call-log/sentinel effects only in separate invocation fixtures; supplied lint commands retain their own side effects. - AC11: execute this same fixture suite natively on macOS, Linux and Windows, using supported Bash, including Git for Windows Bash on Windows. Record the actual native platform and shell-oracle environment, command, status and results for each; skips and cross-compilation do not satisfy the native criterion.
- AC12: use every row of the following fixture matrix. All rows require exact full shell/Go output equality, empty report stderr and status 0, including the stated branch outcome. A controlled Vale stub distinguishes the scope invocation from the document-count invocation, verifies its arguments and captures scope stdin to assert the shell's exact known-bad control text. Scope-only rows give the count invocation no findings/status 0; count-only rows give the scope invocation one digit-led finding/status 1.
| Fixture | Exact input change | Required report outcome |
|---|---|---|
| missing-target | Evidence still names draft.md, but that document is absent; supply the lint sentinel stub. |
Target header followed by No such file. Report BLOCKED and stop.; no later sections, call log or sentinel. |
| omitted-lint | Supply target and state with no lint words. | Header says lint: (none given); findings say No lint command given. Report BLOCKED and stop.; both probe sections still follow. |
| command-terminator | Supply lint words printf lint-before, then --, then printf ignored. |
Header and executed findings contain only the pre-terminator command and lint-before; ignored never appears. |
| scope-error | Scope Vale prints scope failure to stderr and exits 2. |
ERROR names exit 2, explains that neither silence nor the probe measured the document, indents the diagnostic and ends with Report BLOCKED.. |
| scope-unscoped-0 / scope-unscoped-1 | Scope Vale emits no bytes and exits 0 or 1 respectively. | UNSCOPED names draft.md, explains that no styles load and a clean run proves nothing, and says Report BLOCKED.. |
| scope-covered-0 / scope-covered-1 | Scope Vale emits 1: first\n2: second\nnotice\n and exits 0 or 1 respectively. |
Covered reports exactly 2 findings and explains that rules are live and silence would be real. |
| replacements-zero-0 / replacements-zero-1 | Count Vale emits finding without correction\n and exits 0 or 1 respectively. |
0 of the vale findings carry a replacement. with no replacement command. |
| replacements-lines-0 / replacements-lines-1 | Count Vale emits 1: replace_with=a replace_with=b\n2: replace_with=c\n3: no correction\n and exits 0 or 1 respectively. |
2 of the vale findings carry a replacement. followed by Clear them first with: and mise run fix-prose-replacements draft.md; two matching lines count as 2 despite three tokens. |
| replacements-error | Count Vale prints count failure to stderr and exits 2. |
Unknown names exit 2, explains why a zero count would be wrong, and includes the indented diagnostic; no numeric replacement claim or replacement command. |
At the merged head, cite every AC ID with its command and result in PR Verification, including native execution and any skips. Required checks must pass without weakening gates. Obtain independent approval of the exact merged head and record every finding's disposition. Pass repository leak scans and review and scan each issue/PR post before any later publication. Use signed commits with Assisted-by trailers and the provenance:agent-assisted label. Match documentation to behavior. Measure the final diff against the Size caps. File any follow-ups as issues and list them under Related in the PR. Close this issue through the merge, set its board Status to Done, and post a final Status: comment naming the merge commit and closing reference. This draft authorizes no publication.
Risks
Changing notes precedence can revive an old instruction, and altered replacement counts can promise nonexistent fixes. Undo: revert this additive command; the original context and its evidence remain.
Operator authority
None
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Work type
Projects
- StatusShow more project fieldsBacklog
Activity
tbhb-agent commentedon Oct 27, 2026
Refinement: READY — Gather the prose writer's context in Go
Model: gpt-6-astra
Child 05 Gather the prose writer's context in Go
Verdict: READY
Checked: The round 1 gap is closed. AC6 consumes 04’s executor contract, distinguishes startup failure from empty command output, and specifies continuation into later sections. Verification includes actual supported-Bash execution with quoting and operators on every platform. Notes precedence, command assembly and probe reporting remain consistent with
packages/agents/source/skills/write-prose-fix/shared/scripts/context.sh:36,packages/agents/source/skills/write-prose-fix/shared/scripts/context.sh:68andpackages/agents/source/skills/write-prose-fix/shared/scripts/context.sh:90. The 550-code-line estimate remains bounded.Gaps: None.
Split: None required.
Definition of done
The definition of done for this issue (Feature). Tick each item and give its evidence.
check-leaks.shwith the repository's private-strings list, and the leak review of each post.docs/, CHANGELOG or help text), or the Verification section says "No doc impact" and why.provenance:agent-assistedlabel.Status:comment names the merge commit.mise run checkis green, and so are the coverage floorsmise run cover-go-checkandmise run cover-py-check, whichcheckdoesn't run.packages/agents/source/commits whatmise run generate-skills, thenmise run skill-tokens, thenapm installrewrite, in that order, andcheck-generated-skills(part oflint) passes.docs/agent-skills-migration.mdor the adoption docs, or the PR's Verification says "No consumer impact" and why.Round: 2 of 3
tbhb-agent commentedon Nov 1, 2026
Refinement: READY — Report outcomes and verification now cover the prior gaps
Checked
originidentifiestbhb-dev/devtools. The live issue is open and labeledrefinement:ready; its three prose blockers (Record, read and clean up prose workflow state in Go #886, Print prose preflight verdicts from Go #889, build(agents): protect replacement Go enforcement paths #753) are still open.packages/agents/source/skills/write-prose-fix/shared/scripts/context.sh:48and:63-149.Operator authority: Noneis consistent. No unnecessary guard, configuration knob, or layer is proposed.Gaps
None.
Split
None required; the report and its fixtures fit the stated one-PR size limits.
Definition of done
Planning coverage only: checkmarks mean the draft’s ACs and Verify plan cover the item, not that work is complete.
body-890-d1-20261031.md:73requires merged-head verification with each AC ID, command, and result.body-890-d1-20261031.md:73specifies both.body-890-d1-20261031.md:73requires passing checks without weakening gates.body-890-d1-20261031.md:73requires repository leak scans and review of each issue/PR post.body-890-d1-20261031.md:73requires signed commits.body-890-d1-20261031.md:73requires documentation to match behavior.Assisted-bytrailers and theprovenance:agent-assistedlabel. Evidence:body-890-d1-20261031.md:73names both.body-890-d1-20261031.md:40sets code and prose caps;:73requires measuring the final diff.body-890-d1-20261031.md:73requires filing follow-ups as issues and listing them under Related.Status:comment naming the merge commit. Evidence:body-890-d1-20261031.md:73specifies all three.Round: 2 of 3