Skip to content

fix(session): bound PocketBase latest-message reads - #2042

Merged
pancacake merged 1 commit into
HKUDS:devfrom
remote-controlled-man:codex/deeptutor-bounded-last-message
Oct 28, 2026
Merged

pancacake merged 1 commit into
HKUDS:devfrom
remote-controlled-man:codex/deeptutor-bounded-last-message

Conversation

@remote-controlled-man

Copy link
Copy Markdown
Contributor

Description

Keep PocketBase latest-message reads bounded when regenerating a response.

The regenerate path calls get_last_message twice: once for the latest user message and once for the conversation tail. The store used get_full_list with perPage: 1, but the Python SDK replaces that parameter with its batch size and follows every page. Long conversations therefore downloaded their matching history twice just to select two records.

Use get_list(1, 1) and keep the existing session/role filters, descending timestamp order, serialization, and empty/error results. Add regression coverage for filtered and unfiltered reads, no matching role, and an inaccessible session.

Related Issues

Follow-up to the regenerate feature in #349. This does not implement #2030's separate lazy-loading proposal.

Module(s) Affected

  • services
  • tests

Validation

  • 84 tests passed across the PocketBase fallback/isolation, workspace-scope, and regenerate suites. The three bounded-query cases fail on the unchanged base and pass with this fix.
  • pre-commit run --all-files: all hooks passed, including Ruff, Prettier, secret detection, Bandit, and MyPy.
  • ruff check . and ruff format --check .: passed with CI-pinned Ruff 0.16.0.
  • Real PocketBase Python SDK 0.17.3 with a local HTTP replay, 320 stored messages and 2 KiB message bodies: the two message-collection lookups went from 6 requests / 480 returned rows to 2 requests / 2 returned rows, selecting the same records. Session-access checks were stubbed in this probe; ownership remains covered by the project tests. This measures SDK pagination, not live-server latency.

Verified on macOS arm64 / Python 3.12.14. The full application/frontend suites, alternate platforms, and a live PocketBase/UI session were not run locally.

Checklist

  • This PR targets dev.
  • I have read the contribution guidelines.
  • Relevant regression tests and complete pre-commit checks pass.
  • No public API, schema, dependency, or configuration changes are needed.

Copilot AI balanced review requested due to automatic review settings October 24, 2026 04:09

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@pancacake
pancacake merged commit 94e5232 into HKUDS:dev Oct 28, 2026
13 of 15 checks passed
@remote-controlled-man
remote-controlled-man deleted the codex/deeptutor-bounded-last-message branch November 2, 2026 03:49
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.

3 participants