Skip to content

Thread recap: auto-cached summary when returning to an idle thread (#239) - #1569

Merged
currentbits merged 1 commit into
mainfrom
thread-recap-239
Oct 10, 2026
Merged

currentbits merged 1 commit into
mainfrom
thread-recap-239

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Closes #239.

What

  • electron/recap.js: after every successful turn, build an Asked / Changed / Now / Open recap and cache it on the thread (recap: { text, at }). Extractive (free, deterministic); on-device fm rewrites it when present. No cloud provider is billed.
  • threads.get returns detail.recap when the thread sat unvisited ≥30 min (and isn't working), or for a fresh fork with no recap of its own (shows the source's). Computed before the lastVisitedAt stamp; background pushes never carry it.
  • ThreadView latches the recap into a dismissible card (patches drop detail.recap); cached details strip it so a stale one can't reappear.
  • buildHandoffPrefix leads with the source thread's recap when it has one.
  • Sidebar rows omit recap; writing it does not touch updatedAt.

Tests

  • electron/test/recap.test.js: extractive text, fm preference, mid-build staleness guard, idle rule, list stripping, fork display + handoff seed.
  • test/forkHandoff.test.tsx: recap card renders when due and dismisses.

Known limits

  • "Changed" comes from edit-tool names in tool summaries (Claude-style + common snake_case).
  • Failed/stopped turns don't refresh the recap; src/devCoder.ts dev twin not updated.

🤖 Generated with Claude Code

)

Build a short Asked / Changed / Now / Open recap after every successful
turn and cache it on the thread. Extractive by default; on-device fm
rewrites it when available, so no cloud provider is billed.

threads.get returns it when the thread sat unvisited 30+ min, or for a
fresh fork (the source's recap). ThreadView shows a dismissible card.
Hand-off prefixes now lead with the source recap. Sidebar rows omit it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T07:54:45.678280Z c7bbf13 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@currentbits
currentbits merged commit 8bab329 into main Oct 10, 2026
6 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c7bbf131bb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +434 to +437
const recap =
source && source.recap && source.recap.text
? `Recap:\n${source.recap.text}\n\n`
: "";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Omit stale recaps when replaying a rewind

When replayContext is set, sourceId is the current thread, so this reads the thread's cached recap even after rewindThread has truncated the messages without clearing that recap. The next resubmitted turn therefore receives a summary of the discarded future alongside the retained tail, allowing removed instructions or results to influence—and potentially recreate—the work the user explicitly rewound. Only prepend the recap for an actual handoff, or invalidate/rebuild it when rewinding.

Useful? React with 👍 / 👎.

Comment thread electron/recap.js
// A newer turn may have landed while fm ran; its own refresh wins.
if ((store.getMessages(threadId) || []).length !== msgs.length) return null;
if (!store.getThread(threadId)) return null;
const recap = { text: (fm && fm.trim()) || extractive, at: Date.now() };

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Bound and validate fm recap output

When the optional on-device fm returns a verbose or malformed response, this accepts it wholesale despite the four-line instruction being advisory; fmRun permits up to 64 KiB. That oversized text is persisted on every affected thread, rendered in the recap card, and later prepended outside HANDOFF_TOTAL_MAX, potentially consuming a substantial portion of a fork's agent context. Enforce a recap size/line cap and fall back to the bounded extractive recap when the output does not match the requested format.

Useful? React with 👍 / 👎.

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.

Thread recap: auto-cached summary when returning to an idle thread

1 participant