cc-continuity 0.3.51__tar.gz → 0.3.52__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/PKG-INFO +1 -1
  2. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/README.md +1 -1
  3. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/__init__.py +1 -1
  4. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/ledger.py +35 -19
  5. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/statusline.py +275 -57
  6. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity.egg-info/PKG-INFO +1 -1
  7. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity.egg-info/SOURCES.txt +1 -0
  8. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/pyproject.toml +1 -1
  9. cc_continuity-0.3.52/tests/test_statusline_cache.py +256 -0
  10. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/LICENSE +0 -0
  11. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/__main__.py +0 -0
  12. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/atomic.py +0 -0
  13. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/blink.py +0 -0
  14. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/blink_watch.py +0 -0
  15. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/bootstrap.py +0 -0
  16. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/checkpoint.py +0 -0
  17. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/cli.py +0 -0
  18. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/config.py +0 -0
  19. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/daemon_supervisor.py +0 -0
  20. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/doctor.py +0 -0
  21. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/gitsnap.py +0 -0
  22. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/hooks/__init__.py +0 -0
  23. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/hooks/common.py +0 -0
  24. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/hooks/pre_compact.py +0 -0
  25. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/hooks/pre_tool_use.py +0 -0
  26. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/hooks/session_end.py +0 -0
  27. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/hooks/session_start.py +0 -0
  28. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/hooks/stop.py +0 -0
  29. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/hooks/task.py +0 -0
  30. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/hooks/tool_use.py +0 -0
  31. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/hooks/user_prompt.py +0 -0
  32. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/hosting.py +0 -0
  33. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/install.py +0 -0
  34. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/launch.py +0 -0
  35. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/lock.py +0 -0
  36. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/managed.py +0 -0
  37. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/naming.py +0 -0
  38. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/notify.py +0 -0
  39. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/paths.py +0 -0
  40. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/power_plug.py +0 -0
  41. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/progress_pane.py +0 -0
  42. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/project.py +0 -0
  43. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/redact.py +0 -0
  44. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/rotator.py +0 -0
  45. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/settings_merge.py +0 -0
  46. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/skills.py +0 -0
  47. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/state.py +0 -0
  48. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/thresholds.py +0 -0
  49. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/transcript.py +0 -0
  50. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/validate.py +0 -0
  51. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/watchdog.py +0 -0
  52. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/watchdog_digest.py +0 -0
  53. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity/watchdogd.py +0 -0
  54. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity.egg-info/dependency_links.txt +0 -0
  55. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity.egg-info/entry_points.txt +0 -0
  56. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/cc_continuity.egg-info/top_level.txt +0 -0
  57. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/setup.cfg +0 -0
  58. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_atomic.py +0 -0
  59. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_blink.py +0 -0
  60. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_blink_watch.py +0 -0
  61. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_bootstrap.py +0 -0
  62. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_changelog_notes.py +0 -0
  63. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_checkpoint.py +0 -0
  64. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_cli.py +0 -0
  65. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_cli_ledger.py +0 -0
  66. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_cli_log.py +0 -0
  67. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_config.py +0 -0
  68. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_daemon_supervisor.py +0 -0
  69. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_doctor.py +0 -0
  70. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_gitsnap.py +0 -0
  71. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_hooks_common.py +0 -0
  72. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_hooks_pre_compact.py +0 -0
  73. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_hooks_pre_tool_use.py +0 -0
  74. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_hooks_session_end.py +0 -0
  75. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_hooks_session_start.py +0 -0
  76. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_hooks_stop.py +0 -0
  77. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_hooks_task.py +0 -0
  78. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_hooks_tool_use.py +0 -0
  79. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_hooks_user_prompt.py +0 -0
  80. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_hosting.py +0 -0
  81. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_hygiene.py +0 -0
  82. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_install.py +0 -0
  83. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_integration_phase5.py +0 -0
  84. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_integration_phase6.py +0 -0
  85. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_integration_phase7.py +0 -0
  86. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_launch.py +0 -0
  87. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_ledger.py +0 -0
  88. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_lock.py +0 -0
  89. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_managed.py +0 -0
  90. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_naming.py +0 -0
  91. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_notify.py +0 -0
  92. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_notify_integration.py +0 -0
  93. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_paths.py +0 -0
  94. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_power_plug.py +0 -0
  95. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_progress_pane.py +0 -0
  96. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_project.py +0 -0
  97. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_readme_badges.py +0 -0
  98. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_readme_gif.py +0 -0
  99. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_redact.py +0 -0
  100. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_rotator.py +0 -0
  101. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_settings_merge.py +0 -0
  102. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_skills.py +0 -0
  103. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_state.py +0 -0
  104. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_status.py +0 -0
  105. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_statusline.py +0 -0
  106. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_thresholds.py +0 -0
  107. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_tmux_host.py +0 -0
  108. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_transcript.py +0 -0
  109. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_transcript_finalize.py +0 -0
  110. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_uninstall.py +0 -0
  111. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_validate.py +0 -0
  112. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_watchdog.py +0 -0
  113. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_watchdog_digest.py +0 -0
  114. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_watchdog_integration.py +0 -0
  115. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_watchdogd.py +0 -0
  116. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_wsl_doctor.py +0 -0
  117. {cc_continuity-0.3.51 → cc_continuity-0.3.52}/tests/test_wsl_install.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cc-continuity
3
- Version: 0.3.51
3
+ Version: 0.3.52
4
4
  Summary: Zero-touch session rotation for Claude Code (local large-context model)
5
5
  Classifier: Development Status :: 5 - Production/Stable
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -41,11 +41,11 @@ The five most recent updates, newest first. Each line links to its
41
41
  commit, so you can see what changed lately without digging through the
42
42
  log:
43
43
 
44
+ - **2026-11-21**: The status line now runs its heavy work only at tool boundaries. Idle re-renders reuse the cached facts (session lookup, ledger reads, transcript parse, pane capture) while the shimmer sweep, the reply settle marker and the HUD ratio keep moving, the mode-1 pane feed only rewrites when the data changes, and a corrupt or missing cache always falls back to the full render ([commit](https://github.com/pqant/claude-continuity/commit/7601949)).
44
45
  - **2026-11-20**: The README now shows the product in motion. A short GIF sits in the How it works section: the animated context-usage segment sweeps while live, then the rotation handoff moments (`HANDOFF!`, `ROTATING`) and the fresh successor session follow, every frame drawn by the real status line code ([commit](https://github.com/pqant/claude-continuity/commit/73ede6c)).
45
46
  - **2026-11-19**: A warned session no longer idles on its own handoff. After the c1 rotation warning the model could write its `handoff.draft.md`, but drafts were only ever read in HANDOFF_REQUESTED, so the session waited at the prompt with a finished handoff on disk; the Stop hook now consumes a WARNED draft at turn end through the normal handoff path - a valid draft finalizes silently, an invalid one gets the usual guidance - and sessions that were never warned never rotate on a self-written draft ([commit](https://github.com/pqant/claude-continuity/commit/330d4db)).
46
47
  - **2026-11-19**: Two small observability wins for the push layer. `notify stop|notification --dry-run` renders the exact push (enabled state, title, priority and body) without sending anything or burning the one-push-per-minute bucket, and `watchdog status` now ends with a `last heartbeat: <local time> (<N>s ago)` line so a stalled daemon is visible at a glance; a missing or corrupt stamp reads `last heartbeat: never` ([commit](https://github.com/pqant/claude-continuity/commit/eb93cc1)).
47
48
  - **2026-11-18**: The rotation gate can no longer invert silently. `doctor` gained a `config-sanity` check that verifies `0 < warn_ratio <= rotate_ratio <= hard_ratio < 1`, a plausible `window_tokens` (>= 32768) and an http(s) `notify_endpoint`, naming the offending values in its detail; a typo like warn 0.80 / rotate 0.75 used to make rotations fire late or never. The check is warn-only, the values stay the user's call ([commit](https://github.com/pqant/claude-continuity/commit/c7381cc)).
48
- - **2026-11-18**: The session chain went machine-readable: `cc-continuity history --json` prints it as one JSON array with stable keys (`nnn`, `name`, `session_id`, `created`, `state`). The state comes from each session's `state.json` with the same fallback the status rotation line uses, a project without a record prints `[]`, and the default human output is unchanged ([commit](https://github.com/pqant/claude-continuity/commit/180b761)).
49
49
  ## How it works
50
50
 
51
51
  The whole flow in one picture: the automatic session loop, the optional
@@ -4,4 +4,4 @@ Spec: docs/PRD.md (v1.0). Platform facts verified in docs/VERIFICATION.md.
4
4
  Standard library only at runtime; pytest is dev-only.
5
5
  """
6
6
 
7
- __version__ = "0.3.51"
7
+ __version__ = "0.3.52"
@@ -94,6 +94,35 @@ _RESUME_TYPES = frozenset({"tool_use", "tool_failure", "task_created",
94
94
  "task_completed", "stop"})
95
95
 
96
96
 
97
+ def reply_state(session_dir: str | Path) -> "tuple[float | None, bool]":
98
+ """``(pending_ts, selfwake_consumed)`` of the latest ``reply_ready``.
99
+
100
+ Raw split of the :func:`reply_pending` read, for callers that keep the
101
+ facts in a render cache between status line invocations (issue #77):
102
+ ``pending_ts`` is the latest unconsumed ``reply_ready`` ts (settle
103
+ NOT applied), and ``selfwake_consumed`` says a wake entry newer than
104
+ that reply marks the wait as self-answered. Never raises.
105
+ """
106
+ try:
107
+ entries = read(session_dir)
108
+ except (OSError, ValueError):
109
+ return None, False
110
+ pending = None
111
+ for entry in entries:
112
+ t = entry.get("type")
113
+ if t == "reply_ready":
114
+ pending = entry.get("ts")
115
+ elif (t == "user_prompt" and not entry.get("agent_id")) or t == "reply_read":
116
+ pending = None
117
+ if pending is None:
118
+ return None, False
119
+ for entry in entries:
120
+ if (entry.get("type") in _RESUME_TYPES
121
+ and (entry.get("ts") or 0) > pending):
122
+ return pending, True # woke itself: never a wait for the user
123
+ return pending, False
124
+
125
+
97
126
  def reply_pending(session_dir: str | Path, *, settle: float = 0.0,
98
127
  now: float | None = None) -> float | None:
99
128
  """Ts of the latest UNCONSUMED ``reply_ready`` entry, or None.
@@ -112,26 +141,13 @@ def reply_pending(session_dir: str | Path, *, settle: float = 0.0,
112
141
  wakes itself was never waiting for the user. ``now`` is injectable
113
142
  for tests; ``settle=0`` keeps the raw read.
114
143
  """
115
- try:
116
- entries = read(session_dir)
117
- except (OSError, ValueError):
118
- return None
119
- pending = None
120
- for entry in entries:
121
- t = entry.get("type")
122
- if t == "reply_ready":
123
- pending = entry.get("ts")
124
- elif (t == "user_prompt" and not entry.get("agent_id")) or t == "reply_read":
125
- pending = None
126
- if pending is None:
144
+ pending, selfwake = reply_state(session_dir)
145
+ if pending is None or selfwake:
127
146
  return None
128
- now = time.time() if now is None else now
129
- if settle > 0 and now - pending < settle:
130
- return None # settling: an auto-continue may still land
131
- for entry in entries:
132
- if (entry.get("type") in _RESUME_TYPES
133
- and (entry.get("ts") or 0) > pending):
134
- return None # woke itself: never a wait for the user
147
+ if settle > 0:
148
+ now = time.time() if now is None else now
149
+ if now - pending < settle:
150
+ return None # settling: an auto-continue may still land
135
151
  return pending
136
152
 
137
153
 
@@ -716,6 +716,136 @@ def compose_line(chained: str, segment: str) -> str:
716
716
  return f"{chained} {segment}"
717
717
 
718
718
 
719
+ # ------------------------------------------------------------- render cache
720
+ # Issue #77: CC re-renders the status line ~1/s while the session sits
721
+ # idle. The heavy stages (session lookup, ledger reads, the transcript
722
+ # tail behind the turn clock, the tmux pane capture, the pane-data
723
+ # rewrite) all produce the same facts between tool calls, so their
724
+ # results are cached in runtime/ and only refreshed when a cheap stat
725
+ # fingerprint moves: a ledger append (any hook event writes the ledger
726
+ # or the pane binding), a session-registry or state.json rewrite, or
727
+ # transcript growth. Wall-time stages (shimmer sweep, reply settle, the
728
+ # ratio straight from the payload) keep flowing on every render, so the
729
+ # "always animated" ruling holds and HUD numbers never freeze. Any
730
+ # doubt (missing/corrupt cache, changed config, moved file) falls back
731
+ # to the full render - the line is never wrong because of the cache.
732
+
733
+ _RENDER_CACHE_PREFIX = "status-render-cache-"
734
+ _RENDER_CACHE_VERSION = 1
735
+
736
+
737
+ def _stat_sig(path):
738
+ """Cheap change fingerprint of a file, or None when it is absent."""
739
+ try:
740
+ st = os.stat(path)
741
+ except OSError:
742
+ return None
743
+ return [int(st.st_mtime_ns), int(st.st_size)]
744
+
745
+
746
+ def _tree_sig():
747
+ """Directory-mtime fingerprint of the session registry (issue #77).
748
+
749
+ A new project rotates ``projects/``, a new session rotates the
750
+ per-project ``sessions/`` dir - no file read is needed to notice a
751
+ session appearing (the payload sid can gain a state.json while we
752
+ sit on a cached ``record = None``).
753
+ """
754
+ base = paths.projects_dir()
755
+ try:
756
+ parts = [int(os.stat(base).st_mtime_ns)]
757
+ except OSError:
758
+ return None
759
+ try:
760
+ projs = sorted(p.name for p in base.iterdir())
761
+ except OSError:
762
+ return parts
763
+ for name in projs:
764
+ try:
765
+ parts.append(int(os.stat(base / name / "sessions").st_mtime_ns))
766
+ except OSError:
767
+ continue
768
+ return parts
769
+
770
+
771
+ def _render_cache_key(payload):
772
+ """Pane-scoped (preferred, the #71 authority) or session-scoped key.
773
+
774
+ None when neither is available (no pane, no payload sid) - those
775
+ renders are trivial anyway and keep the pre-#77 path untouched.
776
+ """
777
+ path, _pane = _pane_binding()
778
+ if path is not None:
779
+ return path.name[len("pane-"):-len(".json")]
780
+ sid = payload.get("session_id") if isinstance(payload, dict) else None
781
+ if isinstance(sid, str) and sid:
782
+ return "sid-" + re.sub(r"[^A-Za-z0-9%_.-]", "_", sid)[:64]
783
+ return None
784
+
785
+
786
+ def _render_cache_path(key):
787
+ return paths.runtime_dir() / f"{_RENDER_CACHE_PREFIX}{key}.json"
788
+
789
+
790
+ def _binding_wall_ts():
791
+ """Wall ts of the pane binding file (its mtime == the hook-stamped
792
+ ts), or None without a pane/binding. The hit path re-applies the
793
+ #71 freshness gate from this without re-reading the file."""
794
+ path, _pane = _pane_binding()
795
+ if path is None:
796
+ return None
797
+ try:
798
+ return os.stat(path).st_mtime_ns / 1e9
799
+ except OSError:
800
+ return None
801
+
802
+
803
+ def _render_sig(cfg, ansi, payload, tp):
804
+ """Everything that must MATCH for a cached render to be reusable."""
805
+ return {"v": _RENDER_CACHE_VERSION,
806
+ "sid": (payload or {}).get("session_id"),
807
+ "mode": config.progress_mode(cfg),
808
+ "ansi": bool(ansi),
809
+ "blink_reply": config.blink_reply(cfg),
810
+ "settle": config.blink_reply_settle(cfg),
811
+ "turn_clock": config.turn_clock(cfg),
812
+ "tp": tp if isinstance(tp, str) else None}
813
+
814
+
815
+ def _facts_stats(cache):
816
+ """Recompute the live stat fingerprint for a cached fact set."""
817
+ sdir_info = cache.get("sdir")
818
+ if sdir_info:
819
+ sdir = paths.session_dir(sdir_info[0], int(sdir_info[1]))
820
+ state_sig = _stat_sig(sdir / "state.json")
821
+ ledger_sig = _stat_sig(sdir / ledger.LEDGER_NAME)
822
+ else:
823
+ state_sig = ledger_sig = None
824
+ bind_path, _pane = _pane_binding()
825
+ return {"tree": _tree_sig(), "state": state_sig,
826
+ "ledger": ledger_sig,
827
+ "bind": _stat_sig(bind_path) if bind_path is not None else None}
828
+
829
+
830
+ def _load_render_cache(cache_path, sig):
831
+ """Validate a cached render state, or None for a full render."""
832
+ if cache_path is None:
833
+ return None
834
+ try:
835
+ cache = json.loads(cache_path.read_text(encoding="utf-8"))
836
+ except (OSError, ValueError):
837
+ return None
838
+ if not isinstance(cache, dict) or cache.get("sig") != sig:
839
+ return None
840
+ stats = cache.get("stats")
841
+ if not isinstance(stats, dict) or not isinstance(cache.get("record"),
842
+ (dict, type(None))):
843
+ return None
844
+ if stats != _facts_stats(cache):
845
+ return None
846
+ return cache
847
+
848
+
719
849
  # ------------------------------------------------------------------- entry
720
850
 
721
851
 
@@ -736,59 +866,102 @@ def run(stdin_bytes: bytes, cfg: dict) -> str:
736
866
  payload = None
737
867
 
738
868
  enabled = config.is_enabled(cfg)
869
+ ansi = bool(cfg.get("statusline_ansi", True))
870
+ now = time.time()
871
+ mode = config.progress_mode(cfg)
739
872
  metric = None
740
873
  record = None
874
+ bound = None
875
+ blocked = None
876
+ pending = None
877
+ wake = False
878
+ prev_dur = None
879
+ region = None
880
+ cache = None
881
+ cache_path = None
882
+ cache_dirty = False
883
+ pane_data = None
884
+ ratio = None
741
885
  if enabled:
742
886
  window = cfg.get("window_tokens") or 0
743
887
  metric = extract_metric(payload, window)
744
- # issue #71: the pane's hook-stamped binding names the sid the
745
- # session is actually tracked under; a zombie render (abandoned
746
- # startup sid) must write under it, else the gate starves.
747
- bound = (_pane_bound_sid(payload.get("session_id"))
748
- if payload is not None else None)
888
+ ratio = metric["ratio"] if metric is not None else None
889
+ # issue #77: before paying for ANY heavy stage, consult the render
890
+ # cache. A hit reuses the facts; only the cheap stat fingerprint,
891
+ # the payload ratio, the reply settle and the sweep move.
892
+ key = _render_cache_key(payload)
893
+ cache_path = _render_cache_path(key) if key else None
894
+ tp = metric.get("transcript_path") if metric is not None else None
895
+ sig = _render_sig(cfg, ansi, payload, tp)
896
+ cache = _load_render_cache(cache_path, sig)
897
+ if cache is None:
898
+ # issue #71: the pane's hook-stamped binding names the sid the
899
+ # session is actually tracked under; a zombie render (abandoned
900
+ # startup sid) must write under it, else the gate starves.
901
+ bound = (_pane_bound_sid(payload.get("session_id"))
902
+ if payload is not None else None)
903
+ if payload is not None:
904
+ record = find_session_by_id(bound or payload.get("session_id"))
905
+ if record is not None:
906
+ sdir = paths.session_dir(record["project_key"],
907
+ int(record["nnn"]))
908
+ try:
909
+ blocked = ledger.blocked_reason(sdir)
910
+ except (OSError, ValueError):
911
+ blocked = None
912
+ if config.blink_reply(cfg):
913
+ # settle (user ruling 2026-11-07): a just-finished turn
914
+ # is only reported once its settle window elapsed and
915
+ # nothing woke the session since - CC re-renders ~1/s
916
+ # while idle, so the marker lands on the first settled
917
+ # render and an auto-continuation keeps it out entirely.
918
+ # issue #77: the raw ts + selfwake split is cached, the
919
+ # settle window itself is applied per render by wall
920
+ # time, so the marker still lands mid-idle.
921
+ try:
922
+ pending, wake = ledger.reply_state(sdir)
923
+ except (OSError, ValueError):
924
+ pending, wake = None, False
925
+ # Issue #45: prev-task wall time for the HUD (turn_clock
926
+ # opt-in). The transcript path rides the status line payload;
927
+ # the parse is the guarded #44 tail reader and must never take
928
+ # the HUD down.
929
+ if config.turn_clock(cfg) and metric is not None:
930
+ tp = metric.get("transcript_path")
931
+ if isinstance(tp, str) and tp:
932
+ try:
933
+ prev_dur = transcript.prev_task_duration(tp)
934
+ except Exception:
935
+ prev_dur = None
936
+ region = _input_box_lines() if (ansi and ratio is not None
937
+ and not (record is not None
938
+ and record.get("off"))
939
+ ) else None
940
+ else:
941
+ record = cache.get("record")
942
+ bound = cache.get("bound")
943
+ binding_ts = cache.get("binding_ts")
944
+ if bound is not None:
945
+ # same freshness gate as _pane_bound_sid, no re-read: the
946
+ # binding stat fingerprint already ruled out a change.
947
+ if (not isinstance(binding_ts, (int, float))
948
+ or isinstance(binding_ts, bool)
949
+ or now - binding_ts > STALE_SECONDS):
950
+ bound = None
951
+ blocked = cache.get("blocked")
952
+ pending = cache.get("reply_ts")
953
+ wake = bool(cache.get("reply_wake"))
954
+ prev_dur = cache.get("prev_dur")
955
+ region = cache.get("region")
749
956
  if metric is not None:
750
957
  if bound is not None:
751
958
  metric = dict(metric, session_id=bound)
752
959
  write_metric(metric)
753
- if payload is not None:
754
- record = find_session_by_id(bound or payload.get("session_id"))
755
960
 
756
- ratio = metric["ratio"] if metric is not None else None
757
- blocked = None
758
- reply = False
759
- if record is not None:
760
- try:
761
- blocked = ledger.blocked_reason(
762
- paths.session_dir(record["project_key"],
763
- int(record["nnn"])))
764
- except (OSError, ValueError):
765
- blocked = None
766
- if config.blink_reply(cfg):
767
- # settle (user ruling 2026-11-07): a just-finished turn is
768
- # only reported once its settle window elapsed and nothing
769
- # woke the session since - CC re-renders ~1/s while idle,
770
- # so the marker lands on the first settled render and an
771
- # auto-continuation keeps it out entirely.
772
- try:
773
- reply = ledger.reply_pending(
774
- paths.session_dir(record["project_key"],
775
- int(record["nnn"])),
776
- settle=config.blink_reply_settle(cfg),
777
- now=time.time()) is not None
778
- except (OSError, ValueError):
779
- reply = False
780
- # Issue #45: prev-task wall time for the HUD (turn_clock opt-in).
781
- # The transcript path rides the status line payload; the parse is the
782
- # guarded #44 tail reader and must never take the HUD down.
783
- prev_dur = None
784
- if enabled and config.turn_clock(cfg) and metric is not None:
785
- tp = metric.get("transcript_path")
786
- if isinstance(tp, str) and tp:
787
- try:
788
- prev_dur = transcript.prev_task_duration(tp)
789
- except Exception:
790
- prev_dur = None
791
- ansi = bool(cfg.get("statusline_ansi", True))
961
+ settle = config.blink_reply_settle(cfg)
962
+ reply = (record is not None and config.blink_reply(cfg)
963
+ and pending is not None and not wake
964
+ and not (settle > 0 and now - pending < settle))
792
965
  live = (enabled and ratio is not None
793
966
  and not (record is not None and record.get("off")))
794
967
  # Revision 11: in mode 0 the sweep is ALWAYS on for live ansi
@@ -799,15 +972,13 @@ def run(stdin_bytes: bytes, cfg: dict) -> str:
799
972
  # SHIMMER_CELLS_PER_S, no typing required. A static/off segment still
800
973
  # never reads the pane (short-circuit); the capture feeds the render
801
974
  # diagnostic log only (ut= stays honest: 1 = the word WAS in the box).
802
- now = time.time()
803
- region = _input_box_lines() if (ansi and live) else None
975
+ # issue #77: on a cache hit the capture itself is the cached region.
804
976
  word = bool(region) and bool(
805
977
  ULTRATHINK_RE.search("\n".join(region)))
806
978
  # issue #11: same live-capture gate as the ultrathink word: a dead
807
979
  # pane must not strand an ASK marker. blink.ask_visible covers both
808
980
  # permission wording and selection footers (AskUserQuestion).
809
981
  ask = bool(region) and blink.ask_visible("\n".join(region))
810
- mode = config.progress_mode(cfg)
811
982
  if mode == 1:
812
983
  # Phase 12 fix (user bug A): in mode 1 the PANE is the ONLY
813
984
  # progress display — the status line must not render the same
@@ -823,11 +994,20 @@ def run(stdin_bytes: bytes, cfg: dict) -> str:
823
994
  # display there.
824
995
  from . import progress_pane # local: it imports from THIS module
825
996
  sweep_pos = None
826
- try:
827
- result = progress_pane.ensure_progress_pane(cfg)
828
- except Exception:
829
- result = {}
830
- win = result.get("window_id") if isinstance(result, dict) else None
997
+ if cache is None:
998
+ try:
999
+ result = progress_pane.ensure_progress_pane(cfg)
1000
+ except Exception:
1001
+ result = {}
1002
+ win = (result.get("window_id")
1003
+ if isinstance(result, dict) else None)
1004
+ else:
1005
+ # issue #77: on a hit the pane decision is the cached one; the
1006
+ # tmux self-heal query rides the next tool boundary.
1007
+ m1 = cache.get("mode1") or {}
1008
+ result = m1.get("result")
1009
+ win = m1.get("win")
1010
+ pane_data = cache.get("pane_data")
831
1011
  if win:
832
1012
  # Feed the pane only when we have a real metric (ratio present).
833
1013
  # A no-metric render (idle between turns — e.g. the instant a
@@ -844,13 +1024,25 @@ def run(stdin_bytes: bytes, cfg: dict) -> str:
844
1024
  # fresh session, not a measurement; an existing file is never
845
1025
  # rewritten by a no-metric render (no downgrade, no re-flash).
846
1026
  if ratio is not None:
847
- progress_pane.write_progress_data(win, render_segment(
848
- ratio, record, enabled, blocked=blocked, ansi=False,
849
- ask=ask, reply=reply, prev_dur=prev_dur))
1027
+ data = render_segment(ratio, record, enabled,
1028
+ blocked=blocked, ansi=False,
1029
+ ask=ask, reply=reply,
1030
+ prev_dur=prev_dur)
1031
+ # issue #77: on a cache hit the rewrite happens only when
1032
+ # the pane data actually moved (ratio/marker flow); an
1033
+ # idle repeat leaves the file (and its animator's mtime
1034
+ # check) untouched. Misses keep today's unconditional feed.
1035
+ if cache is None or data != pane_data:
1036
+ progress_pane.write_progress_data(win, data)
1037
+ pane_data = data
1038
+ cache_dirty = True
850
1039
  elif enabled and not progress_pane.has_progress_data(win):
851
- progress_pane.write_progress_data(win, render_segment(
852
- 0.0, record, enabled, blocked=blocked, ansi=False,
853
- ask=ask, reply=reply, prev_dur=prev_dur))
1040
+ pane_data = render_segment(0.0, record, enabled,
1041
+ blocked=blocked, ansi=False,
1042
+ ask=ask, reply=reply,
1043
+ prev_dur=prev_dur)
1044
+ progress_pane.write_progress_data(win, pane_data)
1045
+ cache_dirty = True
854
1046
  segment = ""
855
1047
  elif (isinstance(result, dict)
856
1048
  and result.get("reason") in ("no-window", "error")):
@@ -889,6 +1081,32 @@ def run(stdin_bytes: bytes, cfg: dict) -> str:
889
1081
  ansi=ansi, now=now, shimmer=shimmer,
890
1082
  shimmer_pos=sweep_pos, ask=ask,
891
1083
  reply=reply, prev_dur=prev_dur)
1084
+ if cache_path is not None:
1085
+ if enabled and cache is None:
1086
+ cache_obj = {"sig": sig,
1087
+ "record": record,
1088
+ "sdir": ([record["project_key"], record["nnn"]]
1089
+ if isinstance(record, dict) else None),
1090
+ "bound": bound,
1091
+ "binding_ts": _binding_wall_ts(),
1092
+ "blocked": blocked,
1093
+ "reply_ts": pending, "reply_wake": bool(wake),
1094
+ "prev_dur": prev_dur,
1095
+ "region": region,
1096
+ "mode1": ({"result": result, "win": win}
1097
+ if mode == 1 else None),
1098
+ "pane_data": pane_data}
1099
+ try:
1100
+ cache_obj["stats"] = _facts_stats(cache_obj)
1101
+ atomic.atomic_write_json(cache_path, cache_obj)
1102
+ except (OSError, ValueError):
1103
+ pass
1104
+ elif cache_dirty:
1105
+ cache["pane_data"] = pane_data
1106
+ try:
1107
+ atomic.atomic_write_json(cache_path, cache)
1108
+ except (OSError, ValueError):
1109
+ pass
892
1110
  _render_log(enabled, ansi, live, word, now, region, segment,
893
1111
  sweep_pos)
894
1112
  chained = chain(cfg.get("chained_statusline"), stdin_bytes)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cc-continuity
3
- Version: 0.3.51
3
+ Version: 0.3.52
4
4
  Summary: Zero-touch session rotation for Claude Code (local large-context model)
5
5
  Classifier: Development Status :: 5 - Production/Stable
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -100,6 +100,7 @@ tests/test_skills.py
100
100
  tests/test_state.py
101
101
  tests/test_status.py
102
102
  tests/test_statusline.py
103
+ tests/test_statusline_cache.py
103
104
  tests/test_thresholds.py
104
105
  tests/test_tmux_host.py
105
106
  tests/test_transcript.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "cc-continuity"
7
- version = "0.3.51"
7
+ version = "0.3.52"
8
8
  description = "Zero-touch session rotation for Claude Code (local large-context model)"
9
9
  requires-python = ">=3.11"
10
10
  classifiers = [
@@ -0,0 +1,256 @@
1
+ """Issue #77: idle status line invocations must not re-run the heavy stages.
2
+
3
+ CC re-renders the status line about once per second while a session sits
4
+ idle. The heavy stages behind the segment (session lookup, ledger reads,
5
+ the transcript parse behind the turn clock, the tmux pane capture, the
6
+ progress-data rewrite) all produce the same facts between tool calls, so
7
+ between boundaries they must run exactly once: the render reuses the
8
+ cached facts and only the wall-time stages (shimmer sweep, reply settle,
9
+ the ratio straight from the payload) keep flowing. Any tool-boundary file
10
+ change (ledger append, state rewrite, transcript growth, pane re-render)
11
+ invalidates the cache for the very next render.
12
+ """
13
+
14
+ import json
15
+ import time
16
+
17
+ from cc_continuity import blink, config, ledger, paths, progress_pane, statusline, transcript
18
+ from hookutil import SID, make_repo, register_session
19
+
20
+ T0 = 1_800_000_000.0
21
+
22
+
23
+ def _clock(monkeypatch):
24
+ box = [T0]
25
+ monkeypatch.setattr(time, "time", lambda: box[0])
26
+ return box
27
+
28
+
29
+ def _counters(monkeypatch):
30
+ """Wrap every heavy stage so each call is recorded."""
31
+ calls = {"blocked": 0, "reply": 0, "prev_dur": 0, "capture": 0,
32
+ "session": 0, "write_progress": 0, "ensure_pane": 0}
33
+
34
+ blocked = ledger.blocked_reason
35
+
36
+ def blocked_w(session_dir):
37
+ calls["blocked"] += 1
38
+ return blocked(session_dir)
39
+
40
+ monkeypatch.setattr(ledger, "blocked_reason", blocked_w)
41
+
42
+ reply_pending = getattr(ledger, "reply_pending", None)
43
+ reply_state = getattr(ledger, "reply_state", None)
44
+
45
+ def reply_w(fn):
46
+ def w(session_dir, **kw):
47
+ calls["reply"] += 1
48
+ return fn(session_dir, **kw)
49
+ return w
50
+
51
+ if reply_pending is not None:
52
+ monkeypatch.setattr(ledger, "reply_pending", reply_w(reply_pending))
53
+ if reply_state is not None:
54
+ monkeypatch.setattr(ledger, "reply_state", reply_w(reply_state))
55
+
56
+ prev = transcript.prev_task_duration
57
+
58
+ def prev_w(path, **kw):
59
+ calls["prev_dur"] += 1
60
+ return prev(path, **kw)
61
+
62
+ monkeypatch.setattr(transcript, "prev_task_duration", prev_w)
63
+
64
+ capture = statusline._input_box_lines
65
+
66
+ def capture_w(*a, **kw):
67
+ calls["capture"] += 1
68
+ return capture(*a, **kw)
69
+
70
+ monkeypatch.setattr(statusline, "_input_box_lines", capture_w)
71
+
72
+ find = statusline.find_session_by_id
73
+
74
+ def find_w(sid):
75
+ calls["session"] += 1
76
+ return find(sid)
77
+
78
+ monkeypatch.setattr(statusline, "find_session_by_id", find_w)
79
+
80
+ write_progress = progress_pane.write_progress_data
81
+
82
+ def write_w(win, data):
83
+ calls["write_progress"] += 1
84
+ calls.setdefault("progress_data", []).append(data)
85
+ return write_progress(win, data)
86
+
87
+ monkeypatch.setattr(progress_pane, "write_progress_data", write_w)
88
+
89
+ ensure = progress_pane.ensure_progress_pane
90
+
91
+ def ensure_w(cfg):
92
+ calls["ensure_pane"] += 1
93
+ return {"window_id": "@1"}
94
+
95
+ monkeypatch.setattr(progress_pane, "ensure_progress_pane", ensure_w)
96
+ has_data = progress_pane.has_progress_data
97
+
98
+ def has_w(win):
99
+ return True
100
+
101
+ monkeypatch.setattr(progress_pane, "has_progress_data", has_w)
102
+ return calls
103
+
104
+
105
+ def _cfg(**over):
106
+ c = dict(config.DEFAULTS)
107
+ c.update(over)
108
+ return c
109
+
110
+
111
+ def _payload(repo, **over):
112
+ p = {
113
+ "session_id": SID,
114
+ "cwd": str(repo),
115
+ "context_window": {
116
+ "context_window_size": 262144,
117
+ "current_usage": {
118
+ "input_tokens": 23170,
119
+ "output_tokens": 0,
120
+ "cache_creation_input_tokens": 0,
121
+ "cache_read_input_tokens": 0,
122
+ },
123
+ },
124
+ }
125
+ p.update(over)
126
+ return p
127
+
128
+
129
+ def _run(payload, **cfg_over):
130
+ return statusline.run(json.dumps(payload).encode("utf-8"),
131
+ _cfg(**cfg_over))
132
+
133
+
134
+ def test_idle_repeated_render_runs_heavy_stages_once(cc_home, tmp_path,
135
+ monkeypatch):
136
+ repo = make_repo(tmp_path)
137
+ register_session(repo)
138
+ tp = tmp_path / "t.jsonl"
139
+ tp.write_text("{}\n", encoding="utf-8")
140
+ calls = _counters(monkeypatch)
141
+ _clock(monkeypatch)
142
+ payload = _payload(repo, transcript_path=str(tp))
143
+
144
+ first = _run(payload, statusline_ansi=True, turn_clock=True)
145
+ second = _run(payload, statusline_ansi=True, turn_clock=True)
146
+ third = _run(payload, statusline_ansi=True, turn_clock=True)
147
+
148
+ assert first and second and third
149
+ # frozen clock: the visible line must be identical, not merely similar
150
+ assert second == first and third == first
151
+ # the idle repeats must not touch the heavy stages again
152
+ assert calls["blocked"] == 1
153
+ assert calls["reply"] == 1
154
+ assert calls["prev_dur"] == 1
155
+ assert calls["capture"] == 1
156
+ assert calls["session"] == 1
157
+
158
+
159
+ def test_ledger_boundary_invalidates_next_render(cc_home, tmp_path,
160
+ monkeypatch):
161
+ repo = make_repo(tmp_path)
162
+ key, nnn = register_session(repo)
163
+ sdir = paths.session_dir(key, nnn)
164
+ calls = _counters(monkeypatch)
165
+ _clock(monkeypatch)
166
+ payload = _payload(repo)
167
+
168
+ first = _run(payload, statusline_ansi=False)
169
+ # a tool-boundary ledger append (no other file changes)
170
+ ledger.append(sdir, {"type": "tool_use", "tool": "Bash"})
171
+ second = _run(payload, statusline_ansi=False)
172
+
173
+ assert first == second # display unchanged
174
+ assert calls["blocked"] == 2 # the boundary forced a fresh read
175
+
176
+
177
+ def test_reply_settle_lands_on_wall_clock_without_a_reread(cc_home,
178
+ tmp_path,
179
+ monkeypatch):
180
+ repo = make_repo(tmp_path)
181
+ key, nnn = register_session(repo)
182
+ sdir = paths.session_dir(key, nnn)
183
+ clock = _clock(monkeypatch)
184
+ clock[0] = T0 - 2.0
185
+ ledger.append(sdir, {"type": "reply_ready"}) # ts = T0-2 (fake clock)
186
+ clock[0] = T0
187
+ calls = _counters(monkeypatch)
188
+ payload = _payload(repo)
189
+
190
+ first = _run(payload, statusline_ansi=False) # settling: no marker yet
191
+ assert blink.MARKER_REPLY not in first
192
+ clock[0] = T0 + 6.0 # settle window elapsed, zero file changes
193
+ second = _run(payload, statusline_ansi=False)
194
+
195
+ assert blink.MARKER_REPLY in second
196
+ # the marker flipped from the cached reply ts + wall time alone
197
+ assert calls["blocked"] == 1
198
+ assert calls["reply"] == 1
199
+
200
+
201
+ def test_ratio_flows_from_payload_even_on_cache_hit(cc_home, tmp_path,
202
+ monkeypatch):
203
+ repo = make_repo(tmp_path)
204
+ register_session(repo)
205
+ _counters(monkeypatch)
206
+ _clock(monkeypatch)
207
+
208
+ first = _run(_payload(repo), statusline_ansi=False)
209
+ assert "9%" in first
210
+ grown = _payload(repo)
211
+ grown["context_window"]["current_usage"]["input_tokens"] = 131072
212
+ second = _run(grown, statusline_ansi=False) # no file change at all
213
+ assert "50%" in second
214
+
215
+
216
+ def test_mode1_pane_write_only_when_data_changes(cc_home, tmp_path,
217
+ monkeypatch):
218
+ repo = make_repo(tmp_path)
219
+ register_session(repo)
220
+ calls = _counters(monkeypatch)
221
+ _clock(monkeypatch)
222
+ payload = _payload(repo)
223
+
224
+ first = _run(payload, progress_type=1, statusline_ansi=False)
225
+ assert first == "" # the pane owns the display
226
+ assert calls["write_progress"] == 1
227
+ assert "9%" in calls["progress_data"][-1]
228
+
229
+ _run(payload, progress_type=1, statusline_ansi=False) # idle repeat
230
+ assert calls["write_progress"] == 1 # identical data: no rewrite
231
+ assert calls["ensure_pane"] == 1
232
+
233
+ grown = _payload(repo)
234
+ grown["context_window"]["current_usage"]["input_tokens"] = 131072
235
+ _run(grown, progress_type=1, statusline_ansi=False) # ratio moved
236
+ assert calls["write_progress"] == 2
237
+ assert "50%" in calls["progress_data"][-1]
238
+
239
+
240
+ def test_corrupt_cache_falls_back_to_a_full_render(cc_home, tmp_path,
241
+ monkeypatch):
242
+ repo = make_repo(tmp_path)
243
+ register_session(repo)
244
+ calls = _counters(monkeypatch)
245
+ _clock(monkeypatch)
246
+ payload = _payload(repo)
247
+
248
+ first = _run(payload, statusline_ansi=False)
249
+ caches = list(paths.runtime_dir().glob("status-render-cache-*"))
250
+ assert caches, "render cache file must live under runtime/"
251
+ for c in caches:
252
+ c.write_text("{not json", encoding="utf-8")
253
+ second = _run(payload, statusline_ansi=False)
254
+
255
+ assert second == first
256
+ assert calls["blocked"] == 2 # corrupt cache => full path, no crash
File without changes
File without changes