Repository navigation
feat(panorama): Repair button installs link hooks from the page; closing a channel uninstalls its own hooks - #84
Merged
Merged
Conversation
- pet/panorama/actions.py:页面动作的处理器;repair_hooks 只认两条 hooked 通道,调管理器 「已同意、装」那一半,本机装完重探 Windows 一侧,WSL 后台装、install_finished 到了再重探 - service:actions 登记表、run_action(界面线程)、refresh(side) 只重探一侧不开浏览器 - routes:POST /api/actions/<名字>;model.quest 带 action;sources 给缺 hooks 的待处理项挂动作 - 页面:repair.js(confirm → api.post → 结果写在按钮上)、interact.js 待处理与磁贴详情出按钮、 boot.js 的 api.post - AgentLinkManager:set_enabled 拆成「问」和 install_hooks_consented「装」;apply_config 停 hooked 通道时卸自己的 hooks(_uninstall_hooks,别的实例还在用就留着) - app:构造 PanoramaService 时登记 repair_hooks - ADR 0006 补记;docs/config-panorama「动作」一节;session-fish;路线图 M4 第六项打勾;CHANGELOG Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
真机点「修复」后 settings.json 与快照都在同一秒改写、hooks 回来了,但日志里一行没有——排障时找不到这次动作的痕迹。 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
3 tasks
LiminCode
added a commit
that referenced
this pull request
Nov 20, 2026
…许碰开发机真实文件 (#91) 2026-11-20 凌晨跑 test_background_service_gates / test_harness_ownership 把本机 ~/.claude/settings.json 里肥鱼的 hooks 清掉了 (#84 起关联动会卸 hooks)。在既有的 autouse 总夹具里把 ClaudeCodeMonitor.get_settings_path 指到 tmp_path,不另加夹具; 加一个回归测试:真管理器把 claude 关掉,真实文件的 mtime 不变。 Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
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.
Summary
The config panorama's pending list now carries a Repair button on the "link is on but that side's
settings.jsonhas no fish hooks" item (and on thesettings.jsontile detail). One confirm installs the hooks; the broken edge on the graph turns back into a flowing one right away (Windows side) or after the WSL install finishes. Turning a hooked channel off from the page or the settings process now also uninstalls the fish's own hooks, same as closing it from the right-click menu. Roadmap M4 "Claude Code 联动与 hooks 修复动作" is ticked. Consent discipline (ADR 0006) is unchanged: toggling a channel never writes hooks; the write happens only after the user clicks Repair and confirms.What changed and why
pet/panorama/actions.py(new): page-action handlers.repair_hooks(manager_of, refresh)returns ahandler(body) -> dict; it accepts only the two hooked agents (claude→win,claude_wsl→wsl, otherwiseActionError(400, "bad_agent")), 503no_managerwithout a manager, callsAgentLinkManager.install_hooks_consented(agent), re-probes the Windows side oninstalled, and forpendingconnectsinstall_finishedonce per manager (WeakSet) to re-probe the WSL side when it lands.pet/panorama/service.py:actions=ctor kwarg;run_action(GUI thread viaon_gui, 404unknown_action, 500action_failed);refresh(side)re-probes one side in a worker thread without opening the browser (winreruns the Windows probes and carries over the last WSL facts andtiming.wsl_s;wslswaps only that half), skips publishing if a full collection started meanwhile; info log lines for action completion and refresh completion.pet/panorama/routes.py:POST /api/actions/{name}(token-guarded like settings),ActionError→ error response,Busy→ 503.pet/panorama/model.py:Graph.quest(..., action=None);pet/panorama/sources.py: bothquest.link_no_hooksquests carryaction={"name":"repair_hooks","agent":…,"side":…}.pet/panorama/page/repair.js(new):actionButtonandrunAction—confirm()with the same consent text as the Qt dialog, cancel sends nothing, thenapi.post, result written onto the button (installed/pending/failedre-enabled / connection lost re-enabled).interact.js: quests and the tile detail render the button, click handler checks[data-action]first.boot.js:send(method)factory,api.post.app.css:.btn.mini.render.py: module order (repair.jsbeforeinteract.js) and the newPAGE_KEYS.pet/agent_link.py:set_enabledsplit into "ask" (unchanged Qt dialog) andinstall_hooks_consented(agent_key) -> "installed"|"pending"|"failed"("install", the only place hooks are written);_uninstall_hooks(agent_key)extracted;apply_configuninstalls the fish's own hooks when a hooked channel goes running→stopped (kept if another instance still uses them); log lines for hook write success/failure.pet/app.py: registersrepair_hookswhen constructingPanoramaService.pet/locale/zh.json,en.json:panorama.ui.repair*,action_needs_service;agent_link.hooks_missingnow mentions the panorama repair.docs/config-panorama.mdnew "动作:待处理里的「修复」" section with sequence diagram and updated apply chain;docs/session-fish.mdhooks section;docs/adr/0006-writing-hooks-needs-consent.mdaddendum;docs/roadmap.mdM4 item ticked;CHANGELOG.md11-19 line.tests/test_panorama_actions.py(new, 5),test_panorama_settings_routes.py(+2),test_panorama_service.py(+2 refresh),test_panorama_sources.py(+1),test_panorama_page.py(+4, QJSEngine harness for repair.js),test_claude_hooks_missing.py(+4 manager split / transition uninstall),test_panorama_entry.py(fake service acceptsactions=).set_enabled(ask → same install);_republishstill only re-reads features.Performance
Measured with
PYTHONPATH=. QT_QPA_PLATFORM=offscreen python perf_b.py(Windows 11, this machine, venv Python, fake home dir for the install loop, real home for the probe):repair_hooks(claude)handler, 50 runs, writessettings.jsoneach timeprobes.windows_side(the body ofrefresh("win"), real home)repair.js/ full bundleactionfield is the only addition to the payload, and only while hooks are missing.settings.jsonread+write on the GUI thread (~2 ms); the re-probe is the existing Windows probe set on a worker thread (no browser launch); the WSL path is the existingwsl.exeinstall worker plus one WSL probe on the signal.refresh(side)(same_spawnas the full collection); no new network or polling.WeakSetof managers whose signal is connected (at most one entry).Real-machine run
ClaudeCodeMonitor.uninstall_hooks()removed the fish's own entries from~/.claude/settings.json;missing_hooks()listed all 9 events.WARNING Claude Code 联动开着,但 settings.json 里缺肥鱼的 hooks(9 个事件)…andINFO Claude Code (WSL) 联动:hooks 都在.~/.claude/settings.jsonrewritten,missing_hook_events(settings) == [],ClaudeCodeMonitor.missing_hooks() == []; the offline snapshot%APPDATA%\big-fat-fish\panorama\panorama.htmlrewritten and no longer contains the no-hooks quest or anyrepair_hooksaction (re-probe + publish ran). No ERROR / Traceback inpet-43796.log.Tests
Red-first: the new tests failed before the product change (ImportError for
pet.panorama.actions, missing route, missinginstall_hooks_consented). Then the affected families (panorama, agent link / hooks, architecture, PR discipline, i18n, context menus): 1021 passed, 3 failures are the known baselines (compact_semantic_groups,three_column_masonry,compact_ai_provider_controls). After the logging commit:tests/test_panorama_service.py tests/test_panorama_actions.py tests/test_panorama_settings_routes.py tests/test_claude_hooks_missing.py→ 79 passed.ruff checkandgit diff --checkclean. The full suite was not run: no config schema / migration, no packaging or platform-dispatch change; the lifecycle change is confined toAgentLinkManager.apply_configand is covered bytest_claude_hooks_missing.py.Docs
config-panorama.md,session-fish.md, roadmap tick)🤖 Generated with Claude Code