Repository navigation
refactor(adapter): shared helpers + tool-call pairing contract [2/3] - #26
Open
LarsArtmann wants to merge 2 commits into
Open
LarsArtmann wants to merge 2 commits into
LarsArtmann wants to merge 2 commits into
Conversation
This was referenced Sep 9, 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.
Why
The three JSONL adapters (
claudecode,codex,pi) each re-implement the same ceremony: resolving~/.harnessdirectories, opening session files with a deferred close, probing readable directories, and formatting not-a-session errors. Meanwhile the sharedadapter.gohad grown into a monolith. And result pairing is positional today — when a harness splits atool_calland itstool_resultacross messages, index alignment silently drops the outcome.What changed
HomePath,UserHomeDir,ReadableDir,OpenFile,NormalizePath,NotRecognizedErr.adapter.gosplit into topic files (home.go,input.go,title.go,agent_launch.go).ToolResult.ToolCallIDfor explicit by-ID pairing,ToolCall.ProviderExecuted,Closer(adapters holding connection pools),DiagnosticsSource+FilesystemDiagnostics(health checks).go.mod:go 1.26.5directive (tests usenew(expr)) andgo-humanize(PluralWord in agent-launch summaries).No production behavior changes — the full suite passes unchanged.
Series
Part 2/3, stacks on #25:
crush-adapter-core— the adapter that exercisesToolCallID,Closer, andDiagnosticsSourceValidation
go build ./...go test -count=1 ./...— green at the branch tip💘 Generated with Crush
Reviewing this stacked series
GitHub shows the cumulative diff against
master, so "Files changed" also includes part 1 (#25). This PR's own delta is just the second commit,refactor(adapter): shared helpers + tool-call pairing contract— reviewing that single commit gives the actual scope of this change.