Deduplicate the request layer and make dynamicPageRegex additive - #173
Merged
Conversation
One `Haul` now owns "the requests this run made": it captures the start mark once, after `refreshAuth()`, and both the stuck-detector and the tools read their run views from it. The failure predicate lives once, as `isFailedRequest` in the data tier, and `finish` delegates its verification to `verifyFinish` instead of judging inline. `src/utils/request-map.ts` is gone — `Haul.byId()` replaces it, so `src/utils/` no longer depends on `src/api/`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B46vQvvc47LJeCmqQxAhme
The class is used by Fisherman alone, so it belongs beside the agent rather than in the shared request data tier: `src/ai/fisherman/request-haul.ts`, matching how other agents keep their utility classes (`ai/researcher/*`). `isFailedRequest` stays in `request-store.ts` — it is still the one shared failure predicate, called by both `RequestHaul.failed()` and Fisherman's `isStuckOnEndpoint`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BYfsBh3TXThD5XLxa23X5d
…second walk Co-Authored-By: Claude <noreply@anthropic.com>
…instead of replacing them Co-Authored-By: Claude <noreply@anthropic.com>
… request store Co-Authored-By: Claude <noreply@anthropic.com>
…Request aliases in RequestStore Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
…provider cleanup Co-Authored-By: Claude <noreply@anthropic.com>
DenysKuchma
approved these changes
Sep 2, 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.
Stacked on #169 (plan 028) — merge that first; GitHub will retarget this to main.
Path generalization had two copies of the same split/classify/replace walk —
normalizePathPatternin the request store andgeneralizeUrlin the URL matcher. Now one implementation:generalizeUrl(path, replaceSegment)with the store passing() => '{id}'. Outputs byte-identical (endpoint dedup keys and captured-request matching unchanged, pinned by the existing suites).Config fix —
dynamicPageRegexnow EXTENDS the built-in dynamic-segment heuristics instead of silently replacing them, matching whatdocs/reference/configuration.mdhas promised all along ("Built-in patterns … are always active"). The extended unit test proves built-ins stay active alongside a custom regex.Request-store pruning —
RequestResult.isWriteis the single "write method" definition (the local Set ingetWriteRequestsForScopeis gone); three never-called query methods deleted (getRequestsByEndpoint/ByMethod/ByStatus); theaddRequest/getRequestsaliases collapsed into the explicitaddMadeRequest/getMadeRequests(call sites updated across src, boat, tests — the remainingmock.getRequests()calls in integration tests are aimock's Journal API, unrelated).Provider residue —
withExecutedStepsused as a builder at both call sites; dead AI-SDK v4/v5 usage-field fallbacks removed (promptTokens/completionTokens/cachedInputTokens/raw.*), so token accounting reads only the fieldsai@7actually emits.Follow-up noted:
src/api/xhr-capture.tsholds a pre-existing third write-method Set operating on raw Playwright request methods before anyRequestResultexists — left untouched, recorded as a possible future consolidation.Testing:
bun test tests/unit1244 pass / 0 fail,bun test boat/prima/tests135 pass / 0 fail,bun test tests/integration89 pass / 1 skip / 0 fail, biome format + lint clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01Jz7wTcYsy68jUUjcWttd1B