Skip to content

fix(app): return every loaded session from session.list_sessions - #4791

Merged
yomgui merged 2 commits into
devfrom
fix/session-list-sessions-cap
Sep 10, 2026
Merged

yomgui merged 2 commits into
devfrom
fix/session-list-sessions-cap

Conversation

@yomgui

@yomgui yomgui commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

Problem

A session reported:

There are ~100 candidate sessions in this workspace and the list API caps at 30. I'll inventory directly from the OpenCode storage on disk.

The agent could not inventory the workspace through the app's control surface and fell back to scraping OpenCode storage on disk.

Root cause

session.list_sessions (apps/app/src/react-app/domains/session/control/session-control-actions.ts) has hard-coded out.slice(0, 30) since the original UI control bridge landed in #1644. Meanwhile the app already holds the workspace's sessions in memory (listRouteSessions now pages exhaustively since #4783), so the data was present and simply dropped. The action exposed no limit / workspaceId args and no truncation indicator, so callers had no way to know the list was partial or to ask for more.

Fix

  • Return every loaded session by default (pinned first, then newest — unchanged ordering).
  • Add optional limit (opt-in cap; only a positive integer is honoured) and workspaceId (exact id or display-name match; an unknown workspace returns [] rather than falling back to another workspace).
  • Extract the listing into pure list-control-sessions.ts taking the raw control-action payload, so the hook's execute is a one-line pass-through and arg forwarding is provable without booting Electron. The result stays a plain array so the ~12 existing .e2e.test.ts specs that consume session.list_sessions through the control API are unaffected (they also continue to exercise registration).
  • Update the two docs that describe the action; replace a real-looking personal name in a public docs example with a fictional topic (Warden 2T3-GM4).

Proof — Passed

Lane: local (PR-lane pure spec; Daytona not required for an app-less spec). Head 6a61a8c9d.

$ pnpm evals:pr specs/session-list-sessions-inventory.test.ts
 Test Files  1 passed (1)
      Tests  4 passed (4)      # exit 0

$ pnpm --filter @openwork/app typecheck   # exit 0

Witness check — with out.slice(0, 30) re-applied to the helper, the same spec fails 3 failed | 1 passed (4).

CI: all required checks green; the spec also ran in the dispatched extended lane on both runners (✓ pr specs/session-list-sessions-inventory.test.ts (4 tests)).

Pre-existing extended-lane reds (control): a workflow_dispatch of ci-tests.yml on clean dev@586c4100f (run 34490136184) fails the same four steps with the identical 20 failing tests as this branch's run (34489353444); 0 failures are unique to this branch. Root cause there is environmental: Local Den requires MySQL on 127.0.0.1:3306 (48 occurrences). Control: 240 failed | 190 passed files, 20 failed | 1801 passed; this branch: 240 failed | 191 passed, 20 failed | 1805 passed — the delta is exactly this spec.

Claims covered by evals/specs/session-list-sessions-inventory.test.ts (each called with the raw args payload the control bridge delivers):

  1. null and {} args return all 120 loaded sessions across two workspaces, newest first, no truncation.
  2. limit: 30 returns exactly the 30 newest; 0, 2.5, and "30" are ignored.
  3. workspaceId by id and by (trimmed) display name return the same 100 sessions; unknown workspace returns none; composes with limit.
  4. Pinned-first ordering and id-less entry hygiene survive the refactor.

session.list_sessions hard-coded `out.slice(0, 30)` since the original UI
control bridge (#1644) even though the app already holds up to 200 sessions
per workspace in memory. The action exposed no `limit` or `workspaceId` args
and no truncation signal, so an agent asked to inventory ~100 sessions could
not see them and fell back to scraping OpenCode storage on disk.

- Return every loaded session (pinned first, then newest) by default.
- Accept optional `limit` (opt-in cap) and `workspaceId` (exact id or
  display-name match, never falls back to another workspace).
- Extract the pure listing into list-control-sessions.ts so the behavior is
  provable without booting Electron; keep the array result shape that the
  existing e2e specs consume.
- Document the args in the UI control profile and cross-chat memory docs.

Proof: evals/specs/session-list-sessions-inventory.test.ts (4 tests) fails
3/4 with the old cap and passes 4/4 with the fix.
@mintlify

mintlify Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
differentai 🟢 Ready View Preview Sep 10, 2026, 2:40 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@vercel

vercel Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openwork-app Ready Ready Preview Sep 10, 2026 2:40pm UTC
3 Skipped Deployments
Project Deployment Actions Updated
openwork-den Ignored Ignored Preview Sep 10, 2026 2:40pm UTC
openwork-diagnostics Ignored Ignored Preview Sep 10, 2026 2:40pm UTC
openwork-landing Ignored Ignored Preview Sep 10, 2026 2:40pm UTC

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Warden review summary — Clear

Native findings: 1. Blocking policy matches before consolidation: 0. Full finding text remains in Warden's native checks and review threads. This comment retains only native IDs, severity, skill attribution, and safe locations. Analysis run

Reported trigger coverage (not proof of complete repository or context coverage): diff-security-review (41403 ms), confidentiality-review (38047 ms), spec-provenance-review (24068 ms), desktop-den-sync-review (40954 ms).

Blockers

  • None.

Advisories

  • 5SC-M9C · medium · spec-provenance-review · evals/specs/session-list-sessions-inventory.test.ts:4

Needs recheck

  • None.

Observed review-thread metrics

  • Unique observed run attempts in retained window: 2
  • Distinct heads in retained window: 2
  • Current unresolved Warden threads: 0 of 1 observed
  • Observed resolved/unresolved transitions in retained snapshots: 1 / 0
  • First observed resolved/unresolved (state at first collection, not event time): 0 / 1
  • Precision: unavailable (no adjudications; no TP/FP values are inferred)
  • Observation window: 2/20 run attempts retained; truncated: false
  • Transition snapshot: 1/1 current attributed threads retained (limit 500); truncated: false

Thread states are read-only collection snapshots. These metrics are neither lifetime totals nor exact resolution times, and this summary is not clearance authority.

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Passed · 10/10 tests · 15/15 assertions · 5 images

Commit 6a61a8c9d4799e11a920e852f8a15e3754d942ca · selected evidence

Open review report

…name from docs

- listControlSessions now takes the raw control-action payload, so the hook's
  execute is a one-line pass-through and the spec covers arg forwarding
  (null / {} / positive-integer limit / trimmed workspaceId) exactly as the
  control bridge delivers it (Warden 2C6-KRW).
- Replace a real-looking personal name in the public cross-chat-memory example
  with a fictional topic (Warden 2T3-GM4).

@diff-warden diff-warden Bot 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.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (6a61a8c9d4799e11a920e852f8a15e3754d942ca). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@yomgui
yomgui merged commit c669e82 into dev Sep 10, 2026
31 checks passed
@yomgui
yomgui deleted the fix/session-list-sessions-cap branch September 10, 2026 14:45

This branch was successfully deployed

5 active (3 outdated) deployments
Preview – openwork-app — 6a61a8c9 Deployed Sep 10, 2026 by vercel[bot]
staging - packages/docs — 6a61a8c9 Deployed Sep 10, 2026 by mintlify[bot]
Preview – openwork-landing — 06fbb165 Deployed Sep 10, 2026 by vercel[bot]
Preview – openwork-den — 06fbb165 Deployed Sep 10, 2026 by vercel[bot]
Preview – openwork-diagnostics — 06fbb165 Deployed Sep 10, 2026 by vercel[bot]
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.

1 participant