Pane(fix[wait_for_text]): anchor on baseline so stale scrollback no longer matches#47
Open
tony wants to merge 1 commit into
Open
Pane(fix[wait_for_text]): anchor on baseline so stale scrollback no longer matches#47tony wants to merge 1 commit into
tony wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #47 +/- ##
==========================================
+ Coverage 84.91% 84.98% +0.07%
==========================================
Files 40 40
Lines 2294 2305 +11
Branches 294 294
==========================================
+ Hits 1948 1959 +11
Misses 261 261
Partials 85 85 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
Author
Code reviewNo issues found. Checked for bugs and AGENTS.md compliance. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
…onger matches (#45) why: wait_for_text returned found=True on the first poll whenever the pattern was already present in the pane when the call began, so agents using the tool to synchronise on command output saw the wrong result. The sibling wait_for_content_change already snapshots a baseline; wait_for_text now mirrors that pattern. what: - Snapshot (history_size, cursor_y) at entry; compute baseline_abs as the absolute grid index. Each poll re-reads history_size and captures from baseline_abs - hs_now + 1 onward, so the matched region tracks the pane's grid even as content scrolls into history. - Add _read_grid_position and _read_history_size helpers that expand the corresponding tmux format strings via display-message. - Drop content_start / content_end parameters; the baseline anchor supersedes them. Pre-alpha API contract makes this a clean drop. - Rewrite docstring: new "wait for new appearance" semantics, cross- reference search_panes for synchronous matches, sentinel-marker pattern as adversarial-safety guidance, and edge-case notes for scrollback truncation, reverse-index sequences, and clear/reset. - Restructure WAIT_FOR_TEXT_FIXTURES with separate pre_command and during_command fields; add stale_scrollback_does_not_match regression test. - CHANGES: ### Breaking changes entry for the parameter drop (with before/after migration block) and ### Fixes entry for the stale-scrollback behaviour.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #45.
Summary
(history_size, cursor_y)at entry and translate it to a stable absolute grid index; capture frombaseline_abs - hs_now + 1each poll sowait_for_textonly matches lines written after the call begins.content_start/content_endparameters — the baseline anchor supersedes them. Recorded as a### Breaking changesentry with before/after migration.search-panesin the docstring for the synchronous "is the pattern there right now?" case, document the sentinel-marker adversarial-safety pattern, and call out scrollback-truncation / reverse-index /clear/resetedge cases per the issue.WAIT_FOR_TEXT_FIXTURESintopre_command(sent before the wait, settled into baseline) andduring_command(sent before the wait but output appears during it). Addstale_scrollback_does_not_matchregression case.Test plan
uv run ruff check . --fix --show-fixes— cleanuv run ruff format .— no changesuv run mypy— Success: no issues found in 51 source filesuv run py.test --reruns 0 -vvv— 447 passedjust build-docs— build succeededtext_appears_during_waittest: positive path still works (text written during the wait matches)stale_scrollback_does_not_matchtest: pre-existing scrollback no longer matches (regression forwait_for_textmatches stale scrollback immediately — needs baseline anchor #45)timeout_not_foundtest: empty-pane timeout path still works