Skip to content

fix: make streaming search caps recoverable - #4107

Open
lindicaphxag-tech wants to merge 9 commits into
rtk-ai:developfrom
lindicaphxag-tech:fix/recover-streaming-search-cap
Open

lindicaphxag-tech wants to merge 9 commits into
rtk-ai:developfrom
lindicaphxag-tech:fix/recover-streaming-search-cap

Conversation

@lindicaphxag-tech

@lindicaphxag-tech lindicaphxag-tech commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fix the streaming grep/rg cap path so discarded matches are recoverable through the existing recall mechanism.

When stdin search exceeded the result cap, the stream filter emitted only [rtk] output capped at N results and dropped the remaining matches without storing them. The filter now keeps the existing live output behavior, then emits a showing N of M summary after the process exits and archives the complete captured matches through force_tee_tail_hint, which provides the existing rtk recall <hash> recovery hint when recall is enabled.

The recovery entry uses the original search command as its slug and remains disabled when RTK_RECALL=0 / RTK_TEE=0 is set. The configuration guide documents the count and recovery behavior.

Closes #4098

Test plan

  • cargo fmt --all -- --check
  • Regression coverage for the disabled-recall path and for the enabled path: recovery hint, command slug, stored line count/offset, and nonempty SQLite payload.
  • cargo test streaming_search_archives_hidden_matches_for_recall and cargo clippy --all-targets — attempted locally, but the Windows host lacks the MSVC linker (link.exe), so compilation stops before tests run. GitHub currently reports no CI test jobs; maintainer-run CI is needed.
  • Manual CLI reproduction: seq 1 250 | rtk grep -v zzz (requires a working build)

@CLAassistant

CLAassistant commented Sep 18, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@rtk-wshm-sync-bot rtk-wshm-sync-bot Bot added bug Something isn't working search recall labels Sep 18, 2026
@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟡 Risk medium

Summary

Fixes the streaming grep/rg cap handling so matches discarded beyond the result cap are no longer lost. Instead of just printing a capped-output notice, the filter now archives the full captured matches via force_tee_tail_hint on process exit and shows a 'showing N of M' summary with a recall hint, while respecting RTK_RECALL=0/RTK_TEE=0.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #4098


Analyzed automatically by wshm · This is an automated analysis, not a human review.

@lindicaphxag-tech

Copy link
Copy Markdown
Contributor Author

Follow-up on head 01edd09764d8285ddce22b2d8ce560e92e3c2303: I corrected the Rust formatting caught by cargo fmt and added a configuration-guide note explaining the capped count, recall path, and behavior when recall is disabled. cargo fmt --all -- --check passes. I tried the focused Rust regression test, but compilation stops before tests because this Windows host has no MSVC link.exe; the PR currently reports only the CLA check and no repository CI jobs. Could a maintainer enable/approve the CI run and review the updated patch? I have updated the PR test plan to state this limitation precisely.

@lindicaphxag-tech

Copy link
Copy Markdown
Contributor Author

Updated head: 65262cf. While adding end-to-end storage coverage, I noticed the negative test used temp-env, but test builds read environment overrides through the repository's thread-local user_env shim. I changed it to user_env::with_vars and added a positive SQLite-path test that checks the emitted recall hash, command slug, stored line count/offset, and payload. cargo fmt --all -- --check passes. I retried the exact focused test on this head; compilation again stops before the test because link.exe is missing. The PR description now records the precise local limitation. Could a maintainer approve/run upstream CI and review this revision?

lindicaphxag-tech added a commit to lindicaphxag-tech/rtk that referenced this pull request Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working recall search

Projects

None yet

Development

Successfully merging this pull request may close these issues.

output capped at N results: elided lines are unrecoverable and the hint has no recovery path

2 participants