cc-continuity 0.3.38__tar.gz → 0.3.40__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.
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/PKG-INFO +1 -1
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/README.md +2 -2
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/__init__.py +1 -1
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/bootstrap.py +14 -6
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/hooks/session_start.py +52 -1
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/transcript.py +4 -3
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity.egg-info/PKG-INFO +1 -1
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/pyproject.toml +1 -1
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_bootstrap.py +56 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_hooks_session_start.py +142 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_transcript.py +4 -3
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/LICENSE +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/__main__.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/atomic.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/blink.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/blink_watch.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/checkpoint.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/cli.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/config.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/daemon_supervisor.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/doctor.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/gitsnap.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/hooks/__init__.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/hooks/common.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/hooks/pre_compact.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/hooks/pre_tool_use.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/hooks/session_end.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/hooks/stop.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/hooks/task.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/hooks/tool_use.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/hooks/user_prompt.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/hosting.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/install.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/launch.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/ledger.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/lock.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/managed.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/naming.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/notify.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/paths.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/power_plug.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/progress_pane.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/project.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/redact.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/rotator.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/settings_merge.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/skills.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/state.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/statusline.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/thresholds.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/validate.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/watchdog.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/watchdog_digest.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity/watchdogd.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity.egg-info/SOURCES.txt +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity.egg-info/dependency_links.txt +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity.egg-info/entry_points.txt +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/cc_continuity.egg-info/top_level.txt +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/setup.cfg +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_atomic.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_blink.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_blink_watch.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_checkpoint.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_cli.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_cli_ledger.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_config.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_daemon_supervisor.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_doctor.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_gitsnap.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_hooks_common.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_hooks_pre_compact.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_hooks_pre_tool_use.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_hooks_session_end.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_hooks_stop.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_hooks_task.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_hooks_tool_use.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_hooks_user_prompt.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_hosting.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_hygiene.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_install.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_integration_phase5.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_integration_phase6.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_integration_phase7.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_launch.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_ledger.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_lock.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_managed.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_naming.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_notify.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_notify_integration.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_paths.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_power_plug.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_progress_pane.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_project.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_redact.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_rotator.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_settings_merge.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_skills.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_state.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_status.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_statusline.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_thresholds.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_tmux_host.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_transcript_finalize.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_uninstall.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_validate.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_watchdog.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_watchdog_digest.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_watchdog_integration.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_watchdogd.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_wsl_doctor.py +0 -0
- {cc_continuity-0.3.38 → cc_continuity-0.3.40}/tests/test_wsl_install.py +0 -0
|
@@ -26,11 +26,11 @@ The five most recent updates, newest first. Each line links to its
|
|
|
26
26
|
commit, so you can see what changed lately without digging through the
|
|
27
27
|
log:
|
|
28
28
|
|
|
29
|
+
- **2026-11-16**: Zombie sessions are gone. Claude Code remembers the last conversation it opened per project (lastSessionId); a plain `claude` could reopen a conversation that died in a rotation and then run forever unmonitored (no ratio movement, no rotation, and the handoff chain silently broken). Now a resumed conversation whose session id is no longer alive is anchored onto the open chain tip under the same index, handed the bootstrap protocol, and taken over by the normal monitoring; live resumes behave exactly as before ([commit](https://github.com/pqant/claude-continuity/commit/dbaea33)).
|
|
30
|
+
- **2026-11-16**: The transcript fold arrows are anchored: both triangles now share one slot at the true screen center of the header (the previous version centered against the controls row, which spans only the left half of the header grid, so the arrow sat off-center over the theme button), they carry a red tint (a deeper red in light theme, a lighter red in dark theme), and folding keeps the reopen arrow in the very same spot so the button never jumps ([commit](https://github.com/pqant/claude-continuity/commit/1ca6ad5), [commit](https://github.com/pqant/claude-continuity/commit/e33874d)).
|
|
29
31
|
- **2026-11-16**: The transcript density view got its polish pass: the two panel toggles are plain filled triangles now (the up-triangle folds the header panel into the slim bar, the down-triangle brings it back, and the words live in the tooltips), the fold eases closed over 180 ms instead of snapping, and the folded bar only spans the left column when the 2-column mode is on, with the fold arrow sitting centered in the controls row in the theme's accent color. The "2-column · 75%" mode opens enabled by default now; unchecking it is still remembered in your browser ([commit](https://github.com/pqant/claude-continuity/commit/3959db9), [commit](https://github.com/pqant/claude-continuity/commit/7feba54)).
|
|
30
32
|
- **2026-11-15**: The transcript header panel gets out of the way: "panel up" folds it into a slim one-line bar carrying the session name, "panel down" brings the full panel back, and a new "2-column · 75%" checkbox in the controls row re-flows the whole conversation into two balanced columns at reduced zoom, so a screen holds roughly twice the conversation. Both choices persist in your browser; search, theme, sessions switcher and the image lightbox behave exactly the same in every state ([commit](https://github.com/pqant/claude-continuity/commit/594820d), [commit](https://github.com/pqant/claude-continuity/commit/2450369)).
|
|
31
33
|
- **2026-11-14**: The overlay's prev/next row now hides when there is nothing to navigate: it used to sit under the icon chip's note text and next to single-image galleries, because the row's author CSS rule overrode the [hidden] attribute. Both the CSS rule and a count-based toggle are in place now, so navigation appears only with two or more images and the i / n counter stays untouched ([commit](https://github.com/pqant/claude-continuity/commit/15ada27)).
|
|
32
|
-
- **2026-11-14**: The dark icon chip now speaks: clicking it opens a small note that says why the image is missing (removed from disk, over the 4 MB embed cap, or an unsupported format), never an image - the note branch clears any previous gallery selection and hides the image row while it is up. The chip stays the same dark pulsing icon, and numbered thumbnails still open at the clicked index ([commit](https://github.com/pqant/claude-continuity/commit/614ddf8)).
|
|
33
|
-
- **2026-11-14**: The dark icon chip (the trace a pruned image leaves behind) is finally static: clicking it no longer popped the lightbox open with a stale image from an earlier gallery on the page, because the click handler un-hid the overlay before it noticed the chip carries no gallery. The chip is now a plain span (no button semantics, no gallery data) and the lightbox handler bails out for gallery-less chips, while numbered thumbnails still open at the exact clicked index ([commit](https://github.com/pqant/claude-continuity/commit/a1cf55e)).
|
|
34
34
|
|
|
35
35
|
## How it works
|
|
36
36
|
|
|
@@ -304,7 +304,8 @@ REUSE_MIN_AGE_S = 60.0
|
|
|
304
304
|
|
|
305
305
|
|
|
306
306
|
def try_reuse_stalled(key: str, *, new_session_id: str, cfg: dict,
|
|
307
|
-
source: str = "startup"
|
|
307
|
+
source: str = "startup",
|
|
308
|
+
allow_same_sid: bool = False) -> dict | None:
|
|
308
309
|
"""Re-attach a fresh startup to a STALLED successor — same index.
|
|
309
310
|
|
|
310
311
|
The 2026-11-03 connector incident: the rotator's RESUME Enter was
|
|
@@ -318,6 +319,10 @@ def try_reuse_stalled(key: str, *, new_session_id: str, cfg: dict,
|
|
|
318
319
|
dead (statusline metric absent/stale — never reported / long silent). A
|
|
319
320
|
live successor (fresh metric) is left alone; a plain register follows.
|
|
320
321
|
|
|
322
|
+
``allow_same_sid`` (issue #42): CC's native auto-resume can bring back
|
|
323
|
+
the stalled successor's OWN dead sid; with the opt-in the sid-equality
|
|
324
|
+
refusal is lifted and the record is re-announced (sid unchanged).
|
|
325
|
+
|
|
321
326
|
On success the record keeps its nnn/name; only the sid changes (state +
|
|
322
327
|
project.json), one ``session_start`` ledger entry is appended, and the
|
|
323
328
|
predecessor's C.4 bootstrap text is rebuilt (idempotent re-delivery of
|
|
@@ -336,7 +341,8 @@ def try_reuse_stalled(key: str, *, new_session_id: str, cfg: dict,
|
|
|
336
341
|
rec = state.load_state(key, nnn)
|
|
337
342
|
if (rec is None or rec["state"] != "BOOTSTRAPPING"
|
|
338
343
|
or rec.get("successor")
|
|
339
|
-
or rec.get("session_id") == new_session_id
|
|
344
|
+
or (rec.get("session_id") == new_session_id
|
|
345
|
+
and not allow_same_sid)):
|
|
340
346
|
return None
|
|
341
347
|
try:
|
|
342
348
|
created = datetime.fromisoformat(rec["created"])
|
|
@@ -351,10 +357,12 @@ def try_reuse_stalled(key: str, *, new_session_id: str, cfg: dict,
|
|
|
351
357
|
if not pred_name or pred is None:
|
|
352
358
|
return None
|
|
353
359
|
old_nnn = int(pred["nnn"])
|
|
354
|
-
# Re-attach: same nnn/name, new sid everywhere.
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
360
|
+
# Re-attach: same nnn/name, new sid everywhere. A re-announce (issue
|
|
361
|
+
# #42, own sid) has nothing to move: same guards, C.4 rebuilt below.
|
|
362
|
+
if rec.get("session_id") != new_session_id:
|
|
363
|
+
state.update_fields_unlocked(key, nnn, session_id=new_session_id)
|
|
364
|
+
last["session_id"] = new_session_id
|
|
365
|
+
atomic.atomic_write_json(pfile, pref)
|
|
358
366
|
cp_dir = paths.session_dir(key, old_nnn) / "checkpoint"
|
|
359
367
|
root = Path(pref["root"])
|
|
360
368
|
status, details = validate.validate_checkpoint(cp_dir, cfg, root=root)
|
|
@@ -82,7 +82,17 @@ def handle(ctx: HookContext) -> dict | None:
|
|
|
82
82
|
# the field stays stale (dead pane) and every nudge/digest
|
|
83
83
|
# CAPTURE_FAILED while the session looks fine.
|
|
84
84
|
if ctx.session is not None:
|
|
85
|
-
#
|
|
85
|
+
# LIVE conversations: re-attach only (no registration, no state
|
|
86
|
+
# change, no output). Issue #42: when the resolved record's sid
|
|
87
|
+
# is DEAD (native auto-resume of a dead lastSessionId) the
|
|
88
|
+
# conversation instead anchors to the stalled chain tip and
|
|
89
|
+
# (re)receives the C.4 handoff.
|
|
90
|
+
revived = _revive_dead_anchor(ctx)
|
|
91
|
+
if revived is not None:
|
|
92
|
+
rkey, rnnn, text = revived
|
|
93
|
+
bootstrap.record_tmux_session(rkey, rnnn)
|
|
94
|
+
_spawn_watch(ctx, key=rkey, nnn=rnnn)
|
|
95
|
+
return session_start_output(text)
|
|
86
96
|
bootstrap.record_tmux_session(ctx.session["project_key"],
|
|
87
97
|
int(ctx.session["nnn"]))
|
|
88
98
|
_spawn_watch(ctx)
|
|
@@ -160,6 +170,47 @@ def handle(ctx: HookContext) -> dict | None:
|
|
|
160
170
|
return None
|
|
161
171
|
|
|
162
172
|
|
|
173
|
+
def _revive_dead_anchor(ctx: HookContext) -> "tuple[str, int, str] | None":
|
|
174
|
+
"""Issue #42: CC's native auto-resume can bring back a DEAD conversation
|
|
175
|
+
(dead lastSessionId after a rotation edge). Re-attaching such a
|
|
176
|
+
conversation to its dead record leaves it unmonitored forever; instead,
|
|
177
|
+
anchor it to the stalled BOOTSTRAPPING chain tip (the same-index reuse
|
|
178
|
+
guards of ``try_reuse_stalled``, including its age gate: a rotator-
|
|
179
|
+
driven young successor is never stolen, a fresh metric is left alone)
|
|
180
|
+
and (re)deliver C.4. Self-resume has no rotator to drive the successor
|
|
181
|
+
home, so the legal BOOTSTRAPPING -> ACTIVE edge hands it to the normal
|
|
182
|
+
monitoring. Returns ``(key, nnn, bootstrap_text)`` or None (= today's
|
|
183
|
+
re-attach behavior; every failure path fails open to None).
|
|
184
|
+
"""
|
|
185
|
+
try:
|
|
186
|
+
sid = ctx.payload.get("session_id")
|
|
187
|
+
if not isinstance(sid, str) or not sid:
|
|
188
|
+
return None
|
|
189
|
+
if not statusline.is_stale(statusline.read_metric(sid)):
|
|
190
|
+
return None # live conversation: ordinary re-attach
|
|
191
|
+
key = ctx.session["project_key"]
|
|
192
|
+
old_nnn = int(ctx.session["nnn"])
|
|
193
|
+
with lock.held(key):
|
|
194
|
+
res = bootstrap.try_reuse_stalled(
|
|
195
|
+
key, new_session_id=sid, cfg=ctx.cfg,
|
|
196
|
+
source="fork" if ctx.event == "fork" else "resume",
|
|
197
|
+
allow_same_sid=True)
|
|
198
|
+
if res is None:
|
|
199
|
+
return None
|
|
200
|
+
rnnn = int(res["new_nnn"])
|
|
201
|
+
if rnnn != old_nnn:
|
|
202
|
+
# The terminal record must not keep claiming the live sid
|
|
203
|
+
# (find_session_by_id would become ambiguous).
|
|
204
|
+
state.update_fields_unlocked(key, old_nnn, session_id=None)
|
|
205
|
+
try:
|
|
206
|
+
state.transition(key, rnnn, "ACTIVE")
|
|
207
|
+
except state.InvalidTransitionError:
|
|
208
|
+
pass
|
|
209
|
+
return key, rnnn, res["bootstrap_text"]
|
|
210
|
+
except Exception:
|
|
211
|
+
return None
|
|
212
|
+
|
|
213
|
+
|
|
163
214
|
def _clear(ctx: HookContext) -> dict | None:
|
|
164
215
|
"""PRD §9 SessionStart/clear: claim a rotation, else plain register.
|
|
165
216
|
|
|
@@ -313,7 +313,7 @@ header{position:sticky;top:0;background:var(--hdr);border-bottom:1px solid var(-
|
|
|
313
313
|
.hd{font-size:13px;color:var(--muted);display:grid;overflow:hidden;max-height:600px;transition:max-height .18s ease,opacity .18s ease;grid-template-columns:max-content 1fr max-content 1fr;gap:6px 14px;align-items:center}
|
|
314
314
|
.hd .k{font-weight:600;color:var(--fg)}
|
|
315
315
|
.hd .v{color:var(--fg);font-weight:600;padding-left:2px}
|
|
316
|
-
.row2{display:flex;gap:12px;align-items:center;margin-top:6px;grid-column:1/3;flex-wrap:wrap
|
|
316
|
+
.row2{display:flex;gap:12px;align-items:center;margin-top:6px;grid-column:1/3;flex-wrap:wrap}
|
|
317
317
|
.qbox{width:360px;max-width:100%;padding:7px 12px;border:1px solid var(--line);border-radius:8px;background:var(--bg);color:var(--fg);font-size:14px}
|
|
318
318
|
label{font-size:13px;color:var(--fg);font-weight:600;white-space:nowrap}
|
|
319
319
|
button{padding:6px 12px;border:1px solid var(--line);border-radius:8px;background:var(--bg);color:var(--fg);cursor:pointer;font-size:13px}
|
|
@@ -325,8 +325,9 @@ header .hdmini{display:none;align-items:center;gap:10px;font-size:13px}
|
|
|
325
325
|
header.mini .hd{max-height:0;opacity:0;overflow:hidden;pointer-events:none}
|
|
326
326
|
header.mini .hdmini{display:flex}
|
|
327
327
|
body.split header.mini .hdmini{width:calc(50% - 36px)}
|
|
328
|
-
#panelsbtn{position:absolute;left:50%;transform:translateX(-50%)}
|
|
329
|
-
#panelsbtn,#panelbtn{color
|
|
328
|
+
#panelsbtn,#panelbtn{position:absolute;left:50%;transform:translateX(-50%)}
|
|
329
|
+
#panelsbtn,#panelbtn{color:#d1242f}
|
|
330
|
+
[data-theme=dark] #panelsbtn,[data-theme=dark] #panelbtn{color:#ff7b72}
|
|
330
331
|
main.split{max-width:none;columns:2;column-gap:28px;zoom:.75}
|
|
331
332
|
main.split .block{break-inside:avoid}
|
|
332
333
|
main{max-width:1160px;margin:0 auto;padding:10px 28px 80px}
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cc-continuity"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.40"
|
|
8
8
|
description = "Zero-touch session rotation for Claude Code (local large-context model)"
|
|
9
9
|
requires-python = ">=3.11"
|
|
10
10
|
dependencies = [] # stdlib only at runtime (PRD §0.5)
|
|
@@ -396,3 +396,59 @@ def test_write_started_marker(cc_home):
|
|
|
396
396
|
p = bootstrap.write_started("sid-marker")
|
|
397
397
|
assert p == paths.runtime_dir() / "sid-marker.started"
|
|
398
398
|
assert p.is_file()
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
# --- issue #42: stalled-successor re-announce (same-sid auto-resume) -------
|
|
402
|
+
# CC native auto-resume can bring back the stalled successor's OWN dead sid;
|
|
403
|
+
# try_reuse_stalled refuses that (sid equality), so the hook opt-in
|
|
404
|
+
# (allow_same_sid=True) re-announces: same index, sid unchanged, C.4 again.
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
def _stalled_successor(repo, key, nnn):
|
|
408
|
+
"""001 -> ROTATING, claim into 002 BOOTSTRAPPING (sid 'sid-stuck')."""
|
|
409
|
+
state.transition(key, nnn, "ROTATING", rotation_id="r1")
|
|
410
|
+
cfg = config.load_config(cwd=repo)
|
|
411
|
+
with lock.held(key):
|
|
412
|
+
res = bootstrap.try_claim(key, new_session_id="sid-stuck", cfg=cfg,
|
|
413
|
+
source="startup")
|
|
414
|
+
assert res is not None
|
|
415
|
+
return res
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
def test_try_reuse_stalled_same_sid_refused_by_default(cc_home, tmp_path,
|
|
419
|
+
monkeypatch):
|
|
420
|
+
from hookutil import set_metric
|
|
421
|
+
monkeypatch.setattr(bootstrap, "REUSE_MIN_AGE_S", 0.0)
|
|
422
|
+
repo, key, nnn = _verified(cc_home, tmp_path)
|
|
423
|
+
_stalled_successor(repo, key, nnn)
|
|
424
|
+
set_metric(0.0, "sid-stuck", stale=True)
|
|
425
|
+
cfg = config.load_config(cwd=repo)
|
|
426
|
+
with lock.held(key):
|
|
427
|
+
assert bootstrap.try_reuse_stalled(key, new_session_id="sid-stuck",
|
|
428
|
+
cfg=cfg, source="startup") is None
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
def test_try_reuse_stalled_same_sid_optin_reannounces(cc_home, tmp_path,
|
|
432
|
+
monkeypatch):
|
|
433
|
+
from hookutil import set_metric
|
|
434
|
+
monkeypatch.setattr(bootstrap, "REUSE_MIN_AGE_S", 0.0)
|
|
435
|
+
repo, key, nnn = _verified(cc_home, tmp_path)
|
|
436
|
+
_stalled_successor(repo, key, nnn)
|
|
437
|
+
set_metric(0.0, "sid-stuck", stale=True)
|
|
438
|
+
cfg = config.load_config(cwd=repo)
|
|
439
|
+
with lock.held(key):
|
|
440
|
+
res = bootstrap.try_reuse_stalled(key, new_session_id="sid-stuck",
|
|
441
|
+
cfg=cfg, source="resume",
|
|
442
|
+
allow_same_sid=True)
|
|
443
|
+
assert res is not None and res["reused"]
|
|
444
|
+
assert res["new_name"] == "spike-repo-002"
|
|
445
|
+
rec2 = state.load_state(key, 2)
|
|
446
|
+
assert rec2["session_id"] == "sid-stuck" # unchanged (own sid)
|
|
447
|
+
assert rec2["state"] == "BOOTSTRAPPING" # hook advances ACTIVE
|
|
448
|
+
assert "CONTINUITY BOOTSTRAP" in res["bootstrap_text"]
|
|
449
|
+
pref = json.loads((paths.project_dir(key) / "project.json")
|
|
450
|
+
.read_text(encoding="utf-8"))
|
|
451
|
+
assert pref["counter"] == 2 # no index minted
|
|
452
|
+
starts = [e for e in ledger.read(paths.session_dir(key, 2))
|
|
453
|
+
if e["type"] == "session_start"]
|
|
454
|
+
assert starts[-1]["reused"] and starts[-1]["source"] == "resume"
|
|
@@ -782,6 +782,148 @@ def test_restart_does_not_reuse_fresh_bootstrap(cc_home, capsys, tmp_path):
|
|
|
782
782
|
assert _project_record(repo)["counter"] == 3
|
|
783
783
|
|
|
784
784
|
|
|
785
|
+
# --- issue #42: dead-sid auto-resume must revive the stalled successor ----
|
|
786
|
+
# plain `claude` (CC native auto-resume on lastSessionId) can bring back a
|
|
787
|
+
# DEAD conversation after a rotation edge: the rotated-away one (zombie A) or
|
|
788
|
+
# the stalled successor itself (zombie B, the a1b1e9bf shape). The resume/
|
|
789
|
+
# fork branch must not silently re-attach onto a dead record; it routes
|
|
790
|
+
# through the stalled-successor machinery (same index, C.4, monitoring
|
|
791
|
+
# takeover). Live records keep today's re-attach behavior byte-identical.
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
def test_resume_dead_old_sid_revives_stalled_successor(cc_home, capsys,
|
|
795
|
+
tmp_path, monkeypatch):
|
|
796
|
+
# Zombie A: lastSessionId == the rotated-away conversation while the
|
|
797
|
+
# project carries a stalled BOOTSTRAPPING successor. The live
|
|
798
|
+
# conversation anchors to the chain tip (same index, no bump), gets the
|
|
799
|
+
# C.4 handoff, and leaves no duplicate sid behind.
|
|
800
|
+
from cc_continuity import bootstrap
|
|
801
|
+
monkeypatch.setattr(bootstrap, "REUSE_MIN_AGE_S", 0.0)
|
|
802
|
+
repo = make_repo(tmp_path)
|
|
803
|
+
key, nnn = _verified_session(repo)
|
|
804
|
+
old_sid = state.load_state(key, nnn)["session_id"]
|
|
805
|
+
_stuck_successor(repo, key, nnn)
|
|
806
|
+
set_metric(0.0, "sid-stuck", stale=True)
|
|
807
|
+
capsys.readouterr()
|
|
808
|
+
assert run_hook("SessionStart", payload("SessionStart", repo,
|
|
809
|
+
session_id=old_sid,
|
|
810
|
+
source="resume")) == 0
|
|
811
|
+
out = _stdout_json(capsys)
|
|
812
|
+
ctx = out["hookSpecificOutput"]["additionalContext"]
|
|
813
|
+
assert ctx.startswith("CONTINUITY BOOTSTRAP: you are spike-repo-002, "
|
|
814
|
+
"continuing spike-repo-001. VALIDATION: OK")
|
|
815
|
+
pref = _project_record(repo)
|
|
816
|
+
assert pref["counter"] == 2 # NO index minted
|
|
817
|
+
rec2 = state.load_state(key, 2)
|
|
818
|
+
assert rec2["session_id"] == old_sid # anchored to the tip
|
|
819
|
+
assert rec2["state"] == "ACTIVE" # monitoring takes over
|
|
820
|
+
assert state.load_state(key, 1)["state"] == "ROTATED"
|
|
821
|
+
assert state.load_state(key, 1)["session_id"] is None # no duplicate sid
|
|
822
|
+
starts = [e for e in ledger.read(paths.session_dir(key, 2))
|
|
823
|
+
if e["type"] == "session_start"]
|
|
824
|
+
assert starts[-1]["reused"] and starts[-1]["source"] == "resume"
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
def test_resume_dead_successor_own_sid_redelivers_c4(cc_home, capsys,
|
|
828
|
+
tmp_path, monkeypatch):
|
|
829
|
+
# Zombie B (a1b1e9bf): the stalled successor's OWN dead sid is
|
|
830
|
+
# auto-resumed. Same index, sid unchanged, C.4 (re)delivered, ACTIVE.
|
|
831
|
+
from cc_continuity import bootstrap
|
|
832
|
+
monkeypatch.setattr(bootstrap, "REUSE_MIN_AGE_S", 0.0)
|
|
833
|
+
repo = make_repo(tmp_path)
|
|
834
|
+
key, nnn = _verified_session(repo)
|
|
835
|
+
_stuck_successor(repo, key, nnn)
|
|
836
|
+
set_metric(0.0, "sid-stuck", stale=True)
|
|
837
|
+
capsys.readouterr()
|
|
838
|
+
assert run_hook("SessionStart", payload("SessionStart", repo,
|
|
839
|
+
session_id="sid-stuck",
|
|
840
|
+
source="resume")) == 0
|
|
841
|
+
out = _stdout_json(capsys)
|
|
842
|
+
assert "VALIDATION: OK" in out["hookSpecificOutput"]["additionalContext"]
|
|
843
|
+
pref = _project_record(repo)
|
|
844
|
+
assert pref["counter"] == 2 # no re-registration
|
|
845
|
+
rec2 = state.load_state(key, 2)
|
|
846
|
+
assert rec2["session_id"] == "sid-stuck" # same sid re-announced
|
|
847
|
+
assert rec2["state"] == "ACTIVE"
|
|
848
|
+
starts = [e for e in ledger.read(paths.session_dir(key, 2))
|
|
849
|
+
if e["type"] == "session_start"]
|
|
850
|
+
assert starts[-1]["reused"]
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
def test_fork_dead_successor_own_sid_redelivers_c4(cc_home, capsys,
|
|
854
|
+
tmp_path, monkeypatch):
|
|
855
|
+
# Same contract for source=fork (CC forks share the dead-sid exposure).
|
|
856
|
+
from cc_continuity import bootstrap
|
|
857
|
+
monkeypatch.setattr(bootstrap, "REUSE_MIN_AGE_S", 0.0)
|
|
858
|
+
repo = make_repo(tmp_path)
|
|
859
|
+
key, nnn = _verified_session(repo)
|
|
860
|
+
_stuck_successor(repo, key, nnn)
|
|
861
|
+
set_metric(0.0, "sid-stuck", stale=True)
|
|
862
|
+
capsys.readouterr()
|
|
863
|
+
assert run_hook("SessionStart", payload("SessionStart", repo,
|
|
864
|
+
session_id="sid-stuck",
|
|
865
|
+
source="fork")) == 0
|
|
866
|
+
out = _stdout_json(capsys)
|
|
867
|
+
assert "VALIDATION: OK" in out["hookSpecificOutput"]["additionalContext"]
|
|
868
|
+
assert state.load_state(key, 2)["state"] == "ACTIVE"
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
def test_resume_live_successor_not_revived(cc_home, capsys, tmp_path,
|
|
872
|
+
monkeypatch):
|
|
873
|
+
# Guard (regression vector 1): a LIVE successor (fresh metric) resumed
|
|
874
|
+
# by its own sid keeps today's silent re-attach: no C.4 re-delivery, no
|
|
875
|
+
# state change, no extra session_start entry.
|
|
876
|
+
from cc_continuity import bootstrap
|
|
877
|
+
monkeypatch.setattr(bootstrap, "REUSE_MIN_AGE_S", 0.0)
|
|
878
|
+
repo = make_repo(tmp_path)
|
|
879
|
+
key, nnn = _verified_session(repo)
|
|
880
|
+
_stuck_successor(repo, key, nnn)
|
|
881
|
+
set_metric(0.0, "sid-stuck", stale=False) # rotator-driven, alive
|
|
882
|
+
capsys.readouterr()
|
|
883
|
+
assert run_hook("SessionStart", payload("SessionStart", repo,
|
|
884
|
+
session_id="sid-stuck",
|
|
885
|
+
source="resume")) == 0
|
|
886
|
+
assert _stdout_json(capsys) is None
|
|
887
|
+
rec2 = state.load_state(key, 2)
|
|
888
|
+
assert rec2["state"] == "BOOTSTRAPPING"
|
|
889
|
+
starts = [e for e in ledger.read(paths.session_dir(key, 2))
|
|
890
|
+
if e["type"] == "session_start"]
|
|
891
|
+
assert len(starts) == 1 # only the claim entry
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+
def test_resume_young_stalled_successor_left_alone(cc_home, capsys, tmp_path):
|
|
895
|
+
# Guard (regression vector 3): a just-spawned BOOTSTRAPPING successor
|
|
896
|
+
# (production REUSE_MIN_AGE_S) may be mid-rotation; a dead-sid resume
|
|
897
|
+
# must not steal it.
|
|
898
|
+
repo = make_repo(tmp_path)
|
|
899
|
+
key, nnn = _verified_session(repo)
|
|
900
|
+
_stuck_successor(repo, key, nnn)
|
|
901
|
+
set_metric(0.0, "sid-stuck", stale=True)
|
|
902
|
+
capsys.readouterr()
|
|
903
|
+
assert run_hook("SessionStart", payload("SessionStart", repo,
|
|
904
|
+
session_id="sid-stuck",
|
|
905
|
+
source="resume")) == 0
|
|
906
|
+
assert _stdout_json(capsys) is None
|
|
907
|
+
assert state.load_state(key, 2)["state"] == "BOOTSTRAPPING"
|
|
908
|
+
|
|
909
|
+
|
|
910
|
+
def test_resume_terminal_without_successor_stays_reattach(cc_home, capsys,
|
|
911
|
+
tmp_path):
|
|
912
|
+
# Documented residual: a terminal record with no stalled successor
|
|
913
|
+
# (admin close_dead shape, not a rotation) keeps today's re-attach-only
|
|
914
|
+
# behavior; no registration, no index minted.
|
|
915
|
+
repo = make_repo(tmp_path)
|
|
916
|
+
key, nnn = register_session(repo)
|
|
917
|
+
state.close_dead(key, nnn, "test")
|
|
918
|
+
capsys.readouterr()
|
|
919
|
+
assert run_hook("SessionStart", payload("SessionStart", repo,
|
|
920
|
+
session_id=SID,
|
|
921
|
+
source="resume")) == 0
|
|
922
|
+
assert _stdout_json(capsys) is None
|
|
923
|
+
assert _project_record(repo)["counter"] == 1
|
|
924
|
+
assert state.load_state(key, nnn)["state"] == "ROTATED"
|
|
925
|
+
|
|
926
|
+
|
|
785
927
|
# ---------- blink_watch spawn wiring (live bug 2026-11-07)
|
|
786
928
|
|
|
787
929
|
|
|
@@ -748,9 +748,10 @@ def test_density_collapsible_header():
|
|
|
748
748
|
assert "transition:max-height .18s ease,opacity .18s ease" in d
|
|
749
749
|
assert "header.mini .hdmini{display:flex}" in d
|
|
750
750
|
assert "body.split header.mini .hdmini{width:calc(50% - 36px)}" in d
|
|
751
|
-
assert "flex-wrap:wrap
|
|
752
|
-
assert "#panelsbtn{position:absolute;left:50%;transform:translateX(-50%)}" in d
|
|
753
|
-
assert "#panelsbtn,#panelbtn{color
|
|
751
|
+
assert ".row2{display:flex;gap:12px;align-items:center;margin-top:6px;grid-column:1/3;flex-wrap:wrap}" in d
|
|
752
|
+
assert "#panelsbtn,#panelbtn{position:absolute;left:50%;transform:translateX(-50%)}" in d
|
|
753
|
+
assert "#panelsbtn,#panelbtn{color:#d1242f}" in d
|
|
754
|
+
assert "[data-theme=dark] #panelsbtn,[data-theme=dark] #panelbtn{color:#ff7b72}" in d
|
|
754
755
|
|
|
755
756
|
|
|
756
757
|
def test_density_split_checkbox_and_css():
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|