Skip to content

feat: add session status filter#248

Closed
intagliated wants to merge 1 commit intoOpen-ACP:mainfrom
intagliated:feature/session-status-filter
Closed

feat: add session status filter#248
intagliated wants to merge 1 commit intoOpen-ACP:mainfrom
intagliated:feature/session-status-filter

Conversation

@intagliated
Copy link
Copy Markdown

summary

Add filtering capability to session list API by status.

changes

  • Add Session interface with SessionStatus type
  • Add VALID_STATUSES constant ('active', 'completed', 'expired', 'cancelled')
  • Add filterSessionsByStatus controller function
  • Add unit tests with 4 test cases

testing

  • Unit tests passing for filter logic
  • Manual validation completed
  • No breaking changes

related Issue

Closes #247

type of changes

  • Bug fix
  • New feature
  • Documentation update
  • Tests
  • CI / Build

checklist

  • My code follows the project style guidelines
  • I have performed a self-review of my code
  • I have added tests that prove my fix/feature works
  • New and existing tests pass locally with my changes

- Add Session interface with SessionStatus type
- Add VALID_STATUSES constant (active, completed, expired, cancelled)
- Add filterSessionsByStatus controller function
- Add unit tests with 4 test cases for filter logic
@0xmrpeter
Copy link
Copy Markdown
Contributor

Hey @intagliated, thanks for taking the time to work on this! The idea behind filtering sessions by status is genuinely useful, and we appreciate the effort put into writing tests. Just a few things we'd like to flag before this can move forward:

Type mismatch with the existing codebase

The SessionStatus type in src/models/Session.ts defines 'active' | 'completed' | 'expired' | 'cancelled', but OpenACP already has a SessionStatus in src/core/types.ts with different values: 'initializing' | 'active' | 'cancelled' | 'finished' | 'error'. Having two conflicting definitions of the same concept would cause confusion and bugs down the line.

The filter function isn't wired to the API yet

The actual session list endpoint lives in src/plugins/api-server/routes/sessions.ts. The filterSessionsByStatus function in src/controllers/sessionController.ts is correct in spirit, but it's currently standalone — it isn't called from anywhere. For this feature to work end-to-end, we'd need a ?status= query parameter added to that GET / route.

Project structure

The codebase doesn't currently use src/models/ or src/controllers/ as directories — session logic lives under src/core/sessions/ and src/plugins/api-server/. It would be great to keep things consistent with that structure.

Suggested path forward

The cleanest approach would be:

  1. Reuse the existing SessionStatus type from src/core/types.ts
  2. Add ?status= query param filtering directly in src/plugins/api-server/routes/sessions.ts
  3. No need for a new model file — the types are already there

We'd love to see a revised version — the feature itself is definitely something we want! Happy to help if you have any questions. 🙏

@intagliated intagliated closed this by deleting the head repository May 5, 2026
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.

[Feature]: Filter by statuses on the session list API

2 participants