Skip to content

Conversation

@dgageot
Copy link
Member

@dgageot dgageot commented Dec 31, 2025

No description provided.

Improves code consistency by using the more idiomatic Go pattern
'len(x) > 0' for checking non-empty slices instead of 'len(x) != 0'.

Assisted-By: cagent
Replace the if-else branching with a direct call to min() for cleaner code.

Assisted-By: cagent
…ressions

Replace if-return chains with a single return statement using logical OR operators.

Assisted-By: cagent
Remove redundant conditional logic in UserMessage. The MultiContent field
can be set directly even when empty - Go handles nil/empty slices gracefully.
This removes unnecessary branching and makes the code more readable.

Assisted-By: cagent
…sages

The isPathAllowed function already returns descriptive error messages.
Wrapping them with 'Error:' is redundant and adds noise. Using err.Error()
directly makes the code cleaner and error messages more consistent.

Assisted-By: cagent
Replace the two-step HasSuffix check followed by TrimSuffix with the
more idiomatic CutSuffix which does both in one operation. Also inline
some match result checks for better readability.

Assisted-By: cagent
Reduce vertical space in the match function by inlining the matched
variable check.

Assisted-By: cagent
Use fmt.Fprintf consistently instead of mixing WriteString/WriteByte.
Combine the header lines into a single format string.

Assisted-By: cagent
Reuse UserMessage function to reduce code duplication. ImplicitUserMessage
now simply calls UserMessage and sets the Implicit flag to true.

Assisted-By: cagent
Remove explicit AgentName: "" assignment since empty string is the
zero value for strings in Go.

Assisted-By: cagent
Create a shared helper function getLastMessageContentByRole to reduce
code duplication between GetLastAssistantMessageContent and
GetLastUserMessageContent.

Assisted-By: cagent
Remove assertion for 'Error:' prefix that was removed in previous commit.
The error messages are now more concise without the redundant prefix.

Assisted-By: cagent
The thinkHandler struct was an unnecessary indirection. The thoughts slice
can be stored directly on ThinkTool, simplifying the code.

Assisted-By: cagent
The apiHandler struct and APIToolOption type were unnecessary indirection.
The config can be accessed directly from the tool struct.

Assisted-By: cagent
The if-block with early return can be simplified to a single boolean
expression using ||.

Assisted-By: cagent
The bubble sort implementation in sortResults was inefficient (O(n²)) and
verbose. Using slices.SortFunc with cmp.Compare is both clearer and more
efficient (O(n log n)).

Assisted-By: cagent
Both GetSession and GetSessions had nearly identical code for scanning
database rows into Session structs. This extracts the common logic into
a scanSession helper function that accepts any scanner interface (Row or
Rows).

Assisted-By: cagent
The OAuth and elicitation handler setup code was duplicated in two places
within RunStream. This extracts it into a single helper method.

Assisted-By: cagent
Replace switch statement with a simpler map lookup pattern.
This is more concise and equally readable.

Assisted-By: cagent
Replace manual if statement with cmp.Or for selecting the current agent
name. This is more idiomatic Go 1.21+ style.

Assisted-By: cagent
The listTodos method was using a raw tool call handler signature while
all other todo handlers use the typed NewHandler pattern. This change
makes all todo handlers consistent.

Assisted-By: cagent
The function name 'mcpToSortedList' was misleading since it simply
returns sorted keys from a map, with no MCP-specific functionality.
Renamed to 'sortedKeys' for clarity.

Assisted-By: cagent
…sionStore

The InMemorySessionStore methods take context.Context parameters for
interface compliance but don't use them. Renamed to _ to make this
explicit and satisfy linters.

Assisted-By: cagent
Signed-off-by: David Gageot <david.gageot@docker.com>
@dgageot dgageot requested a review from a team as a code owner December 31, 2025 17:58
@dgageot dgageot merged commit 08fcf23 into docker:main Jan 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants