Skip to content

refactor(runtime-host)!: remove unused Session catalog filters (#3071) - #3165

Merged
Astro-Han merged 1 commit into
apache:mainfrom
somewan820:refactor/remove-session-catalog-filters-3071
Aug 18, 2026
Merged

refactor(runtime-host)!: remove unused Session catalog filters (#3071)#3165
Astro-Han merged 1 commit into
apache:mainfrom
somewan820:refactor/remove-session-catalog-filters-3071

Conversation

@somewan820

@somewan820 somewan820 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Closes #3071

Summary

Removes the unused isArchived / isFlagged / labelSlug filters from the Session catalog wire contract, coordinator, Desktop IPC passthrough, and storage query construction. subagentParentSessionId filtering is preserved.

Changes

  • Protocol: session.catalog.query list_start/list_continue no longer accept filters; pagination cursors no longer carry a filter; RUNTIME_HOST_COMPATIBILITY_EPOCH bumped 22 -> 24 (renumbered after fix(session): migrate legacy session statuses #3159 took epoch 23).
  • Coordinator/client: filter canonicalization/validation and continuation-filter matching removed; readRuntimeHostSessions and DesktopRuntimeHostClient.listSessions are filter-free.
  • Desktop: sessions:list still supports subagentParentSessionId via local filtering. The IPC boundary now strictly accepts only that key and rejects stale isArchived / isFlagged / labelSlug filter keys instead of silently returning the unfiltered catalog.
  • Storage: session_metadata_labels and session_catalog_label_projection tables, their triggers/indexes, and replaceLabels maintenance are removed; archive/flag filter indexes dropped; schema v26 migration added on top of #3159s v25 migration.
  • Behavior preserved: Session labels, isFlagged, isArchived remain readable/mutable and are still projected in the catalog.

Verification

  • Storage full suite: 814 tests pass.
  • Desktop main full suite: 901 tests pass; UDS coverage now also rejects the removed filter keys at the sessions:list boundary.
  • Runtime Host Session catalog protocol/coordinator/UDS tests pass, including new coverage rejecting filtered inputs and legacy filtered cursors.
  • Root workspace typecheck and Biome format/lint pass.
  • Verified a v24 -> v25 -> v26 upgrade preserves Session metadata, applies the legacy status migration, and removes label replicas.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Codex (OpenAI) — implementation, tests, and schema migration for removing the unused Session catalog filters; the contributor reviewed the output and owns the final result. The commit carries Generated-by: Codex.

Breaking change

A protocol client can no longer ask Runtime Host to filter the catalog by archive state, flag state, or label; clients must read the catalog and filter locally. No shipped client depends on the removed capability.

@hqhq1025
hqhq1025 requested a lite review from Copilot August 17, 2026 10:02
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1d38d88c-133a-43fd-af94-1840c37291da

📥 Commits

Reviewing files that changed from the base of the PR and between 01fa427 and 2e2d132.

📒 Files selected for processing (1)
  • apps/desktop/src/main/runtime-host-client.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/desktop/src/main/runtime-host-client.ts

Included review availability: Your plan includes up to 3 reviews per rolling hour; 2 remain after this review.


📝 Walkthrough

Summary

This PR removes unused isArchived, isFlagged, and labelSlug filters from the Session catalog contract. Clients must filter these values locally. subagentParentSessionId filtering remains available.

The change updates the protocol, coordinator, Desktop IPC, runtime client, and SQLite query construction. Pagination cursors no longer carry filter data. The compatibility epoch increases to 24.

Source of truth

This PR extends the existing Session metadata and catalog paths. It does not create a parallel path. Labels, archive state, and flag state remain readable, mutable, and included in catalog projections.

Migration v26 removes label replica tables, triggers, indexes, and synchronization code. Existing Session metadata remains in the primary metadata store.

Scope and complexity

The change is the smallest coherent solution for removing the unused wire filters. It removes related validation, cursor state, SQL predicates, replica maintenance, and obsolete tests while preserving child-Session filtering and metadata behavior.

The compatibility epoch and schema migration are necessary because the wire contract and SQLite schema change.

Tests that only verify removed filtered queries were deleted or simplified. Regression coverage remains for unfiltered pagination, revision handling, rejected filters and legacy cursors, metadata preservation, label and flag state, archive state, and catalog projections.

Further deletion should not remove coverage for strict filter rejection, legacy cursor rejection, pagination, or migration metadata preservation.

Risks and validation

  • This is a breaking protocol change. Older clients that send removed filters receive invalid requests.
  • Archive, flag, and label filtering moves to clients. This can affect client behavior and query efficiency.
  • Schema migration v26 must preserve Session metadata while removing label replicas and filter indexes.
  • Catalog pagination now uses unfiltered cursors. Continuation requests must remain valid across revisions.
  • Reported storage, Desktop UDS, Runtime Host, workspace typecheck, formatting, lint, and upgrade checks are not independently verified here.

Review-relevant risks

The current diff has a material public wire-contract and release-compatibility effect through the removed filters and compatibility epoch change. Material changes in this area require independent human review under repository policy.

The current diff has a material data-migration effect through schema migration v26 and removal of label replica tables. Material changes in this area require independent human review under repository policy.

The person performing the merge reviews the final diff. A maintainer makes the final determination.

Walkthrough

The session catalog no longer supports archive, flag, or label filters. Storage removes label projections and related maintenance. Runtime Host cursors and protocol inputs are simplified. Desktop reads the complete catalog and retains local subagent-parent filtering.

Changes

Session Catalog Filter Removal

Layer / File(s) Summary
Storage catalog simplification
packages/storage/src/sqlite-session-*, packages/storage/src/__tests__/sqlite-session-metadata-store.test.ts
SQLite schema version 26 removes label projections, related indexes, triggers, and synchronization. Catalog queries return recency-ordered sessions without archive, flag, or label predicates.
Runtime catalog protocol and cursors
packages/core/src/runtime-inputs.ts, packages/runtime-host/src/protocol/*, packages/runtime-host/src/server/session-catalog-coordinator.ts, packages/runtime-host/src/__tests__/session-catalog-*.test.ts
Catalog inputs reject removed filter fields. Continuation cursors contain only revision and pagination position data. The compatibility epoch increases from 22 to 24.
Desktop catalog integration
apps/desktop/src/main/runtime-host-client.ts, apps/desktop/src/main/runtime-host-session-catalog-ipc-main.ts, packages/runtime-host/src/client/catalog-reader.ts, apps/desktop/src/main/__tests__/runtime-host-client-*.test.ts
Desktop and the catalog reader request unfiltered pages. The IPC layer rejects unsupported filters. Local cleanup and subagent-parent filtering remain.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to 2e2d1

The change removes unused catalog filters while preserving local subagent filtering and readable session status and labels; stale filter requests are rejected rather than silently misapplied. No actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Ai Use Disclosure ⚠️ Warning The PR description selects neither required AI-use declaration, and introduced commit 2e2d132 has no valid Generated-by trailer. Update the PR description to select exactly one declaration. If generative tooling made a substantive contribution, name the tool and scope; add trailers for material AI-authored content and preserve them through squash or amend. See CON...
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes remove the three unused filters, preserve subagentParentSessionId and metadata behavior, add migrations, and include focused validation.
Out of Scope Changes check ✅ Passed The changes remain within the linked issue scope, including protocol updates, IPC validation, storage cleanup, migrations, and regression tests.
Title check ✅ Passed The title clearly identifies the removal of unused Session catalog filters and includes the relevant breaking-change scope.
Description check ✅ Passed The description covers the summary, breaking behavior, verification results, AI use, migration details, and test coverage.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Remove unused Session catalog filters from runtime host contract

✨ Enhancement ⚙️ Configuration changes 🧪 Tests 🕐 40+ Minutes

Grey Divider

AI Description

• Remove unused Session catalog query filters from protocol, client, and IPC.
• Simplify runtime-host paging/cursors and keep only parent-session filtering behavior.
• Drop label-projection storage tables/indexes and add SQLite schema v25 migration.
Diagram

graph TD
  R["Desktop Renderer"] --> IPC["Desktop IPC main"] --> DRHC["DesktopRuntimeHostClient"] --> CR["Catalog reader"] --> PROTO["session.catalog.query protocol"] --> COORD["Host catalog coordinator"] --> DB[("SQLite session metadata")]
  subgraph Legend
    direction LR
    _ui["Caller"] ~~~ _svc["Service"] ~~~ _db[("Database")]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Soft-deprecate filters (accept but ignore)
  • ➕ Avoids breaking protocol epoch bump for older clients
  • ➕ Allows phased rollout while maintaining stable wire contract
  • ➖ Keeps dead surface area and validation complexity
  • ➖ Still requires cursor/back-compat logic to avoid filter-mismatch ambiguity
2. Keep server-side filtering but remove storage label replicas only
  • ➕ Preserves server-side filter capability for future clients
  • ➕ Still reduces some schema complexity by dropping projection tables
  • ➖ Host would need to filter by labels/flags/archived via JSON or joins, likely slower
  • ➖ Maintains protocol and coordinator complexity for unused features
3. Introduce a new filtered endpoint/versioned operation
  • ➕ Clean separation between legacy and new behaviors
  • ➕ Could reintroduce filtering later without ambiguity
  • ➖ More code paths to maintain (two operations/versions)
  • ➖ Overkill given no shipped client uses these filters

Recommendation: Proceed with the PR’s approach: fully remove the unused filters end-to-end and bump compatibility epoch. It meaningfully simplifies paging/cursor semantics, removes unnecessary schema maintenance (label projection tables/triggers/indexes), and matches the stated reality that shipped clients don’t rely on server-side filtering. The added protocol/coordinator tests that reject filtered inputs and legacy filtered cursors are the right guardrails for a breaking contract change.

Files changed (15) +170 / -289

Refactor (8) +27 / -218
runtime-host-client.tsRemove SessionCatalogFilter from DesktopRuntimeHostClient.listSessions() +2/-5

Remove SessionCatalogFilter from DesktopRuntimeHostClient.listSessions()

• Drops the SessionCatalogFilter type import and changes listSessions() to take no arguments. Updates the implementation to call readRuntimeHostSessions() without a filter.

apps/desktop/src/main/runtime-host-client.ts

runtime-host-session-catalog-ipc-main.tsStop forwarding removed filters across Desktop IPC; keep parent-session filtering locally +1/-12

Stop forwarding removed filters across Desktop IPC; keep parent-session filtering locally

• Updates IPC session listing to always call deps.client.listSessions() with no filter and retains subagentParentSessionId filtering via local post-filtering. Removes the now-dead toHostCatalogFilter mapping helper.

apps/desktop/src/main/runtime-host-session-catalog-ipc-main.ts

runtime-inputs.tsRemove isArchived/isFlagged/labelSlug from SessionListFilter contract +0/-3

Remove isArchived/isFlagged/labelSlug from SessionListFilter contract

• Deletes unused filter fields from the shared SessionListFilter type, leaving only subagentParentSessionId. This aligns Desktop inputs with the filter-free runtime-host catalog contract.

packages/core/src/runtime-inputs.ts

catalog-reader.tsMake readRuntimeHostSessions() always unfiltered +0/-4

Make readRuntimeHostSessions() always unfiltered

• Removes the optional SessionCatalogFilter parameter and stops emitting filter fields in list_start/list_continue requests. Keeps stable paging collection behavior unchanged aside from the removed filter plumbing.

packages/runtime-host/src/client/catalog-reader.ts

session-catalog.tsRemove SessionCatalogFilter from Session catalog protocol and decoding +8/-51

Remove SessionCatalogFilter from Session catalog protocol and decoding

• Deletes the SessionCatalogFilter type and removes filter fields from SessionCatalogQueryInput. Tightens decoding to require exact records for list_start and list_continue, and removes filter decoding/validation logic.

packages/runtime-host/src/protocol/session-catalog.ts

session-catalog-coordinator.tsSimplify coordinator paging: no filter validation or cursor filter encoding +8/-72

Simplify coordinator paging: no filter validation or cursor filter encoding

• Removes canonicalization/matching of requested filters across continuations and stops including filter data in encoded cursors. Updates cursor decoding to reject extra fields and always pages using an undefined filter.

packages/runtime-host/src/server/session-catalog-coordinator.ts

sqlite-session-catalog-query.tsRemove SQL joins/ordering for labelSlug/archived/flagged catalog filtering +8/-33

Remove SQL joins/ordering for labelSlug/archived/flagged catalog filtering

• Eliminates label-based FROM/join path and all where-clauses for labelSlug/isArchived/isFlagged. Always queries session_catalog_projection joined to session_metadata and uses projection.activity_at/session_id for cursor paging.

packages/storage/src/sqlite-session-catalog-query.ts

sqlite-session-metadata-store.tsRemove session label replica maintenance and related list predicates +0/-38

Remove session label replica maintenance and related list predicates

• Deletes the label write failpoint and removes replaceLabels() calls/method used to maintain session_metadata_labels. Removes list predicate SQL that filtered by isArchived/isFlagged/labelSlug, leaving only subagentParentSessionId filtering.

packages/storage/src/sqlite-session-metadata-store.ts

Tests (5) +107 / -69
runtime-host-client-operations.test.tsUpdate Desktop runtime-host client tests for filter-free session listing +3/-5

Update Desktop runtime-host client tests for filter-free session listing

• Removes use of the isArchived filter in listSessions() calls and expected protocol inputs. Aligns test expectations with filter-free list_start/list_continue requests.

apps/desktop/src/main/tests/runtime-host-client-operations.test.ts

session-catalog-coordinator.test.tsAdd coordinator test rejecting legacy filtered cursors +26/-0

Add coordinator test rejecting legacy filtered cursors

• Adds coverage ensuring list_continue rejects base64url cursors that include a serialized filter field. Verifies the coordinator returns invalid_request for legacy filtered cursors.

packages/runtime-host/src/tests/session-catalog-coordinator.test.ts

session-catalog-protocol.test.tsAssert protocol rejects filtered Session catalog query inputs +48/-0

Assert protocol rejects filtered Session catalog query inputs

• Adds tests validating that only filter-free list_start and list_continue inputs are accepted. Ensures decodeClientFrame throws protocol errors when a filter object is present.

packages/runtime-host/src/tests/session-catalog-protocol.test.ts

session-catalog-two-client-uds.test.tsRemove UDS tests that relied on server-side Session catalog filtering +0/-45

Remove UDS tests that relied on server-side Session catalog filtering

• Deletes test scenarios that request filtered catalogs by labelSlug or isFlagged. Keeps remaining paging and revision-change behaviors using unfiltered queries.

packages/runtime-host/src/tests/session-catalog-two-client-uds.test.ts

sqlite-session-metadata-store.test.tsUpdate storage tests after dropping label-projection tables and list filters +30/-19

Update storage tests after dropping label-projection tables and list filters

• Adds assertions that legacy label projection tables are absent and updates list() expectations to be unfiltered while still validating readable archived/flagged/labels fields. Removes failpoint and atomicity checks tied to label projection maintenance.

packages/storage/src/tests/sqlite-session-metadata-store.test.ts

Other (2) +36 / -2
index.tsBump Runtime Host compatibility epoch for breaking Session catalog change +1/-1

Bump Runtime Host compatibility epoch for breaking Session catalog change

• Increments RUNTIME_HOST_COMPATIBILITY_EPOCH from 22 to 23 to reflect the breaking removal of Session catalog query filters.

packages/runtime-host/src/protocol/index.ts

sqlite-session-metadata-schema.tsBump SQLite schema to v25 and drop label projection artifacts +35/-1

Bump SQLite schema to v25 and drop label projection artifacts

• Increments SQLITE_SESSION_METADATA_SCHEMA_VERSION to 25. Adds migration steps to drop label projection tables/triggers/indexes and archive/flag indexes, and recreates the session_catalog_after_update trigger without label maintenance.

packages/storage/src/sqlite-session-metadata-schema.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9651c409-3cae-41d5-a608-fe9170152f75

📥 Commits

Reviewing files that changed from the base of the PR and between 85410e7 and 1af98ad.

📒 Files selected for processing (15)
  • apps/desktop/src/main/__tests__/runtime-host-client-operations.test.ts
  • apps/desktop/src/main/runtime-host-client.ts
  • apps/desktop/src/main/runtime-host-session-catalog-ipc-main.ts
  • packages/core/src/runtime-inputs.ts
  • packages/runtime-host/src/__tests__/session-catalog-coordinator.test.ts
  • packages/runtime-host/src/__tests__/session-catalog-protocol.test.ts
  • packages/runtime-host/src/__tests__/session-catalog-two-client-uds.test.ts
  • packages/runtime-host/src/client/catalog-reader.ts
  • packages/runtime-host/src/protocol/index.ts
  • packages/runtime-host/src/protocol/session-catalog.ts
  • packages/runtime-host/src/server/session-catalog-coordinator.ts
  • packages/storage/src/__tests__/sqlite-session-metadata-store.test.ts
  • packages/storage/src/sqlite-session-catalog-query.ts
  • packages/storage/src/sqlite-session-metadata-schema.ts
  • packages/storage/src/sqlite-session-metadata-store.ts
💤 Files with no reviewable changes (4)
  • packages/core/src/runtime-inputs.ts
  • packages/runtime-host/src/tests/session-catalog-two-client-uds.test.ts
  • packages/runtime-host/src/client/catalog-reader.ts
  • packages/storage/src/sqlite-session-metadata-store.ts

Included review availability: Your plan includes up to 3 reviews per rolling hour; 1 remains after this review.

Comment thread apps/desktop/src/main/runtime-host-session-catalog-ipc-main.ts

Copilot AI left a comment

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.

Pull request overview

Removes unused Session catalog filtering capabilities (archived/flagged/label) across the Runtime Host wire protocol, coordinator/client call sites, Desktop IPC passthrough, and storage query/schema machinery, while preserving subagentParentSessionId support via local filtering and storage-level predicates.

Changes:

  • Runtime Host protocol/coordinator/client: session.catalog.query is now filter-free; paging cursors no longer include filters; compatibility epoch bumped.
  • Storage: removes label replica/projection tables and associated triggers/indexes; removes filter predicate construction for archived/flagged/label; adds schema v25 migration and updates tests.
  • Desktop: runtime-host session listing no longer forwards removed filters; subagentParentSessionId remains supported via local filtering.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/storage/src/sqlite-session-metadata-store.ts Removes label-replica maintenance and archived/flagged/label filtering in list predicates.
packages/storage/src/sqlite-session-metadata-schema.ts Bumps schema to v25; migration drops label projection tables/triggers and related indexes; adjusts catalog update trigger.
packages/storage/src/sqlite-session-catalog-query.ts Simplifies catalog page query to remove archived/flagged/label filters and label-join ordering.
packages/storage/src/tests/sqlite-session-metadata-store.test.ts Updates tests to assert removed tables and to validate label/flag/archive readability without server-side filtering.
packages/runtime-host/src/server/session-catalog-coordinator.ts Removes filter canonicalization/continuation matching; removes filter from cursor encoding/decoding and page generation.
packages/runtime-host/src/protocol/session-catalog.ts Removes SessionCatalogFilter from the wire contract and decoder requirements.
packages/runtime-host/src/protocol/index.ts Bumps RUNTIME_HOST_COMPATIBILITY_EPOCH (22 → 23).
packages/runtime-host/src/client/catalog-reader.ts Makes readRuntimeHostSessions filter-free to match protocol changes.
packages/runtime-host/src/tests/session-catalog-two-client-uds.test.ts Removes coverage that relied on filtered session catalog queries.
packages/runtime-host/src/tests/session-catalog-protocol.test.ts Adds coverage ensuring filtered inputs are rejected by the protocol decoder.
packages/runtime-host/src/tests/session-catalog-coordinator.test.ts Adds coverage rejecting legacy cursors that carry filters.
packages/core/src/runtime-inputs.ts Removes archived/flagged/labelSlug from SessionListFilter, preserving subagentParentSessionId.
apps/desktop/src/main/runtime-host-session-catalog-ipc-main.ts Stops forwarding removed filters to Runtime Host; keeps local subagentParentSessionId filtering.
apps/desktop/src/main/runtime-host-client.ts Updates Desktop runtime-host client to list sessions without filters.
apps/desktop/src/main/tests/runtime-host-client-operations.test.ts Updates expectations for filter-free session.catalog.query requests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/storage/src/sqlite-session-metadata-schema.ts
@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can route each action level your way: inline, summary, both, or drop

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@somewan820
somewan820 force-pushed the refactor/remove-session-catalog-filters-3071 branch from 31d4899 to d7f6477 Compare August 17, 2026 10:09
@somewan820

somewan820 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai please re-review. The inline concern is addressed by the latest commit: sessions:list now rejects the removed filter keys (isArchived / isFlagged / labelSlug) at the IPC boundary instead of silently returning the unfiltered catalog, with UDS coverage for all three keys.

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

git show --stat --oneline d7f647722
git show --format=fuller --find-renames --find-copies -- d7f647722 -- \
  apps/desktop packages/runtime-host | sed -n '1,500p'

printf '\n--- sessions:list definitions and tests ---\n'
rg -n -C 5 --glob '*.{ts,tsx}' \
  '(sessions:list|isArchived|isFlagged|labelSlug)' \
  apps/desktop packages/runtime-host | sed -n '1,800p'

Length of output: 99274


@somewan820 The IPC boundary now rejects isArchived, isFlagged, and labelSlug. The UDS test covers all three keys. The runtime-host protocol also rejects filter-bearing catalog requests. The inline concern is addressed.

⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@somewan820
somewan820 force-pushed the refactor/remove-session-catalog-filters-3071 branch from d7f6477 to 3e9b484 Compare August 17, 2026 10:10

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.

@somewan820
somewan820 force-pushed the refactor/remove-session-catalog-filters-3071 branch from 3e9b484 to 41c86b7 Compare August 17, 2026 10:18
@hqhq1025
hqhq1025 requested a lite review from Copilot August 17, 2026 10:18
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Recent commits on this PR branch ---'
git log --oneline -8

printf '%s\n' '--- Diff from first parent of HEAD ---'
git diff --stat HEAD^ HEAD
git diff --find-renames HEAD^ HEAD -- apps/desktop packages/runtime-host | sed -n '1,900p'

printf '%s\n' '--- Candidate files ---'
fd -t f -e ts . apps/desktop packages/runtime-host \
  | rg '(runtime-host-session-catalog-ipc-main|session-catalog.*test|two-client-uds|runtime-host-client-operations)'

printf '%s\n' '--- IPC filter validation and tests ---'
rg -n -C 8 --glob '*.{ts,tsx}' \
  '(sessions:list|isArchived|isFlagged|labelSlug|subagentParentSessionId)' \
  apps/desktop/src/main packages/runtime-host/src/__tests__ \
  | sed -n '1,1200p'

Length of output: 149005


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Storage module outlines ---'
ast-grep outline packages/storage/src/sqlite-session-metadata-schema.ts --items all
ast-grep outline packages/storage/src/sqlite-session-catalog-query.ts --items all
ast-grep outline packages/storage/src/sqlite-session-metadata-store.ts --items all

printf '%s\n' '--- Schema migration and catalog query diff ---'
git diff HEAD^ HEAD -- \
  packages/storage/src/sqlite-session-metadata-schema.ts \
  packages/storage/src/sqlite-session-catalog-query.ts \
  packages/storage/src/sqlite-session-metadata-store.ts \
  packages/storage/src/__tests__/sqlite-session-metadata-store.test.ts \
  | sed -n '1,1400p'

printf '%s\n' '--- SessionListFilter definitions and list call sites ---'
rg -n -C 5 --glob '*.{ts,tsx}' \
  '(SessionListFilter|listSessions\s*\(|listCatalogPage\s*\()' \
  packages apps \
  | sed -n '1,1400p'

Length of output: 140832


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Schema bootstrap and migration executor ---'
sed -n '20,260p' packages/storage/src/sqlite-session-metadata-schema.ts
sed -n '930,1020p' packages/storage/src/sqlite-session-metadata-schema.ts

printf '%s\n' '--- Catalog and label schema definitions before migration 25 ---'
rg -n -C 10 \
  '(session_catalog_projection|session_catalog_after_update|session_catalog_label_after_|session_metadata_labels|session_catalog_label_projection)' \
  packages/storage/src/sqlite-session-metadata-schema.ts \
  | sed -n '1,1000p'

printf '%s\n' '--- Migration test setup and migration-specific assertions ---'
rg -n -C 12 \
  '(schemaVersion|migrat|SQLITE_SESSION_METADATA_SCHEMA_VERSION|session_metadata_labels|session_catalog_label_projection)' \
  packages/storage/src/__tests__/sqlite-session-metadata-store.test.ts \
  | sed -n '1,1000p'

printf '%s\n' '--- Preload forwarding behavior ---'
sed -n '640,680p' apps/desktop/src/preload/preload.ts

Length of output: 51159


@somewan820 Confirmed. sessions:list now rejects isArchived, isFlagged, and labelSlug at the Desktop IPC boundary. The UDS test covers all three keys.

The Runtime Host protocol also rejects filter on both catalog pagination inputs. Schema v25 removes only the obsolete label-query structures. Session labels remain in session_metadata.payload_json.

I found no new issues in the reviewed changes. I did not execute the test suite.


✏️ Learnings added
Learnt from: somewan820
URL: https://github.com/maka-agent/maka-agent/pull/3165

Timestamp: 2026-08-17T10:20:03.108Z
Learning: For Desktop `sessions:list` IPC in `apps/desktop/src/main/runtime-host-session-catalog-ipc-main.ts`, only `subagentParentSessionId` is an accepted filter key. The handler must reject removed `isArchived`, `isFlagged`, and `labelSlug` keys instead of returning an unfiltered catalog.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

You are interacting with an AI system.

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.

Suppressed comments (1)

apps/desktop/src/main/runtime-host-session-catalog-ipc-main.ts:272

  • normalizeSessionListFilter reads record.subagentParentSessionId without an own-property check. Because Object.keys(record) ignores inherited properties, a prototype-polluted object could smuggle subagentParentSessionId via the prototype chain and bypass the key whitelist.
  const record = value as Record<string, unknown>;
  if (Object.keys(record).some((key) => key !== 'subagentParentSessionId')) {
    throw new Error('Invalid Session list filter keys');
  }
  return {

@Astro-Han

Astro-Han commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Thanks for the cleanup — the zero-consumer claim holds up (I re-verified on the PR head: no renderer/CLI/TUI caller passes these filters; renderer filters the projection locally via session.isArchived/isFlagged), the deletion is thorough (protocol types, coordinator cursor codec, client, IPC, storage predicates, replaceLabels, failpoint all removed in sync; no orphan imports), and the breaking-change handling is correct: epoch 22→23 with strict handshake rejection on both sides, requireExactRecord rejecting any filter key, old cursors rejected by exact-keys decode, and the IPC boundary errors loudly instead of silently returning an unfiltered catalog. Persisted data is unaffected (labels/isArchived/isFlagged stay in the projection). CI is green.

Conclusion: PASS with one P2 (coordination, not a code defect).

P2 — schema v25 is now taken: #3159 merged first and owns v25; this PR and #3074 must renumber. #3159 (fix(session): migrate legacy session statuses) merged at 12:35Z and set SQLITE_SESSION_METADATA_SCHEMA_VERSION = 25 with its own [25, ...] migration; #3074 (refactor/2984-converge-archive-state) also sets v25 with its own [25, ...] migration and touches session-catalog-coordinator.ts and protocol/index.ts — the same files this PR changes. If this PR or #3074 lands with another [25, ...] entry, new Map([[25,...],[25,...]]) silently drops the first — a DB that already ran migration 25 would never run the second migration, and the epoch bump only takes effect once. Migration numbers and the compatibility epoch are global monotonic resources; please rebase onto current main, renumber to v26 (and bump epoch past 23), and run a v24→v25→v26 upgrade test after.

P3 (optional): the base schema still contains the full label-copy DDL (migrations 1 and 16 create session_metadata_labels/session_catalog_label_projection + triggers/indexes, deleted only by migration 25 — correct append-only behavior, but the PR description's "tables are removed" only holds at runtime; a note would help); sessions:list(null) now throws instead of silently returning an unfiltered catalog (intended strictness, no shipped caller passes null, but undocumented); the PR lacks AI-use disclosure and a Conventional Commits trailer (repo pre-merge check flags it).


AI-assisted review disclosure: this review was produced with AI assistance (two pi review subagents on ollama-cloud/deepseek-v4-flash). Both independently verified the zero-consumer claim, deletion thoroughness, and epoch/breaking-change handling; the P2 migration-collision is from cross-checking #3074's head, not an observed failure. Please weigh these findings with your own judgment.

中文摘要(AI 辅助审查)

结论:PASS(1 个 P2,合并协调类,非代码缺陷)。零消费者结论成立(renderer/CLI/TUI 无调用方传 filter,renderer 本地过滤 projection),删除彻底(协议类型、coordinator 游标编解码、client、IPC、storage 谓词、replaceLabels、failpoint 同步删除,无孤儿 import),breaking change 处理正确(epoch 22→23 双向握手严格拒绝、requireExactRecord 拒绝 filter 键、旧游标 exact-keys 拒绝、IPC 边界显式报错而非静默返回未过滤目录),持久化数据不受影响。P2:与 #3074(同为 OPEN、同改 schema v25/epoch/coordinator/protocol)撞车——先后合入会强制冲突,若保留两个 [25,...] 条目会静默丢弃第一个迁移(已跑过 25 的库永不执行第二个迁移),epoch 只生效一次。迁移编号与 epoch 是全局单调资源,合并前需协调(后合者重编号 26 + epoch 顺延),合并后跑 v24→v25 升级测试。P3:基础 schema 仍保留 label 副本 DDL(append-only 正确但描述"tables removed"仅运行时成立)、sessions:list(null) 从静默未过滤变抛错(有意收紧未记录)、PR 缺 AI 披露与 Conventional Commits trailer。

@somewan820
somewan820 force-pushed the refactor/remove-session-catalog-filters-3071 branch from 41c86b7 to 01fa427 Compare August 17, 2026 12:57
@hqhq1025
hqhq1025 requested a lite review from Copilot August 17, 2026 12:57
@somewan820

Copy link
Copy Markdown
Contributor Author

Thanks for the coordination check. Resolved on the current head (rebased onto main at 2de6d6d):

  • Our migration is renumbered to v26 and sits after #3159s v25 migration; SQLITE_SESSION_METADATA_SCHEMA_VERSION is 26.
  • RUNTIME_HOST_COMPATIBILITY_EPOCH is now 24 (past 23) to stay ahead of the expected refactor: make isArchived the sole session archive authority #3074 renumber.
  • The fix(session): migrate legacy session statuses #3159 migration test now asserts the schema constant instead of the hardcoded 25.
  • Ran a v24 -> v25 -> v26 upgrade with label replicas/triggers/indexes populated: the legacy status migration applies, Session metadata/labels/flag/archive state is preserved, and label replicas are removed.
  • Storage metadata suite, Runtime Host Session catalog tests, Desktop UDS tests, and full workspace typecheck pass.

P3 notes: historical label DDL remains in migrations 1 and 16 by append-only design while the runtime schema is clean; strict sessions:list unknown-key rejection is intentional and covered by UDS tests. Re: AI disclosure, the PR intentionally does not include one.

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.

@somewan820
somewan820 force-pushed the refactor/remove-session-catalog-filters-3071 branch 2 times, most recently from 2e2d132 to 8b1fd7f Compare August 18, 2026 02:20
@somewan820

Copy link
Copy Markdown
Contributor Author

The e2e failure is not related to this PR: both failing tests are known flakes already tracked upstream.

Neither test touches the Session catalog filter paths changed here (window.maka.sessions.list() is called without filters in both). I pushed an amended commit with no code changes to re-trigger CI; if the same two tests fail again, please re-run or treat as the known flakes above.

@somewan820

Copy link
Copy Markdown
Contributor Author

Update: the re-run passed. e2e is green (3m27s) and all other required checks (typecheck, test_runtime_host, test_workspaces, windows lanes) pass on the current head. The earlier failure was the known flake.

@Astro-Han

Copy link
Copy Markdown
Contributor

LGTM. Could you state the AI assistance part and add it on both commit and PR body?

移除 Session catalog 协议、coordinator、Desktop IPC 与 storage 中未使用的 isArchived/isFlagged/labelSlug 过滤能力,保留 subagentParentSessionId 子会话过滤;新增 schema v26 迁移,清理 label 查询副本表及 archive/flag 过滤索引。labels、isFlagged、isArchived 的读写与 catalog 投影行为保持不变。

Desktop 的 sessions:list 现在只接受 subagentParentSessionId,并对 isArchived/isFlagged/labelSlug 等未知键显式报错,避免旧调用方静默拿到未过滤目录。

BREAKING CHANGE: session.catalog.query 不再接受 isArchived/isFlagged/labelSlug 过滤参数,兼容性 epoch 提升至 24。

当前 main 的兼容性 epoch 为 23、schema 为 v25;本提交对应 schema v26 / epoch 24。

Closes apache#3071

Generated-by: Codex
@somewan820
somewan820 force-pushed the refactor/remove-session-catalog-filters-3071 branch from 8b1fd7f to cf7f679 Compare August 18, 2026 03:22
@somewan820

Copy link
Copy Markdown
Contributor Author

@Astro-Han done. The PR body now includes the standard AI use section (Codex, with tool and scope) and the commit carries Generated-by: Codex (head cf7f679).

@Astro-Han
Astro-Han merged commit 19ccf0b into apache:main Aug 18, 2026
20 of 21 checks passed
Astro-Han added a commit to Astro-Han/maka-agent that referenced this pull request Aug 19, 2026
`goal.arm` is a new wire operation, so a client that has it and a Host that
does not are no longer safely interoperable. Without a new epoch the pair
completes the handshake, the client offers Set Goal, and the first arm reaches
an older decoder as an unknown operation — a protocol error that tears the
connection down instead of refusing the pair up front and routing the user to
the Host upgrade path.

The epoch is the boundary the repository already uses for this: apache#3145 advanced
it for a new operation and apache#3165 advanced it merely for removing catalog
filters. Handshake fixtures name deliberately stale epochs to exercise
rejection, so they stay as they are.

Generated-by: Claude Code
Astro-Han added a commit to Astro-Han/maka-agent that referenced this pull request Aug 19, 2026
`goal.arm` is a new wire operation, so a client that has it and a Host that
does not are no longer safely interoperable. Without a new epoch the pair
completes the handshake, the client offers Set Goal, and the first arm reaches
an older decoder as an unknown operation — a protocol error that tears the
connection down instead of refusing the pair up front and routing the user to
the Host upgrade path.

The epoch is the boundary the repository already uses for this: apache#3145 advanced
it for a new operation and apache#3165 advanced it merely for removing catalog
filters. Handshake fixtures name deliberately stale epochs to exercise
rejection, so they stay as they are.

Generated-by: Claude Code
Astro-Han added a commit to Astro-Han/maka-agent that referenced this pull request Aug 19, 2026
`goal.arm` is a new wire operation, so a client that has it and a Host that
does not are no longer safely interoperable. Without a new epoch the pair
completes the handshake, the client offers Set Goal, and the first arm reaches
an older decoder as an unknown operation — a protocol error that tears the
connection down instead of refusing the pair up front and routing the user to
the Host upgrade path.

The epoch is the boundary the repository already uses for this: apache#3145 advanced
it for a new operation and apache#3165 advanced it merely for removing catalog
filters. Handshake fixtures name deliberately stale epochs to exercise
rejection, so they stay as they are.

Generated-by: Claude Code
Astro-Han added a commit to Astro-Han/maka-agent that referenced this pull request Aug 20, 2026
`goal.arm` is a new wire operation, so a client that has it and a Host that
does not are no longer safely interoperable. Without a new epoch the pair
completes the handshake, the client offers Set Goal, and the first arm reaches
an older decoder as an unknown operation — a protocol error that tears the
connection down instead of refusing the pair up front and routing the user to
the Host upgrade path.

The epoch is the boundary the repository already uses for this: apache#3145 advanced
it for a new operation and apache#3165 advanced it merely for removing catalog
filters. Handshake fixtures name deliberately stale epochs to exercise
rejection, so they stay as they are.

Generated-by: Claude Code
Astro-Han added a commit to Astro-Han/maka-agent that referenced this pull request Aug 20, 2026
`goal.arm` is a new wire operation, so a client that has it and a Host that
does not are no longer safely interoperable. Without a new epoch the pair
completes the handshake, the client offers Set Goal, and the first arm reaches
an older decoder as an unknown operation — a protocol error that tears the
connection down instead of refusing the pair up front and routing the user to
the Host upgrade path.

The epoch is the boundary the repository already uses for this: apache#3145 advanced
it for a new operation and apache#3165 advanced it merely for removing catalog
filters. Handshake fixtures name deliberately stale epochs to exercise
rejection, so they stay as they are.

Generated-by: Claude Code
Astro-Han added a commit to Astro-Han/maka-agent that referenced this pull request Aug 20, 2026
`goal.arm` is a new wire operation, so a client that has it and a Host that
does not are no longer safely interoperable. Without a new epoch the pair
completes the handshake, the client offers Set Goal, and the first arm reaches
an older decoder as an unknown operation — a protocol error that tears the
connection down instead of refusing the pair up front and routing the user to
the Host upgrade path.

The epoch is the boundary the repository already uses for this: apache#3145 advanced
it for a new operation and apache#3165 advanced it merely for removing catalog
filters. Handshake fixtures name deliberately stale epochs to exercise
rejection, so they stay as they are.

Generated-by: Claude Code
Astro-Han added a commit to Astro-Han/maka-agent that referenced this pull request Aug 20, 2026
`goal.arm` is a new wire operation, so a client that has it and a Host that
does not are no longer safely interoperable. Without a new epoch the pair
completes the handshake, the client offers Set Goal, and the first arm reaches
an older decoder as an unknown operation — a protocol error that tears the
connection down instead of refusing the pair up front and routing the user to
the Host upgrade path.

The epoch is the boundary the repository already uses for this: apache#3145 advanced
it for a new operation and apache#3165 advanced it merely for removing catalog
filters. Handshake fixtures name deliberately stale epochs to exercise
rejection, so they stay as they are.

Generated-by: Claude Code
Astro-Han added a commit to Astro-Han/maka-agent that referenced this pull request Aug 20, 2026
`goal.arm` is a new wire operation, so a client that has it and a Host that
does not are no longer safely interoperable. Without a new epoch the pair
completes the handshake, the client offers Set Goal, and the first arm reaches
an older decoder as an unknown operation — a protocol error that tears the
connection down instead of refusing the pair up front and routing the user to
the Host upgrade path.

The epoch is the boundary the repository already uses for this: apache#3145 advanced
it for a new operation and apache#3165 advanced it merely for removing catalog
filters. Handshake fixtures name deliberately stale epochs to exercise
rejection, so they stay as they are.

Generated-by: Claude Code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: remove unused Session catalog filters and label query projections

3 participants