mirror of
https://github.com/OthmanAdi/planning-with-files.git
synced 2026-04-26 00:16:01 +03:00
[PR #37] [MERGED] fix: Session-agnostic catchup scanning across all sessions #64
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/planning-with-files#64
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/OthmanAdi/planning-with-files/pull/37
Author: @lasmarois
Created: 1/17/2026
Status: ✅ Merged
Merged: 1/17/2026
Merged by: @OthmanAdi
Base:
master← Head:fix/session-catchup-exclude-current📝 Commits (1)
dcba1bcfix: Session-agnostic catchup scanning across all sessions📊 Changes
1 file changed (+185 additions, -115 deletions)
View changed files
📝
scripts/session-catchup.py(+185 -115)📄 Description
Problem
The first iteration of
session-catchup.pyhad two issues:Issue 1: Picked the current session instead of previous
The script sorted sessions by modification time and picked the first "substantial" one (>5000 bytes). But the current session is always the most recently modified, so it would detect itself as the "previous" session—showing the current session's own context as "unsynced."
Issue 2: Only looked at one session
Even after fixing issue 1 by skipping the first session, the script only examined the single session containing the last planning file update. This missed important context from intermediate sessions.
Example of the problem:
The old script would only show context from Session A after the planning update, completely missing Sessions B and C.
Solution
Rewrote the script to be session-agnostic:
[Session: xxx...]when context spans multiple sessionsWhy 100 messages?
The original limit of 20 messages was too restrictive—newer sessions would push older (but important) context out of view entirely. However, unlimited output creates edge case risks:
100 messages strikes a balance—enough to capture multi-session context while avoiding edge case blowups. If truncated, the script shows:
(Showing last 100 of X messages)Example of the fix:
Note
@OthmanAdi Apologies for the confusion during testing of the first iteration—the "detecting itself" bug made it tricky to verify the fix was actually working, since the output looked plausible but was pulling from the wrong session. This rewrite was validated by tracing through actual session files to confirm the correct sessions and messages are being captured.
Changes
scripts/session-catchup.py: Complete rewrite with session-agnostic scanningTest Plan
/planning-with-filesafter/clear- should show context from all sessions since last planning update🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.