Skip to content

fix(server): bound session listing and keep a full idle window after turns - #236

Merged
leoisadev1 merged 2 commits into
mainfrom
leoisadev1/t3-port-session-idle
Sep 10, 2026
Merged

leoisadev1 merged 2 commits into
mainfrom
leoisadev1/t3-port-session-idle

Conversation

@leoisadev1

@leoisadev1 leoisadev1 commented Sep 10, 2026

Copy link
Copy Markdown
Member

Problem

Session listing and idle reaping both scaled from the wrong clocks.

listSessions loaded every persisted thread binding, then looked each one up, so the call grew with conversation history instead of the live adapter session set. The session reaper treated binding lastSeenAt as the only idle timestamp. That stamp is updated when a turn is sent, so a long turn that later completed or aborted could be stopped as soon as it finished instead of getting a full inactivity window.

Changes

Look up bindings only for the unique thread ids of currently active adapter sessions. Historical bindings stay out of this path.

Idle time is max(binding.lastSeenAt, session.updatedAt) after the cheap lastSeenAt skip. Ingestion updates session.updatedAt when a turn settles, so ready, interrupted, and error sessions get the full window after that transition. Active turns and live backgroundLiveness still skip reaping. Akeru still uses AgentController rather than ProviderService for stop.

Upstream

Reviewed adaptations of pingdotgg/t3code:

  • #8909 bound session lookups
  • #10689 full post-completion idle window

Scope

This PR is session listing and idle timing only. Independent of #220 and #229.

Assigned checkpoint and attachment ports are in those PRs:

Restart continuation remains with the capabilities worker.

Verification

  • vp test run of ProviderService and ProviderSessionReaper: 50 tests passed. New cases use Clock overrides and a deferred sweep, not sleeps.
  • Targeted lint and format passed (0 errors). One pre-existing unused dispatch parameter warning in ProviderService.test.ts is unchanged.

No UI layout or client-visible chrome change. Proof is adapter-session listing and reaper sweep tests.

Limitations

backgroundLiveness skip is preserved. Capabilities-owned restart continuation is not in this PR.

Implemented and verified by Grok 4.6 High in Grok Build via Orca.

…turns

listSessions resolved every historical thread binding, so each call scaled
with the whole conversation history. The session reaper also treated
binding lastSeenAt as the only idle clock, which reaped long turns as soon
as they finished.

Look up bindings only for live adapter sessions, and idle from the later of
binding lastSeenAt and the projected session updatedAt so a completed turn
gets the full inactivity window.

Adapted from pingdotgg/t3code pingdotgg#8909 pingdotgg#10689.
@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
akeru-bot-landing Skipped Skipped Sep 10, 2026 6:11pm UTC

Request Review

@github-actions github-actions Bot added type:provider Agent provider contribution. vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S labels Sep 10, 2026
@greptile-apps

greptile-apps Bot commented Sep 10, 2026

Copy link
Copy Markdown

Greptile Summary

Summary

  • Session binding lookups are limited to unique active adapter thread IDs rather than historical bindings.
  • Idle-session reaping uses the newest persisted or projected activity timestamp, preserving the full inactivity window after terminal turns.
  • Targeted coverage verifies bounded lookups, timestamp precedence, and idle-window boundaries.

Confidence Score: 5/5

Safe to merge; there are no outstanding blocking issues.

No new findings or outstanding previous findings.

Reviews (2): Last reviewed commit: "Merge branch 'main' into leoisadev1/t3-p..." | Re-trigger Greptile

@leoisadev1
leoisadev1 merged commit 7507496 into main Sep 10, 2026
11 of 12 checks passed
@leoisadev1
leoisadev1 deleted the leoisadev1/t3-port-session-idle branch September 10, 2026 22:25
This was referenced Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S type:provider Agent provider contribution. vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant