Repository navigation
refactor(agent-task-loop): share the JSON line scan and run the duplicates gate - #198
Merged
Merged
Conversation
…cates gate claudeResultEvents and the review verdict parser each walked an agent's output last line first and parsed every line as JSON; that loop was the one clone the duplicates gate reported. Both now use jsonLinesLastFirst, and the review parser checks for an object before reading the verdict. CI now runs pnpm duplicates (jscpd with lint-config's zero-threshold profile), which no workflow ran before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 18, 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.
Summary
claudeResultEvents(adapters/claude-lines.ts) and the review verdict parser (services/review-service.ts) each wrote out:jsonLinesLastFirstinsrc/utils/json-lines.ts. The review output comes from any reviewer agent, so the helper does not live in the Claude adapter. This was the one clonepnpm duplicatesreported onmain.asReviewPayloadnow holds the verdict check that the whole-text parse and the line scan both use; anullline, which used to throw inside thetryand get skipped, is now skipped by an explicit object check.pnpm duplicatesin CI afterformat:check. refactor: share the provider/service shapes and drop the knip export staging #195 added the script (jscpd with@perfectpan/lint-config's zero-threshold profile), but no workflow ran it, so new clones passed CI. It is listed with the CI gates in AGENTS.md and CONTRIBUTING.md, and in the PR and MR templates (kept in sync).Validation
pnpm duplicatesonmain: 1 clone (claude-lines.ts [36-43]/review-service.ts [36-42]), exit 1. On this branch:Found 0 clones., exit 0.utils/json-lines.test.ts,adapters/claude-lines.test.ts(non-object lines dropped), and areview-service.test.tscase with trailingnulland42lines. All three pass onmain's source as well (the behavior is unchanged). Removing the object check inasReviewPayloadfails the review case withTypeError: Cannot read properties of null (reading 'verdict'); removing the filter inclaudeResultEventsfails the claude-lines case.pnpm format:check,gh repo-checks repository,pnpm build,pnpm typecheck,pnpm lint: exit 0.pnpm test: exit 0 (agent-task-loop 545/545, agent-room 70/70, agent-finder-cli 23/23, room-web 195/195). The first run under machine load failedexeca-runner.test.ts > kills descendant processes when the cancel signal aborts; it passed three times on its own and in the full rerun.pnpm changeset status: exit 1 only because there is no changeset (see above).Risks
.tsx: jscpd treatstsxas its own format, and the script passes--format 'typescript,javascript'. Withtsxadded there are 8 clones in room-web routes, TUI components, and one acrossagent-finder-cli'ssessions-browse-command.tsxandagent-task-loop'scommands/tui.tsx. Addingtsxwaits until those are resolved, in a separate change.