feat(agents): persist agent capabilities#43
Merged
rowan-stein merged 1 commit intomainfrom Apr 17, 2026
Merged
Conversation
Contributor
Author
Test & Lint SummaryCommands:
Tests: Passed: 1, Failed: 0, Skipped: 0. |
noa-lucent
approved these changes
Apr 17, 2026
noa-lucent
left a comment
There was a problem hiding this comment.
Clean implementation that follows existing codebase patterns well. Key observations:
- Migration: Correct —
JSONB NOT NULL DEFAULT '[]'handles existing rows properly. - Store layer:
encode/decodeCapabilitiesare well-structured. The nil-to-empty normalization inencodeCapabilitiescorrectly prevents writing SQL/JSONnullto a NOT NULL column. ThedecodeCapabilitiesinvariant checks catch DB-level corruption. - Server layer: Proto3 repeated field presence detection via
req.Capabilities != nilis the correct approach, and the explanatory comment is appreciated. - Converter: Defensive
append([]string(nil), ...)copies at the boundary are good practice. - SQL: Column ordering, scan ordering, and parameter counts all verified correct.
One minor suggestion for unit test coverage on the encode/decode helpers. LGTM overall.
| if value == nil { | ||
| return nil, fmt.Errorf("capabilities is NULL") | ||
| } | ||
| var capabilities []string |
There was a problem hiding this comment.
[minor] decodeCapabilities and encodeCapabilities introduce JSON serialization logic that warrants unit tests — especially the edge cases:
decodeCapabilities(nil)→ error (NULL invariant)decodeCapabilities([]byte("null"))→ error (JSON null invariant)decodeCapabilities([]byte("[]"))→ empty[]string{}decodeCapabilities([]byte(["a","b"]))→["a","b"]encodeCapabilities(nil)→[]byte("[]")(nil normalization)encodeCapabilities([]string{})→[]byte("[]")
These are easy to test and document the contract for future readers.
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
Testing
Fixes #133