[PR #79] [MERGED] fix: prevent false-positive catchup in distributed session-catchup scripts #82

Closed
opened 2026-03-03 18:50:29 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/OthmanAdi/planning-with-files/pull/79
Author: @gydx6
Created: 2/15/2026
Status: Merged
Merged: 2/20/2026
Merged by: @OthmanAdi

Base: masterHead: codex/fix-session-catchup-copy-drift


📝 Commits (2)

  • f275429 fix: prevent false-positive session catchup in skill copies
  • 91d7221 fix: restore codebuddy-specific session-catchup behavior

📊 Changes

9 files changed (+87 additions, -81 deletions)

View changed files

📝 .adal/skills/planning-with-files/scripts/session-catchup.py (+10 -9)
📝 .codebuddy/skills/planning-with-files/scripts/session-catchup.py (+10 -9)
📝 .codex/skills/planning-with-files/scripts/session-catchup.py (+10 -9)
📝 .continue/skills/planning-with-files/scripts/session-catchup.py (+10 -9)
📝 .gemini/skills/planning-with-files/scripts/session-catchup.py (+10 -9)
📝 .openclaw/skills/planning-with-files/scripts/session-catchup.py (+10 -9)
📝 .opencode/skills/planning-with-files/scripts/session-catchup.py (+7 -9)
📝 .pi/skills/planning-with-files/scripts/session-catchup.py (+10 -9)
📝 skills/planning-with-files/scripts/session-catchup.py (+10 -9)

📄 Description

Summary

Fix false-positive catchup reports in skill-distributed session-catchup.py copies.

Scope

Applied to all affected skill-copy scripts (9 files):

  • skills/planning-with-files/scripts/session-catchup.py
  • .adal/skills/planning-with-files/scripts/session-catchup.py
  • .codebuddy/skills/planning-with-files/scripts/session-catchup.py
  • .codex/skills/planning-with-files/scripts/session-catchup.py
  • .continue/skills/planning-with-files/scripts/session-catchup.py
  • .gemini/skills/planning-with-files/scripts/session-catchup.py
  • .openclaw/skills/planning-with-files/scripts/session-catchup.py
  • .opencode/skills/planning-with-files/scripts/session-catchup.py
  • .pi/skills/planning-with-files/scripts/session-catchup.py

Root scripts/session-catchup.py is intentionally unchanged.

What changed

  1. Added early return when planning files are absent in the project (has_planning_files == False).
  2. Added early return when no planning update is found in the target session (last_update_line < 0).
  3. Removed the no-update fallback branch that emitted UNSYNCED CONTEXT from non-planning history.

Why .opencode diff is different

.opencode already had the planning-files guard, so only the no-planning-update fallback removal was needed there.

Before / After (key logic)

Before:

if last_update_line < 0:
    messages_after = extract_messages_after(messages, len(messages) - 30)
else:
    messages_after = extract_messages_after(messages, last_update_line)

After:

if last_update_line < 0:
    return
messages_after = extract_messages_after(messages, last_update_line)

And now catchup is gated by active planning context:

if not has_planning_files:
    return

Validation

  • Syntax: python3 -m py_compile on all modified session-catchup.py files.
  • Manual behavioral checks with synthetic session JSONL data (temporary HOME):
    • Planning files present + no planning update => script exits silently.
    • Planning update present => catchup report is emitted.
    • CodeBuddy variant confirmed to read ~/.codebuddy/projects and emit CODEBUDDY: label.

Fixes #78


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/OthmanAdi/planning-with-files/pull/79 **Author:** [@gydx6](https://github.com/gydx6) **Created:** 2/15/2026 **Status:** ✅ Merged **Merged:** 2/20/2026 **Merged by:** [@OthmanAdi](https://github.com/OthmanAdi) **Base:** `master` ← **Head:** `codex/fix-session-catchup-copy-drift` --- ### 📝 Commits (2) - [`f275429`](https://github.com/OthmanAdi/planning-with-files/commit/f27542965fc0f0b6a1bc94c2a3f6a4214ea82be5) fix: prevent false-positive session catchup in skill copies - [`91d7221`](https://github.com/OthmanAdi/planning-with-files/commit/91d7221fa3159357938224a25e9e0f04492d713c) fix: restore codebuddy-specific session-catchup behavior ### 📊 Changes **9 files changed** (+87 additions, -81 deletions) <details> <summary>View changed files</summary> 📝 `.adal/skills/planning-with-files/scripts/session-catchup.py` (+10 -9) 📝 `.codebuddy/skills/planning-with-files/scripts/session-catchup.py` (+10 -9) 📝 `.codex/skills/planning-with-files/scripts/session-catchup.py` (+10 -9) 📝 `.continue/skills/planning-with-files/scripts/session-catchup.py` (+10 -9) 📝 `.gemini/skills/planning-with-files/scripts/session-catchup.py` (+10 -9) 📝 `.openclaw/skills/planning-with-files/scripts/session-catchup.py` (+10 -9) 📝 `.opencode/skills/planning-with-files/scripts/session-catchup.py` (+7 -9) 📝 `.pi/skills/planning-with-files/scripts/session-catchup.py` (+10 -9) 📝 `skills/planning-with-files/scripts/session-catchup.py` (+10 -9) </details> ### 📄 Description ## Summary Fix false-positive catchup reports in skill-distributed `session-catchup.py` copies. ## Scope Applied to all affected skill-copy scripts (9 files): - `skills/planning-with-files/scripts/session-catchup.py` - `.adal/skills/planning-with-files/scripts/session-catchup.py` - `.codebuddy/skills/planning-with-files/scripts/session-catchup.py` - `.codex/skills/planning-with-files/scripts/session-catchup.py` - `.continue/skills/planning-with-files/scripts/session-catchup.py` - `.gemini/skills/planning-with-files/scripts/session-catchup.py` - `.openclaw/skills/planning-with-files/scripts/session-catchup.py` - `.opencode/skills/planning-with-files/scripts/session-catchup.py` - `.pi/skills/planning-with-files/scripts/session-catchup.py` Root `scripts/session-catchup.py` is intentionally unchanged. ## What changed 1. Added early return when planning files are absent in the project (`has_planning_files == False`). 2. Added early return when no planning update is found in the target session (`last_update_line < 0`). 3. Removed the no-update fallback branch that emitted `UNSYNCED CONTEXT` from non-planning history. ## Why `.opencode` diff is different `.opencode` already had the planning-files guard, so only the no-planning-update fallback removal was needed there. ## Before / After (key logic) Before: ```python if last_update_line < 0: messages_after = extract_messages_after(messages, len(messages) - 30) else: messages_after = extract_messages_after(messages, last_update_line) ``` After: ```python if last_update_line < 0: return messages_after = extract_messages_after(messages, last_update_line) ``` And now catchup is gated by active planning context: ```python if not has_planning_files: return ``` ## Validation - Syntax: `python3 -m py_compile` on all modified `session-catchup.py` files. - Manual behavioral checks with synthetic session JSONL data (temporary HOME): - Planning files present + no planning update => script exits silently. - Planning update present => catchup report is emitted. - CodeBuddy variant confirmed to read `~/.codebuddy/projects` and emit `CODEBUDDY:` label. Fixes #78 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 18:50:29 +03:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/planning-with-files#82
No description provided.