Skip to content

Release v7.0.4: Compact and resume option & clickable OSC 8 hyperlinks - #72

Merged
code-crusher merged 3 commits into
mainfrom
release/v7.0.4
Oct 14, 2026
Merged

code-crusher merged 3 commits into
mainfrom
release/v7.0.4

Conversation

@code-crusher

@code-crusher code-crusher commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add 2. Compact and resume option in ResumeConfirm when resuming a session with a cold prompt cache or high token usage.
  • Choosing Compact and resume resumes the session and immediately runs normal conversation compaction (/compact).
  • Sync contextTokens in App.tsx on turn-end so the status bar reflects the compacted context size right after compaction finishes.
  • Enable clickable OSC 8 terminal hyperlinks across Markdown output (attempt_completion bordered boxes, prose, lists, blockquotes, inline code, fenced code blocks, and wrapped Markdown table cells) as well as the login authorization URL.
  • Add direct mouse-click link resolution (getLinkUrlAt) in App.tsx when terminal mouse reporting forwards clicks to the TUI, opening clicked URLs in the default browser while preserving drag-to-select clipboard copying.
  • Default COLORTERM=truecolor on interactive startup when unset so OpenTUI's capability detector enables OSC 8 output in terminals/multiplexers that omit COLORTERM.
  • Bump package version to 7.0.4, add unit tests, and update CHANGELOG.md.

@matterai-app

matterai-app Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Code Quality

Summary By MatterAI MatterAI logo

🔄 What Changed

Introduces a new "Compact and resume" option within the session resumption dialog. When a long-idle or large session's prompt cache expires, users can now choose to compact the conversation history immediately upon resuming, keeping context token counts manageable and avoiding high LLM costs. Corresponding updates were made to App.tsx, the ResumeConfirm component, and robust test coverage.

🔍 Impact of the Change

Empowers users with proactive context management for large sessions. Prevents performance degradation and token budget blowouts by making compaction a first-class choice during session recovery.

📁 Total Files Changed

Click to Expand
File ChangeLog
package.json Bump version to 7.0.4.
src/ui/App.tsx Handle compact decision flow and update resumeSession to return success status.
src/ui/components/ResumeConfirm.tsx Add ResumeDecision type and "Compact and resume" option in prompt dialog.
test/compaction.test.ts Add test verifying immediate compaction upon resume replaces history with summary.
test/resume-confirm.test.tsx Add unit tests verifying selection and handling of the new resume option.

🧪 Test Added/Recommended

Added

  • test/compaction.test.ts: Validates that compacting immediately upon resume successfully reduces context tokens and replaces older history with a summary.
  • test/resume-confirm.test.tsx: Validates keyboard navigation and selection states for the new "Compact and resume" option.

🔒Security Vulnerabilities

No security vulnerabilities introduced. All state updates and session handlings are safely managed within the existing TUI control flow.

⏳ Estimated code review effort

LOW (~7 minutes)

Tip

Quality Recommendations

  1. Consider adding analytics or telemetry to track adoption rates of the 'Compact and resume' option compared to regular resume.

♫ Tanka Poem

Tokens climb too high, 📈
Memory bloats the terminal, 💻
Compact and resume, 🔄
Clean slate for the agent's mind, 🧠
Fresh code flows once more. ✨

Sequence Diagram

sequenceDiagram
    participant User
    participant App as App (TUI)
    participant RC as ResumeConfirm
    participant Agent as Agent Core
    
    User->>App: Select expired session
    App->>RC: Show resume estimate & options
    RC-->>App: User selects "compact" decision
    App->>Agent: resumeSession(session)
    Agent->>Agent: compact() history
    Agent-->>App: Returns success & updated low token count
    App->>Agent: handleCommand("/compact")
    Agent-->>User: Resumed session with compacted context
Loading

@matterai-app

matterai-app Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

✅ Reviewed the changes: Clean release PR — the new 'Compact and resume' option is wired correctly end-to-end (ResumeDecision type → dialog option → handleResumeDecision → resumeSession's new boolean return gating handleCommand("/compact"), with the chdir-failure path correctly returning false to skip compaction), and the turn-end contextTokens sync properly refreshes the status bar with the post-compaction estimate instead of the summary request's full-history usage figure. Tests cover both the agent-level resume-then-compact behavior and the dialog's three-option navigation. Reviewed src/ui/App.tsx: no issues found. Reviewed src/ui/components/ResumeConfirm.tsx: no issues found. Reviewed test/compaction.test.ts: no issues found. Reviewed test/resume-confirm.test.tsx: no issues found.

@code-crusher code-crusher changed the title Release v7.0.4: Compact and resume option on high usage Release v7.0.4: Compact and resume option & clickable OSC 8 hyperlinks Oct 14, 2026

@matterai-app matterai-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧪 PR Review is completed: Well-executed OSC 8 hyperlink feature overall; the markdown URL pipeline introduces a catastrophic-backtracking regex (can freeze the TUI on malformed links with long URLs) and wrapped table-cell URLs whose first line links to a truncated href. Reviewed src/ui/primitives.tsx: no issues found. Reviewed test/markdown-table.test.tsx: no issues found. Reviewed src/index.tsx, src/ui/LoginView.tsx: no issues found.

Skipped files
  • CHANGELOG.md: Skipped file pattern
⬇️ Low Priority Suggestions (1)
src/ui/App.tsx (1 suggestion)

Location: src/ui/App.tsx (Lines 2589-2590)

🔵 Error Handling

Issue: open(url).catch(() => {}) silently swallows link-open failures (e.g. SSH sessions with no browser handler available), so clicking a link does nothing with zero feedback.

Fix: Surface the failure with the existing toast mechanism, consistent with how clipboard results are reported.

Impact: Users understand why the click didn't work instead of a silent no-op.

-          renderer.clearSelection();
-          void open(url).catch(() => {});
+          renderer.clearSelection();
+          void open(url).catch(() => showToast("✗ Could not open link"));

Comment thread src/ui/markdown.tsx Outdated
Comment thread src/ui/markdown.tsx Outdated
@matterai-app

matterai-app Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

✅ Reviewed the changes: All three previously flagged issues are fixed: the ReDoS-prone nested quantifier is replaced with a linear single-character alternation in all three link regexes (plus a timing guard test), wrapped table-cell URL fragments now resolve their full href via fallbackUrls (including mid-URL ./? wrap boundaries), and link-open failures now surface a toast. Reviewed src/ui/markdown.tsx: no issues found. Reviewed test/markdown-table.test.tsx: no issues found. Reviewed src/ui/App.tsx: no issues found.

@code-crusher
code-crusher merged commit c9e7622 into main Oct 14, 2026
1 check passed
@code-crusher
code-crusher deleted the release/v7.0.4 branch October 14, 2026 05:07
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.

1 participant