Ben/search rrf#179
Conversation
…nd remove bad client usage
WalkthroughThis change implements a hybrid search system using Reciprocal Rank Fusion (RRF) to combine semantic and full-text search results for message retrieval. It introduces a new Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API
participant SearchUtil
participant DB
participant EmbeddingService
Client->>API: POST /search (query, filters, limit)
API->>SearchUtil: search(db, query, filters, limit)
alt Embeddings enabled
SearchUtil->>EmbeddingService: get_embedding(query)
EmbeddingService-->>SearchUtil: embedding
SearchUtil->>DB: semantic search (embedding, filters)
DB-->>SearchUtil: semantic_results
end
SearchUtil->>DB: full-text search (query, filters)
DB-->>SearchUtil: fulltext_results
SearchUtil->>SearchUtil: reciprocal_rank_fusion(semantic_results, fulltext_results, limit)
SearchUtil-->>API: fused_results
API-->>Client: list[Message]
Estimated code review effort🎯 5 (Critical) | ⏱️ ~90 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Possibly related PRs
Poem
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…rbitrary filters - Remove unused config variables - Added arbitrary filters to all search endpoints. - Pluralize `filters` everywhere in SDKs for consistency - Updated documentation and changelog to reflect these changes.
* expose core client from sdks * align text * fix: resolve get_effective_observe me race condition, default peer config (#176) * fix: resolve get_effective_observe me race condition, default peer config * fix: preserve custom config even after leaving * chore: test cases, enqueue types * Update sdks/typescript/package.json Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: doria <93405247+dr-frmr@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 18
🔭 Outside diff range comments (5)
docs/v2/documentation/core-concepts/summarizer.mdx (1)
49-50: Optional wording polishThe phrase “a large number of messages” can be shortened to “many messages” to satisfy the LanguageTool hint and reduce wordiness.
-If you batch-save a large number of messages, +If you batch-save many messages,tests/routes/test_workspaces.py (1)
259-267: Good test enhancement with type annotations.The test correctly expects an empty list response for nonexistent workspaces and includes proper type annotation.
Add a return type annotation to address the static analysis hint:
-def test_search_workspace_nonexistent(client: TestClient): +def test_search_workspace_nonexistent(client: TestClient) -> None:docs/v1/openapi.json (1)
3955-3967: Breaking Change: Renamedfilter→filtersRequires Major Version BumpThe OpenAPI spec in docs/v1/openapi.json is at version 1.1.0 (line 12), and you’ve removed all occurrences of the old
filterproperty in favor offilters(8 total). This is a backwards-incompatible change—clients still sending"filter"will fail validation once enforced.Action items:
- Bump
info.versionto 2.0.0 (major).- In your Pydantic models (and downstream SDKs), keep
"filter"as a deprecated alias for"filters"with a clear warning.- Ship updated SDK versions (Python, TS, etc.) before deploying the server change.
- Document the deprecation window and removal timeline in your changelog or migration guide.
Affected file:
- docs/v1/openapi.json (properties definition at lines 3955–3967)
tests/routes/test_sessions.py (1)
827-899: Consider addressing static analysis hints for code style consistency.The static analysis tools suggest several minor style improvements that would enhance code consistency:
def test_search_session_with_messages( - client: TestClient, sample_data: tuple[Workspace, Peer] + client: TestClient, sample_data: tuple[Workspace, Peer], -): +) -> None: """Test session search with actual messages""" # ... existing code ... json={ "messages": [ {"content": "Search this content", "peer_id": test_peer.name}, {"content": "Another message to find", "peer_id": test_peer.name}, + {"content": "More searchable content", "peer_id": test_peer.name}, ] - } + },Similar trailing comma and return type annotation improvements apply to other test functions.
tests/routes/test_peers.py (1)
469-497: Good test coverage for limit functionality.The test properly validates that search results respect the specified limit.
Consider adding trailing commas for consistency:
def test_search_peer_with_limit( - client: TestClient, sample_data: tuple[Workspace, Peer] + client: TestClient, sample_data: tuple[Workspace, Peer], ):{"content": "Another searchable message", "peer_id": test_peer.name}, - {"content": "More searchable content", "peer_id": test_peer.name}, + {"content": "More searchable content", "peer_id": test_peer.name}, ]
♻️ Duplicate comments (1)
sdks/python/src/honcho/async_client/client.py (1)
342-368: Search method changes align with hybrid search implementation.The transition from paginated results to a direct list with a configurable limit (1-100) is appropriate for the new RRF-based hybrid search. The default limit of 10 is reasonable.
Note: There was a past review comment suggesting pagination could still be used, but the 100-item limit should handle most use cases comfortably.
There was a problem hiding this comment.
Actionable comments posted: 12
♻️ Duplicate comments (4)
docs/v2/documentation/core-concepts/configuration.mdx (1)
9-9: Fix grammatical error in configuration level description.The phrase "AKA a the state" contains an extra article.
-These configurations can be set at the peer, session, and session-peer level (AKA a the state of a peer within a specific session). +These configurations can be set at the peer, session, and session-peer level (AKA the state of a peer within a specific session).src/routers/sessions.py (1)
457-464: Add missing return type annotation and fix function call in defaults.The search endpoint refactor properly implements the hybrid search functionality with correct filter merging and search function integration, but has formatting issues.
async def search_session( workspace_id: str = Path(..., description="ID of the workspace"), session_id: str = Path(..., description="ID of the session"), - body: schemas.MessageSearchOptions = Body( - ..., description="Message search parameters" - ), + body: schemas.MessageSearchOptions = Body(..., description="Message search parameters"), db: AsyncSession = db, -): +) -> list[schemas.Message]:src/utils/search.py (1)
95-97: Consider extracting the error message for reusability.The error message construction could be extracted to maintain consistency if this validation is needed elsewhere.
except ValueError as e: + error_msg = f"Query exceeds maximum token limit of {settings.MAX_EMBEDDING_TOKENS}." raise ValidationException( - f"Query exceeds maximum token limit of {settings.MAX_EMBEDDING_TOKENS}." + error_msg ) from esdks/typescript/src/client.ts (1)
117-120: Good input validation but missing await for workspace creation.The constructor properly validates options using Zod schema. However, line 120 calls
getOrCreatewithout awaiting it, which will result in an unhandled promise.- // Note: Constructor cannot be async, so we can't await here - // The workspace will be created on first use if it doesn't exist - // due to the upsert behavior of the API - this._client.workspaces.getOrCreate({ id: this.workspaceId }) + // Note: Constructor cannot be async, so we can't await here + // The workspace will be created on first use if it doesn't exist + // due to the upsert behavior of the APIAlternatively, consider creating an async factory method:
static async create(options: HonchoConfig): Promise<Honcho> { const client = new Honcho(options) await client._client.workspaces.getOrCreate({ id: client.workspaceId }) return client }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (6)
docs/v1/openapi.json(8 hunks)docs/v2/contributing/self-hosting.mdx(1 hunks)docs/v2/documentation/core-concepts/configuration.mdx(1 hunks)sdks/typescript/src/client.ts(5 hunks)src/routers/sessions.py(4 hunks)src/utils/search.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
src/**/*.py
📄 CodeRabbit Inference Engine (CLAUDE.md)
src/**/*.py: Follow isort conventions with absolute imports preferred
snake_case for variables/functions; PascalCase for classes
Line length: 88 chars (Black compatible)
Explicit error handling with appropriate exception types
Docstrings: Use Google style docstrings
Use environment variables via python-dotenv (.env)
Use specific exception types (ResourceNotFoundException, ValidationException, etc.)
Proper logging with context instead of print statements
Files:
src/routers/sessions.pysrc/utils/search.py
src/routers/**/*.py
📄 CodeRabbit Inference Engine (CLAUDE.md)
API routes must follow the pattern: /v1/{resource}/{id}/{action}
Files:
src/routers/sessions.py
🧠 Learnings (6)
📚 Learning: the honcho project prefers upsert behavior for update operations across all resources (sessions, pee...
Learnt from: Rajat-Ahuja1997
PR: plastic-labs/honcho#131
File: src/crud.py:503-505
Timestamp: 2025-06-18T14:50:59.967Z
Learning: The Honcho project prefers upsert behavior for update operations across all resources (sessions, peers, workspaces). Update operations should create the resource if it doesn't exist rather than failing fast. This is an explicit design decision that differs from typical REST semantics but provides a more forgiving API experience.
Applied to files:
docs/v2/documentation/core-concepts/configuration.mdxsdks/typescript/src/client.ts
📚 Learning: in the honcho project's configuration system (src/config.py), the intended precedence order for conf...
Learnt from: VVoruganti
PR: plastic-labs/honcho#115
File: src/config.py:68-77
Timestamp: 2025-05-28T22:30:23.218Z
Learning: In the Honcho project's configuration system (src/config.py), the intended precedence order for configuration values is: Environment variables (highest) > .env files > TOML config files > Default values (lowest). Environment variables and .env files should override TOML values to allow for deployment-time configuration overrides.
Applied to files:
docs/v2/documentation/core-concepts/configuration.mdx
📚 Learning: applies to src/models.py : feature flags on workspace, peer, and session levels...
Learnt from: CR
PR: plastic-labs/honcho#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T14:51:09.913Z
Learning: Applies to src/models.py : Feature flags on workspace, peer, and session levels
Applied to files:
docs/v2/documentation/core-concepts/configuration.mdxsdks/typescript/src/client.ts
📚 Learning: the `get_or_create_session` function in this codebase is designed to handle both session creation an...
Learnt from: dr-frmr
PR: plastic-labs/honcho#131
File: src/routers/sessions.py:206-213
Timestamp: 2025-06-18T20:42:06.458Z
Learning: The `get_or_create_session` function in this codebase is designed to handle both session creation and adding peers to existing sessions. When called with peers, it will add those peers to an existing session rather than creating a duplicate session.
Applied to files:
src/routers/sessions.py
📚 Learning: the codebase uses a layered error handling approach where the crud layer raises valueerror for busin...
Learnt from: Rajat-Ahuja1997
PR: plastic-labs/honcho#131
File: src/crud.py:374-377
Timestamp: 2025-06-18T21:24:55.907Z
Learning: The codebase uses a layered error handling approach where the CRUD layer raises ValueError for business rule violations (like peer limits), and the API layer catches these ValueError exceptions and translates them to appropriate domain-specific exceptions (ValidationException for validation errors, ResourceNotFoundException for missing resources). This provides clean separation of concerns between business logic and HTTP semantics.
Applied to files:
src/utils/search.py
📚 Learning: applies to src/{models,crud}.py : token counting on messages for usage tracking...
Learnt from: CR
PR: plastic-labs/honcho#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T14:51:09.913Z
Learning: Applies to src/{models,crud}.py : Token counting on messages for usage tracking
Applied to files:
src/utils/search.py
🪛 LanguageTool
docs/v2/documentation/core-concepts/configuration.mdx
[grammar] ~7-~7: Ensure spelling is correct
Context: ...onfigured to change the behavior of the deriver, which is responsible for generating an...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[grammar] ~7-~7: Use correct spacing
Context: ... and storing facts, summaries, and user representations. These configurations can be set at the p...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~9-~9: Use correct spacing
Context: ...A the state of a peer within a specific session). ### Peer Configuration By default, all peer...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~11-~11: Use correct spacing
Context: ...r within a specific session). ### Peer Configuration By default, all peers are "observed" by ...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~13-~13: Use correct spacing
Context: ...rogram will never need to ask questions about. You may therefore disable observation of...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~15-~15: Use correct spacing
Context: ...erve_meflag in their configuration tofalse`. If the peer has a session-level configur...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~17-~17: Use commas correctly
Context: ... this configuration. If the flag is not set, or is set to true, the peer will be ob...
(QB_NEW_EN_OTHER_ERROR_IDS_33)
[grammar] ~17-~17: Use correct spacing
Context: ..., or is set to true, the peer will be observed. ```python Python from honcho import Honcho # Initialize client honcho = Honcho() # C...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~23-~23: There might be a mistake here.
Context: ...from honcho import Honcho # Initialize client honcho = Honcho() # Create peer with co...
(QB_NEW_EN_OTHER)
[grammar] ~24-~24: Use correct spacing
Context: ...rt Honcho # Initialize client honcho = Honcho() # Create peer with configuration peer = ho...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~26-~26: There might be a mistake here.
Context: ...t honcho = Honcho() # Create peer with configuration peer = honcho.peer("my-peer", config={"o...
(QB_NEW_EN_OTHER)
[grammar] ~27-~27: Use correct spacing
Context: ...o.peer("my-peer", config={"observe_me": False}) typescript TypeScript import { Honcho } from "@honcho-ai/sdk"; // Initialize client const honcho = new Honcho({}); // Create peer with configuration const peer = await honcho.peer("my-peer", config: { observe_me: false }); ``` ### Session Configuration By default, all s...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~40-~40: Use correct spacing
Context: ...false }); ``` ### Session Configuration By default, all sessions have the the de...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~42-~42: Ensure spelling is correct
Context: ...u may create a session that escapes the deriver's watchful eye by setting the `deriver_...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[grammar] ~42-~42: Use correct spacing
Context: ...et_or_create` on the session with a new configuration. ```python Python from honcho import Honcho # Initialize client honcho = Honcho() # C...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~48-~48: There might be a mistake here.
Context: ...from honcho import Honcho # Initialize client honcho = Honcho() # Create session with...
(QB_NEW_EN_OTHER)
[grammar] ~49-~49: Use correct spacing
Context: ...rt Honcho # Initialize client honcho = Honcho() # Create session with configuration sessio...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~51-~51: There might be a mistake here.
Context: ...oncho = Honcho() # Create session with configuration session = honcho.session("my-session", c...
(QB_NEW_EN_OTHER)
[grammar] ~52-~52: Use correct spacing
Context: ...y-session", config={"deriver_disabled": True}) typescript TypeScript import { Honcho } from "@honcho-ai/sdk"; // Initialize client const honcho = new Honcho({}); // Create session with configuration const session = await honcho.session("my-session", config: { deriver_disabled: true }); ``` ### Session-Peer Configuration Configuratio...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~65-~65: Use correct spacing
Context: ... }); ``` ### Session-Peer Configuration Configuration at the session-peer level ...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[style] ~67-~67: Consider a more concise word here.
Context: ... such that certain peers observe others in order to form "local representations" of them. T...
(IN_ORDER_TO_PREMIUM)
[grammar] ~67-~67: Use correct spacing
Context: ...ags that can be set at the session-peer level: - observe_me: Whether this peer should be observed...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~69-~69: Use correct spacing
Context: ...s overrides the peer-level observe_me flag. - observe_others: Whether this peer should produce local...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~71-~71: Use correct spacing
Context: ... observed if their observe_me flag is true. You can combine these flags across multi...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~73-~73: Correctly pair commas and coordinating conjunctions
Context: ... to true for at least one peer in the session and at least one other peer must have t...
(QB_NEW_EN_OTHER_ERROR_IDS_14)
[grammar] ~73-~73: Use correct spacing
Context: ...ust have their observe_me flag set to true. Many applications will work best without...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~75-~75: Use correct spacing
Context: ...ou are doing advanced reasoning on user perspectives.
You can dynamically change the configura...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~79-~79: Use hyphens correctly
Context: ...namically change the configuration of a session-peer by calling set_peer_config on th...
(QB_NEW_EN_OTHER_ERROR_IDS_29)
[grammar] ~79-~79: Use correct spacing
Context: ... peer and the configuration you want to set. ```python Python from honcho import Honcho # Initialize client honcho = Honcho() # C...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~85-~85: There might be a mistake here.
Context: ...from honcho import Honcho # Initialize client honcho = Honcho() # Create session sess...
(QB_NEW_EN_OTHER)
[grammar] ~86-~86: Use correct spacing
Context: ...rt Honcho # Initialize client honcho = Honcho() # Create session session = honcho.session(...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~88-~88: There might be a mistake here.
Context: ...lize client honcho = Honcho() # Create session session = honcho.session("my-session") ...
(QB_NEW_EN_OTHER)
[grammar] ~89-~89: Use correct spacing
Context: ... = Honcho() # Create session session = honcho.session("my-session") # Create peers alice = honcho.peer("alice"...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~91-~91: There might be a mistake here.
Context: ... honcho.session("my-session") # Create peers alice = honcho.peer("alice") bob = honch...
(QB_NEW_EN_OTHER)
[grammar] ~93-~93: Use correct spacing
Context: ...eers alice = honcho.peer("alice") bob = honcho.peer("bob") # Add peers to session with default config...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~95-~95: There might be a mistake here.
Context: ...") # Add peers to session with default configuration session.add_peers([alice, bob]) # Add a...
(QB_NEW_EN_OTHER)
[grammar] ~96-~96: Use correct spacing
Context: ...configuration session.add_peers([alice, bob]) # Add another peer to the session with a c...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~98-~98: There might be a mistake here.
Context: ...other peer to the session with a custom configuration charlie = honcho.peer("charlie") session...
(QB_NEW_EN_OTHER)
[grammar] ~100-~100: Use correct spacing
Context: ...{"observe_me": False, "observe_others": True}]) # Set session-peer configuration session.s...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~102-~102: There might be a mistake here.
Context: ...ve_others": True}]) # Set session-peer configuration session.set_peer_config(alice, {"observe...
(QB_NEW_EN_OTHER)
[grammar] ~104-~104: Use correct spacing
Context: ...ion.set_peer_config(bob, {"observe_me": False}) # Get session-peer configuration charlie_c...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~106-~106: There might be a mistake here.
Context: ...bserve_me": False}) # Get session-peer configuration charlie_config = session.get_peer_config...
(QB_NEW_EN_OTHER)
[grammar] ~107-~107: Use correct spacing
Context: ...nfig = session.get_peer_config(charlie) print(charlie_config) typescript TypeScript import { Honcho } from "@honcho-ai/sdk"; // Initialize client const honcho = new Honcho({}); // Create session const session = await honcho.session("my-session"); // Create peers const alice = await honcho.peer("alice"); const bob = await honcho.peer("bob"); // Add peers to session await session.addPeers([alice, bob]); // Add another peer to the session with a custom configuration const charlie = await honcho.peer("charlie"); await session.addPeers([charlie, { observe_me: false, observe_others: true }]); // Set session-peer configuration await session.setPeerConfig(alice, { observe_others: true }); await session.setPeerConfig(bob, { observe_me: false }); // Get session-peer configuration const charlieConfig = await session.getPeerConfig(charlie); console.log(charlieConfig); ```
(QB_NEW_EN_OTHER_ERROR_IDS_5)
🪛 Ruff (0.12.2)
src/routers/sessions.py
454-454: Trailing comma missing
Add trailing comma
(COM812)
457-457: Missing return type annotation for public function search_session
(ANN201)
460-462: Do not perform function call Body in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
(B008)
461-461: Trailing comma missing
Add trailing comma
(COM812)
src/utils/search.py
24-24: Trailing comma missing
Add trailing comma
(COM812)
95-97: Avoid specifying long messages outside the exception class
(TRY003)
96-96: Trailing comma missing
Add trailing comma
(COM812)
132-132: Trailing comma missing
Add trailing comma
(COM812)
139-139: Trailing comma missing
Add trailing comma
(COM812)
144-144: Trailing comma missing
Add trailing comma
(COM812)
149-149: Trailing comma missing
Add trailing comma
(COM812)
🔇 Additional comments (2)
docs/v2/contributing/self-hosting.mdx (1)
298-298: Capitalization & clarity fix looks goodThe updated bullet now capitalizes “FastAPI” and reads clearly. No further issues spotted.
docs/v1/openapi.json (1)
35-35: Good clarity improvement on JWT referenceExplicitly referencing “JWT app_id” instead of the former “JWT token” makes the behaviour clearer to integrators.
There was a problem hiding this comment.
Actionable comments posted: 8
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (5)
docs/changelog/introduction.mdx(1 hunks)docs/v2/documentation/core-concepts/architecture.mdx(1 hunks)docs/v2/documentation/core-concepts/search.mdx(1 hunks)docs/v2/guides/search.mdx(3 hunks)mcp/worker.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: the honcho project prefers upsert behavior for update operations across all resources (sessions, pee...
Learnt from: Rajat-Ahuja1997
PR: plastic-labs/honcho#131
File: src/crud.py:503-505
Timestamp: 2025-06-18T14:50:59.967Z
Learning: The Honcho project prefers upsert behavior for update operations across all resources (sessions, peers, workspaces). Update operations should create the resource if it doesn't exist rather than failing fast. This is an explicit design decision that differs from typical REST semantics but provides a more forgiving API experience.
Applied to files:
docs/changelog/introduction.mdxdocs/v2/guides/search.mdxdocs/v2/documentation/core-concepts/search.mdx
📚 Learning: the honcho project uses python 3.11 in dockerfile and requires python >=3.10 in pyproject.toml. the ...
Learnt from: VVoruganti
PR: plastic-labs/honcho#168
File: src/utils/summarizer.py:10-10
Timestamp: 2025-07-30T19:44:05.982Z
Learning: The Honcho project uses Python 3.11 in Dockerfile and requires Python >=3.10 in pyproject.toml. The project uses typing_extensions for the override decorator which is required for Python < 3.12 compatibility.
Applied to files:
docs/changelog/introduction.mdx
📚 Learning: in the honcho database schema, messages.app_id references workspaces.public_id (string nanoid), not ...
Learnt from: Rajat-Ahuja1997
PR: plastic-labs/honcho#131
File: migrations/versions/d429de0e5338_adopt_peer_paradigm.py:438-441
Timestamp: 2025-06-18T16:44:57.733Z
Learning: In the Honcho database schema, messages.app_id references workspaces.public_id (string nanoid), not workspaces.id (integer primary key). This means that during migrations when workspaces.public_id is renamed to workspaces.id, the foreign key relationship with messages.app_id remains valid.
Applied to files:
docs/v2/guides/search.mdx
🪛 LanguageTool
docs/v2/guides/search.mdx
[grammar] ~166-~166: Use correct spacing
Context: ...value" } }); ``` ### Best Practices ### Handle Empty Results Gracefully <CodeGr...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
🔇 Additional comments (3)
mcp/worker.ts (1)
1344-1344: No-op whitespace cleanup is fineThe single change merely trims trailing whitespace; no functional impact.
docs/v2/documentation/core-concepts/architecture.mdx (1)
214-219: Example revision reads well – no issues foundThe updated examples clearly communicate the recommended phrasing and the code snippets are syntactically correct.
docs/v2/documentation/core-concepts/search.mdx (1)
7-15: Cross-check external link and cap wording around defaults
- Verify the
/v2/guides/using-filtersroute actually exists; a broken link here will undermine the new docs.- Consider adding “(hard-limit)” after “maximum of 100” to make it explicit that the backend enforces this.
There was a problem hiding this comment.
Actionable comments posted: 4
🔭 Outside diff range comments (1)
docs/v1/openapi.json (1)
538-575: Wrong claim + missing article –user_iddescription referencesJWT app_id
Line 538 states “must match JWT app_id” which is both grammatically off and semantically incorrect—the parameter should match the JWT user_id claim.-"description": "Get a User by ID\n\nIf user_id is provided as a query parameter, it uses that (must match JWT app_id).\nOtherwise, it uses the user_id from the JWT.", +"description": "Get a User by ID\n\nIf user_id is provided as a query parameter, it uses that (must match the JWT user_id).\nOtherwise, it uses the user_id claim from the JWT.", @@ -"description": "User ID to retrieve. If not provided, uses JWT" +"description": "User ID to retrieve. If not provided, uses the user_id claim from the JWT"
♻️ Duplicate comments (10)
docs/v1/openapi.json (6)
57-60: Still ambiguous fallback wording (unchanged from prior review)
Previous review already asked to specify which JWT claim is used. The text still says “If not provided, uses JWT”.
571-575: Ambiguous fallback wording – specify claim
Same unresolved issue: “If not provided, uses JWT” should name the claim.
962-963: Clarify claim name & add missing article
Text still lacks “the” before JWT and doesn’t mention thesession_idclaim explicitly.
1006-1009: Session-ID parameter repeats prior ambiguity
Please replace “uses JWT” with “uses the session_id claim from the JWT”.
2580-2581: Collection description still missing article “the”
Pattern identical to earlier comments; apply same fix.
2624-2628: Ambiguous fallback wording – specify claim
Replace “uses JWT” with “uses the collection_id claim from the JWT” for clarity.sdks/typescript/__tests__/peer.test.ts (1)
349-350: Use ES6 imports instead of require (continued).Similar to the previous comment, these dynamic
requirestatements should be replaced with proper ES6 imports.Remove these require statements after adding the import at the top:
- const { SessionPeerConfig } = require('../src/session'); const config = new SessionPeerConfig(false, true);Also applies to: 365-366
sdks/typescript/__tests__/session.test.ts (1)
349-350: Use ES6 imports instead of require (continued).Remove these require statements after adding the import at the top.
Also applies to: 365-366
sdks/typescript/src/client.ts (1)
117-120: Unhandled promise in constructor.The
getOrCreatecall on line 120 creates an unhandled promise. While the comment acknowledges this limitation, it could still cause issues if the API call fails.Consider implementing the factory method pattern suggested in the previous review to properly handle this async operation.
sdks/typescript/src/session.ts (1)
173-179: Consider using a type guard for better type narrowing.As suggested in the previous review, a type guard function would make the error handling cleaner and improve type narrowing.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
sdks/typescript/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (19)
docs/v1/openapi.json(8 hunks)docs/v2/documentation/core-concepts/configuration.mdx(1 hunks)docs/v2/guides/dialectic-endpoint.mdx(1 hunks)docs/v2/guides/discord.mdx(1 hunks)docs/v2/guides/file-uploads.mdx(2 hunks)docs/v2/guides/get-context.mdx(5 hunks)docs/v2/guides/search.mdx(4 hunks)docs/v2/guides/streaming-response.mdx(2 hunks)docs/v2/guides/telegram.mdx(1 hunks)sdks/typescript/__tests__/client.test.ts(9 hunks)sdks/typescript/__tests__/peer.test.ts(13 hunks)sdks/typescript/__tests__/session.test.ts(26 hunks)sdks/typescript/examples/get_context.ts(2 hunks)sdks/typescript/examples/get_representation.ts(2 hunks)sdks/typescript/examples/search.ts(4 hunks)sdks/typescript/src/client.ts(5 hunks)sdks/typescript/src/index.ts(1 hunks)sdks/typescript/src/peer.ts(3 hunks)sdks/typescript/src/session.ts(2 hunks)
🧰 Additional context used
🧠 Learnings (10)
📚 Learning: the honcho project prefers upsert behavior for update operations across all resources (sessions, pee...
Learnt from: Rajat-Ahuja1997
PR: plastic-labs/honcho#131
File: src/crud.py:503-505
Timestamp: 2025-06-18T14:50:59.967Z
Learning: The Honcho project prefers upsert behavior for update operations across all resources (sessions, peers, workspaces). Update operations should create the resource if it doesn't exist rather than failing fast. This is an explicit design decision that differs from typical REST semantics but provides a more forgiving API experience.
Applied to files:
docs/v2/guides/telegram.mdxsdks/typescript/examples/get_context.tsdocs/v2/guides/streaming-response.mdxdocs/v2/guides/dialectic-endpoint.mdxsdks/typescript/examples/get_representation.tsdocs/v2/guides/get-context.mdxsdks/typescript/examples/search.tsdocs/v2/guides/file-uploads.mdxdocs/v2/documentation/core-concepts/configuration.mdxdocs/v2/guides/search.mdxsdks/typescript/__tests__/client.test.tssdks/typescript/src/peer.tssdks/typescript/src/client.ts
📚 Learning: the `get_or_create_session` function in this codebase is designed to handle both session creation an...
Learnt from: dr-frmr
PR: plastic-labs/honcho#131
File: src/routers/sessions.py:206-213
Timestamp: 2025-06-18T20:42:06.458Z
Learning: The `get_or_create_session` function in this codebase is designed to handle both session creation and adding peers to existing sessions. When called with peers, it will add those peers to an existing session rather than creating a duplicate session.
Applied to files:
sdks/typescript/examples/get_context.tsdocs/v2/guides/streaming-response.mdxsdks/typescript/examples/get_representation.tsdocs/v2/guides/get-context.mdxsdks/typescript/examples/search.tsdocs/v2/documentation/core-concepts/configuration.mdxsdks/typescript/__tests__/session.test.tssdks/typescript/src/session.ts
📚 Learning: peer names in the honcho codebase are restricted to the pattern `r"^[a-za-z0-9_-]+$"` (same as sessi...
Learnt from: Rajat-Ahuja1997
PR: plastic-labs/honcho#166
File: migrations/versions/05486ce795d5_make_session_name_required_on_messages.py:60-114
Timestamp: 2025-07-21T20:57:42.135Z
Learning: Peer names in the Honcho codebase are restricted to the pattern `r"^[a-zA-Z0-9_-]+$"` (same as session names), which prevents SQL injection and JSON syntax errors when peer names are interpolated into SQL queries and JSON strings during migrations.
Applied to files:
docs/v2/guides/streaming-response.mdxsdks/typescript/examples/get_representation.tssdks/typescript/examples/search.tsdocs/v2/documentation/core-concepts/configuration.mdxsdks/typescript/__tests__/client.test.tssdks/typescript/__tests__/peer.test.tssdks/typescript/src/peer.ts
📚 Learning: the honcho project uses python 3.11 in dockerfile and requires python >=3.10 in pyproject.toml. the ...
Learnt from: VVoruganti
PR: plastic-labs/honcho#168
File: src/utils/summarizer.py:10-10
Timestamp: 2025-07-30T19:44:05.982Z
Learning: The Honcho project uses Python 3.11 in Dockerfile and requires Python >=3.10 in pyproject.toml. The project uses typing_extensions for the override decorator which is required for Python < 3.12 compatibility.
Applied to files:
docs/v2/guides/dialectic-endpoint.mdxdocs/v2/guides/file-uploads.mdx
📚 Learning: applies to src/utils/history.py : session history summarization: short every 20 messages, long every...
Learnt from: CR
PR: plastic-labs/honcho#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T14:51:09.913Z
Learning: Applies to src/utils/history.py : Session history summarization: short every 20 messages, long every 60
Applied to files:
docs/v2/guides/get-context.mdx
📚 Learning: contributing.md exists at the repository root in the honcho project and contains a comprehensive con...
Learnt from: VVoruganti
PR: plastic-labs/honcho#115
File: README.md:393-396
Timestamp: 2025-05-29T16:27:13.808Z
Learning: CONTRIBUTING.md exists at the repository root in the Honcho project and contains a comprehensive contributing guide. Automated verification scripts can sometimes fail to detect existing files, so manual verification may be needed when users dispute automated findings.
Applied to files:
docs/v2/guides/file-uploads.mdx
📚 Learning: in the honcho project's configuration system (src/config.py), the intended precedence order for conf...
Learnt from: VVoruganti
PR: plastic-labs/honcho#115
File: src/config.py:68-77
Timestamp: 2025-05-28T22:30:23.218Z
Learning: In the Honcho project's configuration system (src/config.py), the intended precedence order for configuration values is: Environment variables (highest) > .env files > TOML config files > Default values (lowest). Environment variables and .env files should override TOML values to allow for deployment-time configuration overrides.
Applied to files:
docs/v2/documentation/core-concepts/configuration.mdx
📚 Learning: applies to src/models.py : feature flags on workspace, peer, and session levels...
Learnt from: CR
PR: plastic-labs/honcho#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T14:51:09.913Z
Learning: Applies to src/models.py : Feature flags on workspace, peer, and session levels
Applied to files:
docs/v2/documentation/core-concepts/configuration.mdxsdks/typescript/src/client.ts
📚 Learning: in the honcho database schema, messages.app_id references workspaces.public_id (string nanoid), not ...
Learnt from: Rajat-Ahuja1997
PR: plastic-labs/honcho#131
File: migrations/versions/d429de0e5338_adopt_peer_paradigm.py:438-441
Timestamp: 2025-06-18T16:44:57.733Z
Learning: In the Honcho database schema, messages.app_id references workspaces.public_id (string nanoid), not workspaces.id (integer primary key). This means that during migrations when workspaces.public_id is renamed to workspaces.id, the foreign key relationship with messages.app_id remains valid.
Applied to files:
docs/v2/guides/search.mdx
📚 Learning: in the messagecreate schema, peer_name is the actual field name with "peer_id" as an alias, so when ...
Learnt from: dr-frmr
PR: plastic-labs/honcho#131
File: tests/test_schema_validations.py:76-80
Timestamp: 2025-06-17T21:40:26.817Z
Learning: In the MessageCreate schema, peer_name is the actual field name with "peer_id" as an alias, so when constructing MessageCreate(peer_id="value"), it sets the peer_name attribute to "value".
Applied to files:
sdks/typescript/__tests__/peer.test.tssdks/typescript/__tests__/session.test.ts
🪛 LanguageTool
docs/v2/guides/file-uploads.mdx
[grammar] ~75-~75: Use correct spacing
Context: ... the PDF`); ``` ## Upload Parameters The upload methods accept the following ...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~77-~77: There might be a mistake here.
Context: ...The upload methods accept the following parameters: | Parameter | Type | Required | Descrip...
(QB_NEW_EN_OTHER)
[grammar] ~82-~82: There might be a mistake here.
Context: ...ing | Yes | ID of the peer creating the messages | ## File Processing Details ### Text Extra...
(QB_NEW_EN_OTHER)
docs/v2/documentation/core-concepts/configuration.mdx
[grammar] ~7-~7: Ensure spelling is correct
Context: ...onfigured to change the behavior of the deriver, which is responsible for generating an...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[grammar] ~7-~7: Use correct spacing
Context: ... and storing facts, summaries, and user representations. These configurations can be set at the p...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~9-~9: Use correct spacing
Context: ...A the state of a peer within a specific session). ### Peer Configuration By default, all peer...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~11-~11: Use correct spacing
Context: ...r within a specific session). ### Peer Configuration By default, all peers are "observed" by ...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~13-~13: Use correct spacing
Context: ...rogram will never need to ask questions about. You may therefore disable observation of...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~15-~15: Use correct spacing
Context: ...erve_meflag in their configuration tofalse`. If the peer has a session-level configur...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~17-~17: Use commas correctly
Context: ... this configuration. If the flag is not set, or is set to true, the peer will be ob...
(QB_NEW_EN_OTHER_ERROR_IDS_33)
[grammar] ~17-~17: Use correct spacing
Context: ..., or is set to true, the peer will be observed. ```python Python from honcho import Honcho # Initialize client honcho = Honcho() # C...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~23-~23: There might be a mistake here.
Context: ...from honcho import Honcho # Initialize client honcho = Honcho() # Create peer with co...
(QB_NEW_EN_OTHER)
[grammar] ~24-~24: Use correct spacing
Context: ...rt Honcho # Initialize client honcho = Honcho() # Create peer with configuration peer = ho...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~26-~26: There might be a mistake here.
Context: ...t honcho = Honcho() # Create peer with configuration peer = honcho.peer("my-peer", config={"o...
(QB_NEW_EN_OTHER)
[grammar] ~27-~27: Use correct spacing
Context: ...o.peer("my-peer", config={"observe_me": False}) typescript TypeScript import { Honcho } from "@honcho-ai/sdk"; // Initialize client const honcho = new Honcho({}); // Create peer with configuration const peer = await honcho.peer("my-peer", { config: { observe_me: false } }); ``` ### Session Configuration By default, all s...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~40-~40: Use correct spacing
Context: ...lse } }); ``` ### Session Configuration By default, all sessions have the the de...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~42-~42: Ensure spelling is correct
Context: ...u may create a session that escapes the deriver's watchful eye by setting the `deriver_...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[grammar] ~42-~42: Use correct spacing
Context: ...et_or_create` on the session with a new configuration. ```python Python from honcho import Honcho # Initialize client honcho = Honcho() # C...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~48-~48: There might be a mistake here.
Context: ...from honcho import Honcho # Initialize client honcho = Honcho() # Create session with...
(QB_NEW_EN_OTHER)
[grammar] ~49-~49: Use correct spacing
Context: ...rt Honcho # Initialize client honcho = Honcho() # Create session with configuration sessio...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~51-~51: There might be a mistake here.
Context: ...oncho = Honcho() # Create session with configuration session = honcho.session("my-session", c...
(QB_NEW_EN_OTHER)
[grammar] ~52-~52: Use correct spacing
Context: ...y-session", config={"deriver_disabled": True}) typescript TypeScript import { Honcho } from "@honcho-ai/sdk"; // Initialize client const honcho = new Honcho({}); // Create session with configuration const session = await honcho.session("my-session", { config: { deriver_disabled: true } }); ``` ### Session-Peer Configuration Configuratio...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~65-~65: Use correct spacing
Context: ... }); ``` ### Session-Peer Configuration Configuration at the session-peer level ...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[style] ~67-~67: Consider a more concise word here.
Context: ... such that certain peers observe others in order to form "local representations" of them. T...
(IN_ORDER_TO_PREMIUM)
[grammar] ~67-~67: Use correct spacing
Context: ...ags that can be set at the session-peer level: - observe_me: Whether this peer should be observed...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~69-~69: Use correct spacing
Context: ...s overrides the peer-level observe_me flag. - observe_others: Whether this peer should produce local...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~71-~71: Use correct spacing
Context: ... observed if their observe_me flag is true. You can combine these flags across multi...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~73-~73: Correctly pair commas and coordinating conjunctions
Context: ... to true for at least one peer in the session and at least one other peer must have t...
(QB_NEW_EN_OTHER_ERROR_IDS_14)
[grammar] ~73-~73: Use correct spacing
Context: ...ust have their observe_me flag set to true. Many applications will work best without...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~75-~75: Use correct spacing
Context: ...ou are doing advanced reasoning on user perspectives.
You can dynamically change the configura...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~79-~79: Use hyphens correctly
Context: ...namically change the configuration of a session-peer by calling set_peer_config on th...
(QB_NEW_EN_OTHER_ERROR_IDS_29)
[grammar] ~79-~79: Use correct spacing
Context: ... peer and the configuration you want to set. ```python Python from honcho import Honcho # Initialize client honcho = Honcho() # C...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~85-~85: There might be a mistake here.
Context: ...from honcho import Honcho # Initialize client honcho = Honcho() # Create session sess...
(QB_NEW_EN_OTHER)
[grammar] ~86-~86: Use correct spacing
Context: ...rt Honcho # Initialize client honcho = Honcho() # Create session session = honcho.session(...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~88-~88: There might be a mistake here.
Context: ...lize client honcho = Honcho() # Create session session = honcho.session("my-session") ...
(QB_NEW_EN_OTHER)
[grammar] ~89-~89: Use correct spacing
Context: ... = Honcho() # Create session session = honcho.session("my-session") # Create peers alice = honcho.peer("alice"...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~91-~91: There might be a mistake here.
Context: ... honcho.session("my-session") # Create peers alice = honcho.peer("alice") bob = honch...
(QB_NEW_EN_OTHER)
[grammar] ~93-~93: Use correct spacing
Context: ...eers alice = honcho.peer("alice") bob = honcho.peer("bob") # Add peers to session with default config...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~95-~95: There might be a mistake here.
Context: ...") # Add peers to session with default configuration session.add_peers([alice, bob]) # Add a...
(QB_NEW_EN_OTHER)
[grammar] ~96-~96: Use correct spacing
Context: ...configuration session.add_peers([alice, bob]) # Add another peer to the session with a c...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~98-~98: There might be a mistake here.
Context: ...other peer to the session with a custom configuration charlie = honcho.peer("charlie") session...
(QB_NEW_EN_OTHER)
[grammar] ~100-~100: Use correct spacing
Context: ...{"observe_me": False, "observe_others": True}]) # Set session-peer configuration session.s...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~102-~102: There might be a mistake here.
Context: ...ve_others": True}]) # Set session-peer configuration session.set_peer_config(alice, {"observe...
(QB_NEW_EN_OTHER)
[grammar] ~104-~104: Use correct spacing
Context: ...ion.set_peer_config(bob, {"observe_me": False}) # Get session-peer configuration charlie_c...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~106-~106: There might be a mistake here.
Context: ...bserve_me": False}) # Get session-peer configuration charlie_config = session.get_peer_config...
(QB_NEW_EN_OTHER)
[grammar] ~107-~107: Use correct spacing
Context: ...nfig = session.get_peer_config(charlie) print(charlie_config) typescript TypeScript import { Honcho } from "@honcho-ai/sdk"; // Initialize client const honcho = new Honcho({}); // Create session const session = await honcho.session("my-session"); // Create peers const alice = await honcho.peer("alice"); const bob = await honcho.peer("bob"); // Add peers to session await session.addPeers([alice, bob]); // Add another peer to the session with a custom configuration const charlie = await honcho.peer("charlie"); await session.addPeers([charlie, { observe_me: false, observe_others: true }]); // Set session-peer configuration await session.setPeerConfig(alice, { observe_others: true }); await session.setPeerConfig(bob, { observe_me: false }); // Get session-peer configuration const charlieConfig = await session.getPeerConfig(charlie); console.log(charlieConfig); ```
(QB_NEW_EN_OTHER_ERROR_IDS_5)
🔇 Additional comments (59)
docs/v2/guides/telegram.mdx (1)
246-246: LGTM! Parameter name corrected.The change from
queries=querytoquery=querycorrectly aligns with the updated SDK method signature forpeer.chat().docs/v2/guides/dialectic-endpoint.mdx (1)
38-38: LGTM! Import statement updated for named export.The change from default import to named import correctly reflects the updated TypeScript SDK structure where
Honchois now a named export.docs/v2/guides/discord.mdx (1)
211-211: LGTM! Parameter name corrected for consistency.The change from
queries=querytoquery=querycorrectly aligns with the updated SDK method signature, maintaining consistency across all documentation examples.docs/v2/guides/streaming-response.mdx (2)
55-56: LGTM! Async/await pattern correctly applied.The addition of
awaittohoncho.peer()andhoncho.session()calls correctly reflects the SDK refactoring where these methods were converted to asynchronous operations.Also applies to: 59-59
179-180: LGTM! Consistent async/await implementation.The async/await pattern is consistently applied across all TypeScript examples, ensuring proper handling of the asynchronous peer and session creation methods.
Also applies to: 183-183
sdks/typescript/examples/get_context.ts (3)
1-1: LGTM! Message type import added.Adding the
Messagetype import supports explicit typing in the example, improving type safety and code clarity.
18-20: LGTM! Async/await correctly implemented.The addition of
awaittohoncho.peer()andhoncho.session()calls correctly handles the asynchronous operations in the updated SDK.Also applies to: 25-25
30-30: LGTM! Explicit typing improves type safety.Adding explicit typing
messages: Message[]provides better type safety and makes the code more self-documenting.docs/v2/guides/get-context.mdx (5)
32-32: LGTM! Correct asynchronous usage.The update to await the
session()method call aligns with the SDK changes that made this method asynchronous.
124-125: LGTM! Consistent asynchronous peer creation.Both peer creation calls are now correctly awaited, maintaining consistency with the updated SDK API.
298-300: LGTM! Proper async handling in chat loop example.The session and peer creation calls are correctly updated to use await, ensuring proper promise handling in the chat loop function.
359-359: LGTM! Consistent async session creation.The long session creation is correctly updated to await the promise, maintaining consistency across all examples.
394-396: LGTM! Multiple peer creations properly awaited.All three peer creation calls are correctly updated to use await, ensuring proper handling of the asynchronous operations for different assistant types.
sdks/typescript/examples/get_representation.ts (4)
1-1: LGTM! Added necessary Message type import.The addition of the
Messagetype import enables proper typing of the messages array, improving type safety.
18-20: LGTM! Peer creation calls properly awaited.All three peer creation calls are correctly updated to use await, ensuring proper handling of the asynchronous operations.
25-25: LGTM! Session creation properly awaited.The session creation call is correctly updated to use await, consistent with the asynchronous SDK changes.
30-30: LGTM! Explicit typing improves type safety.The explicit typing of the messages array as
Message[]provides better type safety and works well with the imported Message type.sdks/typescript/examples/search.ts (4)
1-1: Good addition of Message type import.Adding the
Messagetype import improves type safety and aligns with the SDK's enhanced TypeScript typing introduced in this PR.
18-21: LGTM: Proper async handling for resource creation.The addition of
awaitkeywords forpeer()andsession()calls correctly reflects the SDK's new asynchronous resource creation pattern, ensuring proper resolution before use.Also applies to: 27-27
37-37: Good type annotation for educational value.Explicitly typing the
messagesarray asMessage[]improves the example's educational value and demonstrates proper TypeScript usage.
51-54: Correctly updated to handle array-based search results.The changes from
.totalto.lengthand synchronous iteration properly reflect the SDK's architectural shift from paginated results to direct arrays, aligning with the hybrid search implementation using Reciprocal Rank Fusion.Also applies to: 59-62, 67-70
docs/v2/guides/file-uploads.mdx (3)
64-65: Documentation correctly updated for async SDK patterns.The addition of
awaitkeywords for session and peer creation properly reflects the SDK's new asynchronous resource creation pattern introduced in this PR.
69-69: Good simplification of upload method signature.The change from object parameters to positional arguments (
fileStream, user.id) simplifies the API and makes it more intuitive to use.
82-82: Parameter documentation correctly updated.The change to make
peer_idrequired ("Yes") for all uploads is properly documented and aligns with the simplified upload API that now requires explicit peer identification.sdks/typescript/src/index.ts (2)
4-4: Essential export for enhanced type safety.Adding the
Messageclass export enables proper typing in client code and supports the SDK's enhanced TypeScript integration demonstrated throughout the examples.
11-29: Comprehensive validation type exports enhance SDK usability.The extensive export of validation types provides developers with proper TypeScript interfaces for advanced SDK usage, supporting the enhanced validation system and improved type safety introduced in this PR.
docs/v2/documentation/core-concepts/configuration.mdx (4)
117-121: Proper async handling in TypeScript examples.The TypeScript examples correctly use
awaitfor session and peer creation, aligning with the SDK's new asynchronous resource creation patterns introduced in this PR.
1-9: Excellent documentation of configuration concepts.This new documentation page provides comprehensive and well-structured coverage of Honcho's configuration system, clearly explaining the three levels (peer, session, session-peer) and their interactions. The conceptual explanations are clear and valuable for developers.
27-27: No change needed for the Python peer creation example.The
peer()method in the Python SDK is defined as:def peer( self, id: str, *, metadata: dict[str, object] | None = None, config: dict[str, object] | None = None, ) -> Peer: ...Since
metadataandconfigare keyword‐only parameters, usinghoncho.peer("my-peer", config={"observe_me": False})is perfectly valid. The example matches the SDK signature and requires no update.Likely an incorrect or invalid review comment.
52-52: Session creation example is correct as-isThe Python
sessionmethod signature is:def session( self, id: str, *, metadata: dict[str, object] | None = None, config: dict[str, object] | None = None, ) -> Session: … return Session(id, …, config=config, metadata=metadata)Since both
metadataandconfigare keyword-only arguments (withmetadatadefaulting toNone), using:session = honcho.session("my-session", config={"deriver_disabled": True})is valid. No changes required.
Likely an incorrect or invalid review comment.
docs/v2/guides/search.mdx (7)
40-42: Documentation correctly updated for array-based search results.The shift from asynchronous iteration (
for await) to synchronous iteration (for) and the removal of pagination references properly reflect the new search architecture that returns direct arrays instead of paginated results.Also applies to: 71-73
65-65: Proper async handling added to examples.The addition of
awaitkeywords for session and peer creation correctly demonstrates the SDK's new asynchronous resource creation pattern, improving the accuracy of the documentation examples.Also applies to: 97-97, 137-138
109-166: Excellent addition of filters and limits documentation.The new "Filters and Limits" section effectively demonstrates the enhanced search capabilities, properly showing the use of the
filtersparameter (renamed fromfilter) and practical examples of time-based and metadata filtering. This greatly improves the usability of the search documentation.
95-95: Enhanced TypeScript examples with proper typing.The addition of explicit
Messagetype annotations and proper property access (.content) improves the educational value of the examples and demonstrates best practices for TypeScript usage with the SDK.Also applies to: 100-100, 104-104, 186-188, 193-193
201-209: Good simplification of conclusion section.The updated conclusion appropriately focuses on the key concepts (search scopes, result handling, and context building) while removing references to pagination that are no longer relevant with the new array-based search results.
133-133: Consistent parameter naming with API changes.The consistent use of
filters(plural) throughout the examples correctly reflects the API parameter renaming fromfiltertofilters, improving consistency across the SDK and documentation.Also applies to: 139-139, 147-147, 151-151, 159-159, 163-163
1-7: Comprehensive update aligns with architectural changes.The search guide has been effectively updated to reflect the hybrid search implementation with Reciprocal Rank Fusion, properly transitioning from paginated to array-based results while maintaining comprehensive coverage of search capabilities across different scopes.
sdks/typescript/src/session.ts (7)
1-22: Import changes look good!The new imports properly support the migration to
HonchoCoreclient and the addition of comprehensive Zod validation schemas.
24-60: SessionPeerConfig class improvements are excellent!The enhanced documentation and Zod validation in the constructor provide better type safety and clearer API contracts.
62-121: Excellent Session class documentation and constructor refactoring!The comprehensive documentation with examples greatly improves developer experience. The explicit
workspaceIdparameter and warning about direct constructor usage are appropriate design choices.
263-326: Peer configuration methods are well-implemented!The methods properly handle peer ID extraction, validate inputs with Zod, and correctly use the new HonchoCore client API.
328-387: Message handling methods are robust and well-documented!The implementation properly validates inputs, handles both single and array message additions, and supports filtered retrieval with the new API.
424-497: Context and search methods are excellently refactored!The use of options objects improves API ergonomics, and the enhanced search functionality with validated filters and limits provides better flexibility. The tiktoken note in the documentation is helpful for users.
499-594: File upload and utility methods are well-designed!The
uploadFilemethod's support for various file types throughUploadable, the comprehensiveworkingRepimplementation with proper ID extraction, and the addition oftoStringfor debugging all enhance the SDK's usability.sdks/typescript/__tests__/client.test.ts (7)
1-26: Mock setup looks good!The addition of
getOrCreatemethods for peers/sessions andderiverStatusfor workspaces aligns well with the new async resource creation pattern and status polling functionality.
94-123: Peer tests properly updated for async behavior!The conversion to async/await is correctly implemented, and the new test case for metadata and config properly validates the
getOrCreatecall parameters.
125-164: Filter parameter update is consistent!The rename from
filtertofiltersaligns with the API changes mentioned in the summary.
166-195: Session tests mirror peer test patterns appropriately!The async conversion and metadata/config test additions are implemented consistently with the peer tests.
347-396: Search tests correctly reflect the new API contract!The transition from paginated results to direct array returns and the updated parameter structure (
{ query, limit }) properly test the new search implementation.
398-449: New deriver status tests are comprehensive!Tests properly cover both scenarios (with and without options) and correctly handle the snake_case to camelCase conversion for the API response.
451-483: Polling tests cover essential scenarios!Both successful completion and timeout cases are properly tested.
sdks/typescript/src/peer.ts (8)
1-48: Clean refactor to HonchoCore with proper workspace scoping!The explicit workspace ID and validation schema imports improve type safety and API clarity.
67-99: Chat method improvements enhance usability and safety!The validation with
ChatQuerySchemaand flexible target handling (string or Peer) provide a robust API.
101-124: Session retrieval properly scoped and validated!Filter validation and workspace-scoped Session construction are implemented correctly.
126-150: Message creation with proper validation!Content and metadata validation ensure data integrity, and the snake_case
peer_idaligns with API conventions.
152-183: Metadata methods align with project's upsert philosophy!Using
getOrCreatefor retrieval is consistent with Honcho's preference for forgiving API behavior, as noted in the retrieved learnings.
185-216: Configuration methods provide granular control!The
observe_meflag for controlling derivation tasks is well-documented, and the implementation pattern is consistent with metadata methods.
218-249: Search method simplification improves developer experience!Returning a direct array of Messages instead of a Page wrapper simplifies usage, and the comprehensive validation ensures input safety.
251-259: Useful debugging addition!The
toStringmethod provides a clean string representation for debugging purposes.
There was a problem hiding this comment.
Actionable comments posted: 5
♻️ Duplicate comments (6)
docs/v2/documentation/core-concepts/configuration.mdx (4)
30-37: TypeScript peer example still passes config in the wrong parameter position.
This was flagged previously and remains unresolved. The SDK signature is
peer(name: string, metadata?: object, config?: PeerConfig), so the config object must be the third argument.-const peer = await honcho.peer("my-peer", { config: { observe_me: false } }); +const peer = await honcho.peer("my-peer", undefined, { observe_me: false });
55-62: TypeScript session example has the same parameter-ordering issue.The config object should be the third argument, not wrapped in an extra
configproperty.-const session = await honcho.session("my-session", { config: { deriver_disabled: true } }); +const session = await honcho.session("my-session", undefined, { deriver_disabled: true });
98-100: Pythonadd_peerscall mixes a peer object and a config dict in a list.
add_peersexpects a mapping of peer → config. Pass a dict instead of a heterogeneous list.-session.add_peers([charlie, {"observe_me": False, "observe_others": True}]) +session.add_peers({charlie: {"observe_me": False, "observe_others": True}})
124-128: TypeScriptaddPeerscall has the same mixing issue.
addPeersexpects an object mapping peer IDs to configs.-await session.addPeers([charlie, { observe_me: false, observe_others: true }]); +await session.addPeers({ [charlie.id]: { observe_me: false, observe_others: true } });src/utils/search.py (2)
94-98: Consider extracting the error message for reusability.The error message construction could be extracted to maintain consistency if this validation is needed elsewhere.
+ error_msg = f"Query exceeds maximum token limit of {settings.MAX_EMBEDDING_TOKENS}." except ValueError as e: raise ValidationException( - f"Query exceeds maximum token limit of {settings.MAX_EMBEDDING_TOKENS}." + error_msg, ) from e
207-222: Clarify limit handling logic in search functions.The expressions for
semantic_limitandfulltext_limitmultiply limit by 2 to get more results for fusion, which is reasonable. However, the logic could be clearer about why we're fetching more results.# Perform semantic search if enabled if settings.EMBED_MESSAGES: - # Get more results for fusion - semantic_limit = limit * 2 + # Fetch 2x results for better RRF fusion quality + semantic_limit = limit * 2 semantic_results = await _semantic_search( - db=db, query=query, stmt=stmt, limit=semantic_limit + db=db, query=query, stmt=stmt, limit=semantic_limit, ) search_results.append(semantic_results) # Perform full-text search - # Get more results for fusion - fulltext_limit = limit * 2 + # Fetch 2x results for better RRF fusion quality + fulltext_limit = limit * 2 fulltext_results = await _fulltext_search( - db=db, query=query, stmt=stmt, limit=fulltext_limit + db=db, query=query, stmt=stmt, limit=fulltext_limit, )
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
docs/changelog/introduction.mdx(1 hunks)docs/v2/documentation/core-concepts/configuration.mdx(1 hunks)src/utils/search.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/**/*.py
📄 CodeRabbit Inference Engine (CLAUDE.md)
src/**/*.py: Follow isort conventions with absolute imports preferred
snake_case for variables/functions; PascalCase for classes
Line length: 88 chars (Black compatible)
Explicit error handling with appropriate exception types
Docstrings: Use Google style docstrings
Use environment variables via python-dotenv (.env)
Use specific exception types (ResourceNotFoundException, ValidationException, etc.)
Proper logging with context instead of print statements
Files:
src/utils/search.py
🧠 Learnings (8)
📚 Learning: the honcho project prefers upsert behavior for update operations across all resources (sessions, pee...
Learnt from: Rajat-Ahuja1997
PR: plastic-labs/honcho#131
File: src/crud.py:503-505
Timestamp: 2025-06-18T14:50:59.967Z
Learning: The Honcho project prefers upsert behavior for update operations across all resources (sessions, peers, workspaces). Update operations should create the resource if it doesn't exist rather than failing fast. This is an explicit design decision that differs from typical REST semantics but provides a more forgiving API experience.
Applied to files:
docs/v2/documentation/core-concepts/configuration.mdx
📚 Learning: in the honcho project's configuration system (src/config.py), the intended precedence order for conf...
Learnt from: VVoruganti
PR: plastic-labs/honcho#115
File: src/config.py:68-77
Timestamp: 2025-05-28T22:30:23.218Z
Learning: In the Honcho project's configuration system (src/config.py), the intended precedence order for configuration values is: Environment variables (highest) > .env files > TOML config files > Default values (lowest). Environment variables and .env files should override TOML values to allow for deployment-time configuration overrides.
Applied to files:
docs/v2/documentation/core-concepts/configuration.mdx
📚 Learning: peer names in the honcho codebase are restricted to the pattern `r"^[a-za-z0-9_-]+$"` (same as sessi...
Learnt from: Rajat-Ahuja1997
PR: plastic-labs/honcho#166
File: migrations/versions/05486ce795d5_make_session_name_required_on_messages.py:60-114
Timestamp: 2025-07-21T20:57:42.135Z
Learning: Peer names in the Honcho codebase are restricted to the pattern `r"^[a-zA-Z0-9_-]+$"` (same as session names), which prevents SQL injection and JSON syntax errors when peer names are interpolated into SQL queries and JSON strings during migrations.
Applied to files:
docs/v2/documentation/core-concepts/configuration.mdx
📚 Learning: the `get_or_create_session` function in this codebase is designed to handle both session creation an...
Learnt from: dr-frmr
PR: plastic-labs/honcho#131
File: src/routers/sessions.py:206-213
Timestamp: 2025-06-18T20:42:06.458Z
Learning: The `get_or_create_session` function in this codebase is designed to handle both session creation and adding peers to existing sessions. When called with peers, it will add those peers to an existing session rather than creating a duplicate session.
Applied to files:
docs/v2/documentation/core-concepts/configuration.mdx
📚 Learning: applies to src/models.py : feature flags on workspace, peer, and session levels...
Learnt from: CR
PR: plastic-labs/honcho#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T14:51:09.913Z
Learning: Applies to src/models.py : Feature flags on workspace, peer, and session levels
Applied to files:
docs/v2/documentation/core-concepts/configuration.mdx
📚 Learning: when renaming parameters to avoid shadowing built-ins, prefer `filters` over `filter_dict` for filte...
Learnt from: VVoruganti
PR: plastic-labs/honcho#140
File: src/utils/filter.py:51-53
Timestamp: 2025-06-26T15:20:35.428Z
Learning: When renaming parameters to avoid shadowing built-ins, prefer `filters` over `filter_dict` for filter/filtering parameters as it's cleaner and more concise.
Applied to files:
docs/changelog/introduction.mdx
📚 Learning: the codebase uses a layered error handling approach where the crud layer raises valueerror for busin...
Learnt from: Rajat-Ahuja1997
PR: plastic-labs/honcho#131
File: src/crud.py:374-377
Timestamp: 2025-06-18T21:24:55.907Z
Learning: The codebase uses a layered error handling approach where the CRUD layer raises ValueError for business rule violations (like peer limits), and the API layer catches these ValueError exceptions and translates them to appropriate domain-specific exceptions (ValidationException for validation errors, ResourceNotFoundException for missing resources). This provides clean separation of concerns between business logic and HTTP semantics.
Applied to files:
src/utils/search.py
📚 Learning: applies to src/{models,crud}.py : token counting on messages for usage tracking...
Learnt from: CR
PR: plastic-labs/honcho#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T14:51:09.913Z
Learning: Applies to src/{models,crud}.py : Token counting on messages for usage tracking
Applied to files:
src/utils/search.py
🧬 Code Graph Analysis (1)
src/utils/search.py (5)
sdks/python/src/honcho/async_client/session.py (1)
search(448-478)src/exceptions.py (1)
ValidationException(29-33)src/utils/filter.py (1)
apply_filter(50-97)src/embedding_client.py (1)
embed(39-50)src/models.py (1)
MessageEmbedding(233-274)
🪛 LanguageTool
docs/v2/documentation/core-concepts/configuration.mdx
[grammar] ~7-~7: Ensure spelling is correct
Context: ...onfigured to change the behavior of the deriver, which is responsible for generating an...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[grammar] ~7-~7: Use correct spacing
Context: ... and storing facts, summaries, and user representations. These configurations can be set at the p...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~9-~9: Use correct spacing
Context: ...A the state of a peer within a specific session). ### Peer Configuration By default, all peer...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~11-~11: Use correct spacing
Context: ...r within a specific session). ### Peer Configuration By default, all peers are "observed" by ...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~13-~13: Use correct spacing
Context: ...rogram will never need to ask questions about. You may therefore disable observation of...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~15-~15: Use correct spacing
Context: ...erve_meflag in their configuration tofalse`. If the peer has a session-level configur...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~17-~17: Use commas correctly
Context: ... this configuration. If the flag is not set, or is set to true, the peer will be ob...
(QB_NEW_EN_OTHER_ERROR_IDS_33)
[grammar] ~17-~17: Use correct spacing
Context: ..., or is set to true, the peer will be observed. ```python Python from honcho import Honcho # Initialize client honcho = Honcho() # C...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~23-~23: There might be a mistake here.
Context: ...from honcho import Honcho # Initialize client honcho = Honcho() # Create peer with co...
(QB_NEW_EN_OTHER)
[grammar] ~24-~24: Use correct spacing
Context: ...rt Honcho # Initialize client honcho = Honcho() # Create peer with configuration peer = ho...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~26-~26: There might be a mistake here.
Context: ...t honcho = Honcho() # Create peer with configuration peer = honcho.peer("my-peer", config={"o...
(QB_NEW_EN_OTHER)
[grammar] ~27-~27: Use correct spacing
Context: ...o.peer("my-peer", config={"observe_me": False}) typescript TypeScript import { Honcho } from "@honcho-ai/sdk"; // Initialize client const honcho = new Honcho({}); // Create peer with configuration const peer = await honcho.peer("my-peer", { config: { observe_me: false } }); ``` ### Session Configuration By default, all s...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~40-~40: Use correct spacing
Context: ...lse } }); ``` ### Session Configuration By default, all sessions have the derive...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~42-~42: Ensure spelling is correct
Context: ...tion By default, all sessions have the deriver enabled, much like peers. You may creat...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[grammar] ~42-~42: Ensure spelling is correct
Context: ...u may create a session that escapes the deriver's watchful eye by setting the `deriver_...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[grammar] ~42-~42: Use correct spacing
Context: ...et_or_create` on the session with a new configuration. ```python Python from honcho import Honcho # Initialize client honcho = Honcho() # C...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~48-~48: There might be a mistake here.
Context: ...from honcho import Honcho # Initialize client honcho = Honcho() # Create session with...
(QB_NEW_EN_OTHER)
[grammar] ~49-~49: Use correct spacing
Context: ...rt Honcho # Initialize client honcho = Honcho() # Create session with configuration sessio...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~51-~51: There might be a mistake here.
Context: ...oncho = Honcho() # Create session with configuration session = honcho.session("my-session", c...
(QB_NEW_EN_OTHER)
[grammar] ~52-~52: Use correct spacing
Context: ...y-session", config={"deriver_disabled": True}) typescript TypeScript import { Honcho } from "@honcho-ai/sdk"; // Initialize client const honcho = new Honcho({}); // Create session with configuration const session = await honcho.session("my-session", { config: { deriver_disabled: true } }); ``` ### Session-Peer Configuration Configuratio...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~65-~65: Use correct spacing
Context: ... }); ``` ### Session-Peer Configuration Configuration at the session-peer level ...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[style] ~67-~67: Consider a more concise word here.
Context: ... such that certain peers observe others in order to form "local representations" of them. T...
(IN_ORDER_TO_PREMIUM)
[grammar] ~67-~67: Use correct spacing
Context: ...ags that can be set at the session-peer level: - observe_me: Whether this peer should be observed...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~69-~69: Use correct spacing
Context: ...s overrides the peer-level observe_me flag. - observe_others: Whether this peer should produce local...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~71-~71: Use correct spacing
Context: ... observed if their observe_me flag is true. You can combine these flags across multi...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~73-~73: Correctly pair commas and coordinating conjunctions
Context: ... to true for at least one peer in the session and at least one other peer must have t...
(QB_NEW_EN_OTHER_ERROR_IDS_14)
[grammar] ~73-~73: Use correct spacing
Context: ...ust have their observe_me flag set to true. Many applications will work best without...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~75-~75: Use correct spacing
Context: ...ou are doing advanced reasoning on user perspectives.
You can dynamically change the configura...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~79-~79: Use hyphens correctly
Context: ...namically change the configuration of a session-peer by calling set_peer_config on th...
(QB_NEW_EN_OTHER_ERROR_IDS_29)
[grammar] ~79-~79: Use correct spacing
Context: ... peer and the configuration you want to set. ```python Python from honcho import Honcho # Initialize client honcho = Honcho() # C...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~85-~85: There might be a mistake here.
Context: ...from honcho import Honcho # Initialize client honcho = Honcho() # Create session sess...
(QB_NEW_EN_OTHER)
[grammar] ~86-~86: Use correct spacing
Context: ...rt Honcho # Initialize client honcho = Honcho() # Create session session = honcho.session(...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~88-~88: There might be a mistake here.
Context: ...lize client honcho = Honcho() # Create session session = honcho.session("my-session") ...
(QB_NEW_EN_OTHER)
[grammar] ~89-~89: Use correct spacing
Context: ... = Honcho() # Create session session = honcho.session("my-session") # Create peers alice = honcho.peer("alice"...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~91-~91: There might be a mistake here.
Context: ... honcho.session("my-session") # Create peers alice = honcho.peer("alice") bob = honch...
(QB_NEW_EN_OTHER)
[grammar] ~93-~93: Use correct spacing
Context: ...eers alice = honcho.peer("alice") bob = honcho.peer("bob") # Add peers to session with default config...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~95-~95: There might be a mistake here.
Context: ...") # Add peers to session with default configuration session.add_peers([alice, bob]) # Add a...
(QB_NEW_EN_OTHER)
[grammar] ~96-~96: Use correct spacing
Context: ...configuration session.add_peers([alice, bob]) # Add another peer to the session with a c...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~98-~98: There might be a mistake here.
Context: ...other peer to the session with a custom configuration charlie = honcho.peer("charlie") session...
(QB_NEW_EN_OTHER)
[grammar] ~100-~100: Use correct spacing
Context: ...{"observe_me": False, "observe_others": True}]) # Set session-peer configuration session.s...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~102-~102: There might be a mistake here.
Context: ...ve_others": True}]) # Set session-peer configuration session.set_peer_config(alice, {"observe...
(QB_NEW_EN_OTHER)
[grammar] ~104-~104: Use correct spacing
Context: ...ion.set_peer_config(bob, {"observe_me": False}) # Get session-peer configuration charlie_c...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~106-~106: There might be a mistake here.
Context: ...bserve_me": False}) # Get session-peer configuration charlie_config = session.get_peer_config...
(QB_NEW_EN_OTHER)
[grammar] ~107-~107: Use correct spacing
Context: ...nfig = session.get_peer_config(charlie) print(charlie_config) typescript TypeScript import { Honcho } from "@honcho-ai/sdk"; // Initialize client const honcho = new Honcho({}); // Create session const session = await honcho.session("my-session"); // Create peers const alice = await honcho.peer("alice"); const bob = await honcho.peer("bob"); // Add peers to session await session.addPeers([alice, bob]); // Add another peer to the session with a custom configuration const charlie = await honcho.peer("charlie"); await session.addPeers([charlie, { observe_me: false, observe_others: true }]); // Set session-peer configuration await session.setPeerConfig(alice, { observe_others: true }); await session.setPeerConfig(bob, { observe_me: false }); // Get session-peer configuration const charlieConfig = await session.getPeerConfig(charlie); console.log(charlieConfig); ```
(QB_NEW_EN_OTHER_ERROR_IDS_5)
🪛 Ruff (0.12.2)
src/utils/search.py
24-24: Trailing comma missing
Add trailing comma
(COM812)
95-97: Avoid specifying long messages outside the exception class
(TRY003)
96-96: Trailing comma missing
Add trailing comma
(COM812)
132-132: Trailing comma missing
Add trailing comma
(COM812)
139-139: Trailing comma missing
Add trailing comma
(COM812)
144-144: Trailing comma missing
Add trailing comma
(COM812)
149-149: Trailing comma missing
Add trailing comma
(COM812)
212-212: Trailing comma missing
Add trailing comma
(COM812)
220-220: Trailing comma missing
Add trailing comma
(COM812)
🔇 Additional comments (2)
src/utils/search.py (1)
131-133: Add trailing commas for consistency.# Check if query contains special characters that FTS might not handle well has_special_chars = bool( - re.search(r'[~`!@#$%^&*()_+=\[\]{};\':"\\|,.<>/?-]', query) + re.search(r'[~`!@#$%^&*()_+=\[\]{};\':"\\|,.<>/?-]', query), ) if has_special_chars: # For queries with special characters, use exact string matching (ILIKE) search_condition = models.Message.content.ilike(f"%{query}%") fulltext_query = stmt.where(search_condition).order_by( - models.Message.created_at.desc() + models.Message.created_at.desc(), ) else: # For natural language queries, use full text search with ranking fts_condition = func.to_tsvector("english", models.Message.content).op("@@")( - func.plainto_tsquery("english", query) + func.plainto_tsquery("english", query), ) # Combine FTS with ILIKE as fallback for better coverage combined_condition = or_( - fts_condition, models.Message.content.ilike(f"%{query}%") + fts_condition, models.Message.content.ilike(f"%{query}%"), )Also applies to: 138-145, 148-151
⛔ Skipped due to learnings
Learnt from: VVoruganti PR: plastic-labs/honcho#164 File: sdks/python/src/honcho/async_client/peer.py:136-136 Timestamp: 2025-07-21T15:53:20.965Z Learning: The honcho repository should have COM812 (trailing comma missing) rule disabled in the root pyproject.toml Ruff configuration by adding it to the existing ignore list: ignore = ["E501", "B008", "COM812"]. The maintainers do not want trailing comma suggestions in code reviews.Learnt from: Rajat-Ahuja1997 PR: plastic-labs/honcho#144 File: tests/integration/test_message_embeddings.py:128-187 Timestamp: 2025-06-26T18:35:46.478Z Learning: The honcho repository does not use trailing commas in function signatures, function calls, or object instantiation. This is consistently applied across the entire codebase including test files, and reviews should not suggest adding trailing commas.Learnt from: VVoruganti PR: plastic-labs/honcho#164 File: sdks/python/src/honcho/async_client/peer.py:136-136 Timestamp: 2025-07-21T15:53:20.965Z Learning: The honcho repository maintainers do not want trailing comma suggestions or complaints from static analysis tools like Ruff. The COM812 rule should be disabled in the Ruff configuration to avoid these suggestions in future reviews.docs/changelog/introduction.mdx (1)
30-40: LGTM! Changelog properly documents the breaking changes.The changelog entry correctly:
- Includes a reference link for RRF (addressing the previous review comment)
- Places the
filter→filtersrename in the "Changed" section as a breaking change (addressing the previous review comment)- Clearly documents the new search limits
There was a problem hiding this comment.
Actionable comments posted: 2
🔭 Outside diff range comments (1)
tests/routes/test_peers.py (1)
469-497: LGTM! Function refactored to test limit functionality.The rename from
test_search_peer_with_semantic_search_true_disabledtotest_search_peer_with_limitand the implementation changes properly test the new limit parameter functionality, which is more relevant than the deprecated semantic search parameters.Consider addressing the static analysis suggestions for better code consistency:
-def test_search_peer_with_limit( +def test_search_peer_with_limit( client: TestClient, sample_data: tuple[Workspace, Peer] -): +) -> None: """Test peer search with custom limit""" test_workspace, test_peer = sample_data # Add some messages to search through client.post( f"/v2/workspaces/{test_workspace.name}/peers/{test_peer.name}/sessions/test_session/messages", json={ "messages": [ {"content": "Search this content", "peer_id": test_peer.name}, {"content": "Another searchable message", "peer_id": test_peer.name}, - {"content": "More searchable content", "peer_id": test_peer.name}, + {"content": "More searchable content", "peer_id": test_peer.name}, ] - }, + }, )
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
tests/routes/test_messages.py(6 hunks)tests/routes/test_peers.py(11 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
tests/**/*.py
📄 CodeRabbit Inference Engine (CLAUDE.md)
Tests in pytest with fixtures in tests/conftest.py
Files:
tests/routes/test_messages.pytests/routes/test_peers.py
🧠 Learnings (4)
📚 Learning: when renaming parameters to avoid shadowing built-ins, prefer `filters` over `filter_dict` for filte...
Learnt from: VVoruganti
PR: plastic-labs/honcho#140
File: src/utils/filter.py:51-53
Timestamp: 2025-06-26T15:20:35.428Z
Learning: When renaming parameters to avoid shadowing built-ins, prefer `filters` over `filter_dict` for filter/filtering parameters as it's cleaner and more concise.
Applied to files:
tests/routes/test_messages.py
📚 Learning: peer names in the honcho codebase are restricted to the pattern `r"^[a-za-z0-9_-]+$"` (same as sessi...
Learnt from: Rajat-Ahuja1997
PR: plastic-labs/honcho#166
File: migrations/versions/05486ce795d5_make_session_name_required_on_messages.py:60-114
Timestamp: 2025-07-21T20:57:42.135Z
Learning: Peer names in the Honcho codebase are restricted to the pattern `r"^[a-zA-Z0-9_-]+$"` (same as session names), which prevents SQL injection and JSON syntax errors when peer names are interpolated into SQL queries and JSON strings during migrations.
Applied to files:
tests/routes/test_peers.py
📚 Learning: in fastapi tests, it's common to use @pytest.mark.asyncio with a synchronous testclient. the async m...
Learnt from: Rajat-Ahuja1997
PR: plastic-labs/honcho#131
File: tests/routes/test_messages.py:7-39
Timestamp: 2025-06-18T15:47:44.327Z
Learning: In FastAPI tests, it's common to use pytest.mark.asyncio with a synchronous TestClient. The async marker is used when tests contain async database operations (like await db_session.commit()), but the HTTP client calls (client.post(), client.get()) should NOT be awaited since TestClient is synchronous. Only the actual async operations like database commits need awaiting.
Applied to files:
tests/routes/test_peers.py
📚 Learning: applies to src/models.py : feature flags on workspace, peer, and session levels...
Learnt from: CR
PR: plastic-labs/honcho#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T14:51:09.913Z
Learning: Applies to src/models.py : Feature flags on workspace, peer, and session levels
Applied to files:
tests/routes/test_peers.py
🪛 Ruff (0.12.2)
tests/routes/test_peers.py
146-146: Trailing comma missing
Add trailing comma
(COM812)
161-161: Trailing comma missing
Add trailing comma
(COM812)
440-440: Missing return type annotation for public function test_search_peer_with_messages
Add return type annotation: None
(ANN201)
441-441: Trailing comma missing
Add trailing comma
(COM812)
469-469: Missing return type annotation for public function test_search_peer_with_limit
Add return type annotation: None
(ANN201)
470-470: Trailing comma missing
Add trailing comma
(COM812)
483-483: Trailing comma missing
Add trailing comma
(COM812)
🔇 Additional comments (18)
tests/routes/test_messages.py (6)
274-274: LGTM! Parameter rename improves API consistency.The change from
"filter"to"filters"aligns with the API standardization mentioned in the PR objectives and follows the retrieved learning about preferring cleaner filter parameter names.
307-307: LGTM! Consistent parameter naming.The parameter rename maintains the same test behavior while improving API consistency across the codebase.
380-380: LGTM! Parameter rename preserves test functionality.The change from
"filter"to"filters"maintains the metadata filtering test logic while aligning with the standardized API parameter naming.
435-435: LGTM! Complex filter test updated consistently.The parameter rename maintains the complex metadata filtering logic while following the standardized API parameter naming convention.
447-447: LGTM! AND operator filter test updated.The parameter rename preserves the AND operator filtering test functionality while aligning with the consistent API parameter naming.
464-464: LGTM! OR operator filter test updated.The parameter rename maintains the OR operator filtering test logic while following the standardized API parameter naming convention.
tests/routes/test_peers.py (12)
1-2: LGTM! Import supports type annotations.The
typing.Anyimport is necessary for the type annotations used in the updated test functions, improving code clarity and type safety.
118-118: LGTM! Parameter rename improves API consistency.The change from
"filter"to"filters"aligns with the API standardization while preserving the peer metadata filtering test logic.
129-129: LGTM! NOT operator filter test updated consistently.The parameter rename maintains the NOT operator filtering test functionality while following the standardized API parameter naming convention.
300-300: LGTM! Session filter parameter updated.The parameter rename aligns with the API standardization while maintaining the peer session filtering test functionality.
396-396: LGTM! Search API updated with limit parameter.The addition of the
"limit": 10parameter correctly reflects the new search API functionality introduced as part of the RRF search improvements.
401-402: LGTM! Response format updated for new search API.The change correctly updates the test to expect a direct list of messages instead of paginated results, aligning with the new search API behavior introduced in the RRF implementation.
414-414: LGTM! Empty query search updated consistently.The addition of the limit parameter maintains consistency with the updated search API across all test scenarios.
419-420: LGTM! Empty query test updated for new response format.The response format update maintains consistency with the new search API behavior across all test scenarios.
432-432: LGTM! Nonexistent peer search updated consistently.The limit parameter addition ensures consistency across all search test scenarios, including edge cases.
435-437: LGTM! Nonexistent peer test updated with proper type handling.The changes correctly update the test to expect a direct list response with proper type annotations, ensuring consistency with the new search API behavior.
457-466: LGTM! Search with messages test updated correctly.The changes properly update the test to use the new search API with limit parameter and direct list response format while preserving the core message search functionality.
161-161: LGTM! Null filter test updated consistently.The parameter rename maintains the null filter test logic while following the standardized API parameter naming.
Consider adding a trailing comma for consistency:
- f"/v2/workspaces/{test_workspace.name}/peers/list", json={"filters": None} + f"/v2/workspaces/{test_workspace.name}/peers/list", json={"filters": None},⛔ Skipped due to learnings
Learnt from: VVoruganti PR: plastic-labs/honcho#164 File: sdks/python/src/honcho/async_client/peer.py:136-136 Timestamp: 2025-07-21T15:53:20.965Z Learning: The honcho repository maintainers do not want trailing comma suggestions or complaints from static analysis tools like Ruff. The COM812 rule should be disabled in the Ruff configuration to avoid these suggestions in future reviews.Learnt from: VVoruganti PR: plastic-labs/honcho#164 File: sdks/python/src/honcho/async_client/peer.py:136-136 Timestamp: 2025-07-21T15:53:20.965Z Learning: The honcho repository should have COM812 (trailing comma missing) rule disabled in the root pyproject.toml Ruff configuration by adding it to the existing ignore list: ignore = ["E501", "B008", "COM812"]. The maintainers do not want trailing comma suggestions in code reviews.Learnt from: Rajat-Ahuja1997 PR: plastic-labs/honcho#144 File: tests/integration/test_message_embeddings.py:128-187 Timestamp: 2025-06-26T18:35:46.478Z Learning: The honcho repository does not use trailing commas in function signatures, function calls, or object instantiation. This is consistently applied across the entire codebase including test files, and reviews should not suggest adding trailing commas.
|
|
||
| response = client.post( | ||
| f"/v2/workspaces/{test_workspace.name}/peers/list", json={"filter": {}} | ||
| f"/v2/workspaces/{test_workspace.name}/peers/list", json={"filters": {}} |
There was a problem hiding this comment.
🧹 Nitpick (assertive)
LGTM! Parameter rename improves consistency.
The change from "filter" to "filters" aligns with the API standardization.
Consider adding a trailing comma for consistency with Python formatting conventions:
- f"/v2/workspaces/{test_workspace.name}/peers/list", json={"filters": {}}
+ f"/v2/workspaces/{test_workspace.name}/peers/list", json={"filters": {}},Committable suggestion skipped: line range outside the PR's diff.
🧰 Tools
🪛 Ruff (0.12.2)
146-146: Trailing comma missing
Add trailing comma
(COM812)
🤖 Prompt for AI Agents
In tests/routes/test_peers.py at line 146, add a trailing comma after the json
dictionary argument in the function call to maintain consistency with Python
formatting conventions and improve readability.
| client: TestClient, sample_data: tuple[Workspace, Peer] | ||
| ): | ||
| """Test peer search with semantic=false""" | ||
| """Test peer search with actual messages""" | ||
| test_workspace, test_peer = sample_data | ||
|
|
There was a problem hiding this comment.
🧹 Nitpick (assertive)
LGTM! Function rename improves clarity.
The rename from test_search_peer_with_semantic_search_false to test_search_peer_with_messages better reflects the actual test purpose and removes deprecated parameter references.
Consider adding the return type annotation for consistency:
-def test_search_peer_with_messages(
+def test_search_peer_with_messages(
client: TestClient, sample_data: tuple[Workspace, Peer]
-):
+) -> None:📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| def test_search_peer_with_messages( | |
| client: TestClient, sample_data: tuple[Workspace, Peer] | |
| ): | |
| """Test peer search with semantic=false""" | |
| """Test peer search with actual messages""" | |
| test_workspace, test_peer = sample_data | |
| def test_search_peer_with_messages( | |
| client: TestClient, sample_data: tuple[Workspace, Peer] | |
| ) -> None: | |
| """Test peer search with actual messages""" | |
| test_workspace, test_peer = sample_data |
🧰 Tools
🪛 Ruff (0.12.2)
440-440: Missing return type annotation for public function test_search_peer_with_messages
Add return type annotation: None
(ANN201)
441-441: Trailing comma missing
Add trailing comma
(COM812)
🤖 Prompt for AI Agents
In tests/routes/test_peers.py around lines 440 to 444, the function
test_search_peer_with_messages lacks a return type annotation. Add the return
type annotation -> None to the function definition to maintain consistency and
clarity in the codebase.
* chore: fill out missing metadata inputs in python sdk * feat: add get_peer_config to python sdk, thoroughly document ts sdk and remove bad client usage * feat: zod chore: update tests chore: bump version, changelog * chore: python sdk version bump and changelog * [WIP] feat: combine search methods and rework endpoint to include limit param * chore: test new stainless config with library * nits: coderabbit * Merge branch 'ben/sdk-improvements' into ben/search-rrf * chore: pre-commit hooks cleanup * feat: thoroughly document observation config * Update sdks/python/src/honcho/peer.py Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * chore: v1.3.0 * feat: update version to 2.2.0 and enhance search functionality with arbitrary filters - Remove unused config variables - Added arbitrary filters to all search endpoints. - Pluralize `filters` everywhere in SDKs for consistency - Updated documentation and changelog to reflect these changes. * expose core client in TS and Python SDKs (plastic-labs#150) * expose core client from sdks * align text * fix: resolve get_effective_observe me race condition, default peer config (plastic-labs#176) * fix: resolve get_effective_observe me race condition, default peer config * fix: preserve custom config even after leaving * chore: test cases, enqueue types * Update sdks/typescript/package.json Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: doria <93405247+dr-frmr@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * chore: formatting * chore: revert undesired changes to v1 spec, clean up docs, coderabbit * feat: better search docs, fix worker.ts * fix: correctly make ts params optional in cases, update docs * chore: coderabbit * chore: remove spurious package-lock * fix: asyncify examples, use limit properly in search * fix(tests): handle 4 return values in test_get_session_peer_configuration --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Rajat Ahuja <rahuja445@gmail.com>
fixes DEV-978, DEV-1026
Summary by CodeRabbit
New Features
API Changes
filtertofiltersacross all endpoints and SDKs.SDK Updates
Documentation
Bug Fixes & Refactor
Chores & Style