Skip to content

Add remote codebase indexing stubs and proto definitions#10536

Open
moirahuang wants to merge 1 commit intomasterfrom
moira/app-3792-pr4-daemon-index-codebase
Open

Add remote codebase indexing stubs and proto definitions#10536
moirahuang wants to merge 1 commit intomasterfrom
moira/app-3792-pr4-daemon-index-codebase

Conversation

@moirahuang
Copy link
Copy Markdown
Contributor

This change adds placeholder stubs and messages for remote codebase indexing.

  • Adds ListCodebaseIndexStatuses, IndexCodebase, and DropCodebaseIndex messages to the protobuf definitions.
  • Implements handle_list_codebase_index_statuses, handle_index_codebase, and handle_drop_codebase_index methods in ServerModel. These methods currently log placeholder messages.
  • Adds a codebase_index_status_sent_roots_by_connection field to ServerModel to track which git repos have had their initial status pushed to the client.
  • The client now has the ability to send ListCodebaseIndexStatuses requests.
  • When navigating to a git repo, the server now sends a NotEnabled status update to the client.

@cla-bot cla-bot Bot added the cla-signed label May 9, 2026
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 9, 2026

@moirahuang

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

This PR adds remote codebase indexing protobuf messages, client/manager request stubs, server placeholder handlers, and first-seen NotEnabled status pushes for git repos.

Concerns

  • ServerModel now has a required field, but the existing server model test fixture still constructs it with a struct literal, so the app tests will fail to compile.
  • The new navigation status tracking can recreate per-connection state after a connection has already been deregistered, leaving stale entries behind for dead connections.
  • Index/drop requests can send the current user's auth token through an arbitrary connected session for the host instead of a session whose identity_key matches the current auth context.

Security

  • The index/drop mutation path should mirror rotate_auth_token's identity-key filtering before retrieving and sending the current bearer token.

Verdict

Found: 1 critical, 2 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

/// Until the daemon has a persisted indexing manager, first-seen git repos
/// become explicit `NotEnabled` entries so the client can observe the repo
/// instead of treating an absent status as meaningful state.
codebase_index_status_sent_roots_by_connection:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 [CRITICAL] Adding this required field breaks the test_model() struct literal in app/src/remote_server/server_model_tests.rs; update that fixture or construct through ServerModel::new so the app tests compile.

if is_git {
let should_send_status = me
.codebase_index_status_sent_roots_by_connection
.entry(conn_id_for_response)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [IMPORTANT] If git detection resolves after deregister_connection removed this connection, entry(...).or_default() recreates state for a dead connection and it is never cleaned up; use get_mut and skip the push when the connection entry is gone.

+ Send
+ 'static,
{
let Some((session_id, client, remote_identity_key)) =
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [IMPORTANT] [SECURITY] This selects any session for the host, but the async block later sends the current user's bearer token through it; filter by auth_context.remote_server_identity_key() like rotate_auth_token before selecting the client to avoid leaking tokens to stale sessions from another identity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant