Skip to content

Track last interaction time for sessions#165

Merged
khaong merged 5 commits intomainfrom
alex/ent-232-track-last-interaction-for-sessions
Feb 8, 2026
Merged

Track last interaction time for sessions#165
khaong merged 5 commits intomainfrom
alex/ent-232-track-last-interaction-for-sessions

Conversation

@khaong
Copy link
Contributor

@khaong khaong commented Feb 6, 2026

Summary

  • Add LastInteractionAt timestamp to session state, updated on every InitializeSession call (user prompt submit)
  • Show "active X ago" in entire status when it meaningfully differs from session start time (>1 min)
  • Redesign status session output: agent/ID/times on line 1, prompt on indented line 2
  • Fix: add LastInteractionAt to sessionStateToStrategy/sessionStateFromStrategy converters (manual-commit strategy uses a conversion layer between strategy.SessionState and session.State)

Stacked on #89

Test plan

  • Unit tests: LastInteractionAt JSON round-trip, status output format, active-time omission when close to start
  • Integration tests: field set on first prompt, updated on subsequent prompts, preserved across checkpoint cycles
  • mise run fmt && mise run lint && mise run test:ci all pass

🤖 Generated with Claude Code


Note

Low Risk
Mostly additive timestamp tracking and CLI output formatting, with good unit/integration test coverage; low risk aside from potential minor UI/regression in status output parsing.

Overview
Adds a new persisted session timestamp LastInteractionAt, set on session creation and updated on every InitializeSession/user prompt submit across both auto-commit and manual-commit strategies (including manual strategy state conversions).

Updates entire status active session display to show started … plus an optional “active X ago” (only when meaningfully different from start), and reformats output to put agent/ID/times on the first line and the first prompt on an indented second line (omitting missing prompts).

Adds unit and integration coverage for JSON round-tripping, status formatting/active-time omission, and interaction timestamp behavior across repeated prompts and checkpoint cycles.

Written by Cursor Bugbot for commit 7ad1fc5. This will update automatically on new commits. Configure here.

Copilot AI review requested due to automatic review settings February 6, 2026 05:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds tracking of user interaction timestamps to session state, enabling better visibility into when sessions were last actively used. The LastInteractionAt field is set when a session is first created and updated on every subsequent prompt submission. The status command now displays this information with a redesigned format that shows agent/ID/times on one line and the prompt on an indented second line, with "active X ago" shown when it meaningfully differs from the session start time (>1 minute).

Changes:

  • Add LastInteractionAt field to session state structs and JSON serialization
  • Update LastInteractionAt on every InitializeSession call in both auto-commit and manual-commit strategies
  • Redesign status output: agent/ID/times on line 1, prompt on indented line 2
  • Add comprehensive unit and integration tests for the new field and status display

Reviewed changes

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

Show a summary per file
File Description
cmd/entire/cli/session/state.go Add LastInteractionAt field to session State struct with documentation
cmd/entire/cli/strategy/manual_commit_types.go Add LastInteractionAt field to strategy-specific SessionState struct
cmd/entire/cli/strategy/manual_commit.go Add LastInteractionAt to conversion functions between strategy and session states
cmd/entire/cli/strategy/manual_commit_session.go Set LastInteractionAt on new session initialization
cmd/entire/cli/strategy/manual_commit_hooks.go Update LastInteractionAt on every subsequent prompt in existing sessions
cmd/entire/cli/strategy/auto_commit.go Set and update LastInteractionAt in auto-commit strategy
cmd/entire/cli/status.go Redesign status output format and display "active X ago" when meaningful
cmd/entire/cli/status_test.go Add comprehensive tests for status output format and active time display logic
cmd/entire/cli/strategy/session_state_test.go Add unit tests for LastInteractionAt JSON serialization round-trip
cmd/entire/cli/integration_test/last_interaction_test.go Add integration tests verifying field behavior across strategies and checkpoint cycles

@khaong khaong force-pushed the alex/ent-64-status-shows-sessions branch from 0213adf to 256bf20 Compare February 6, 2026 06:03
khaong and others added 3 commits February 6, 2026 17:15
Update InitializeSession in both strategies to record LastInteractionAt
on every user prompt submit. Display "active X ago" in status output when
it meaningfully differs from session start time. Redesign session lines
to show prompt on an indented second line.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: f6a415abf2b0
The manual-commit strategy converts between strategy.SessionState and
session.State via sessionStateToStrategy/sessionStateFromStrategy. The
new LastInteractionAt field was missing from both converters, so it was
silently dropped on every save/load cycle.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 4a9c8e2bd824
Verify the field is set on first prompt, updated on subsequent prompts,
and preserved across checkpoint cycles. Tests run for all strategies.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@khaong khaong force-pushed the alex/ent-232-track-last-interaction-for-sessions branch from 33d94c8 to b9a0419 Compare February 6, 2026 06:16
@khaong khaong marked this pull request as ready for review February 6, 2026 06:23
@khaong khaong requested a review from a team as a code owner February 6, 2026 06:23
georg
georg previously approved these changes Feb 8, 2026
Base automatically changed from alex/ent-64-status-shows-sessions to main February 8, 2026 03:00
@khaong khaong dismissed georg’s stale review February 8, 2026 03:00

The base branch was changed.

@khaong khaong enabled auto-merge February 8, 2026 03:07
@khaong khaong merged commit f6206a4 into main Feb 8, 2026
4 checks passed
@khaong khaong deleted the alex/ent-232-track-last-interaction-for-sessions branch February 8, 2026 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants