fix(dashboard): add missing gather_status_payload (status endpoint 500) - #12
Open
allenter wants to merge 3 commits into
Open
fix(dashboard): add missing gather_status_payload (status endpoint 500)#12allenter wants to merge 3 commits into
allenter wants to merge 3 commits into
Conversation
Layer a zero-dependency, pure-Python vector memory store (memories/vault/) on top of the existing single-file consensus baton: - scripts/core/memory_vault.py: chunk consensus + docs, index into memories/vault/index.json (TF-IDF char n-grams + cosine similarity, no external deps), and semantic search with -top-k / min-score. Backend swappable: replace _embed_chunk() to plug in ChromaDB or a model embedding. - auto-loop.sh: each cycle auto-retrieves the top relevant historical blocks (keyed off Next Action) and injects them into the prompt as '## Highly-relevant past memory'; after a successful/soft-timeout cycle it indexes the latest consensus + docs into the vault. - .gitignore: ignore memories/vault/* runtime data. - Docs updated: README(EN/ZH), CLAUDE.md, PROMPT.md, INDEX.md. consensus.md remains the authoritative running-state baton; the vault adds long-term recall of decisions/context that consensus collapses.
Add a Memory Vault panel to the control deck: - server.py: new GET /api/vault endpoint. Reads memories/vault/index.json directly (no subprocess) and returns stats (chunk/source/term counts, size, last-indexed), per-source breakdown, latest entries, plus optional in-process cosine semantic search via ?q=. - app.js: fetchVault() renderer with stat cards, a canvas bar chart of chunks per source, latest-entry list, and a live semantic-search box (Enter or button) showing scored hits with source tags. - index.html: Memory Vault section between Consensus and Recent Log. - styles.css: dark-theme styles for stats, canvas, entries, tags. Pure stdlib on the server side; canvas drawn client-side.
The dashboard page loads but /api/status returns an empty reply and the status panel is unusable on every platform: do_GET calls gather_status_payload(), which is never defined anywhere in dashboard/server.py, so the request dies with `NameError: name 'gather_status_payload' is not defined`. Implement it by composing the already-existing helpers (run_status_command / parse_status_output / read_state_file_pairs / read_text_file / read_tail), matching the shape app.js consumes (parsed / stateFile / consensusHead / logTail / raw / ok / timestamp), and keeping the codebase's defensive try/except style. Verified: curl /api/status returns the full status JSON; frontend cards/consensus/log panels render; a failing status command returns ok:false instead of 500. Co-Authored-By: Claude <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.
PR: fix(dashboard): 补全缺失的 gather_status_payload,修复状态接口 500
问题描述
看板页面能加载(HTML/JS/CSS 正常),但
/api/status返回空响应(HTTP 连接被重置),状态卡片、共识预览、日志面板全部不可用。复现步骤
python3 dashboard/server.pycurl -v http://127.0.0.1:8787/api/statusEmpty reply from server,服务端日志报:根因
DashboardHandler.do_GET中/api/status路由调用了gather_status_payload(),但整个文件中从未定义该函数(疑似重构时遗漏)。Python 解释器在请求时抛NameError,连接被异常中断。同文件已有的相关函数:
run_status_command()、parse_status_output()、read_state_file_pairs()、read_text_file()、read_tail()都已存在且可复用——只缺把它们串起来的gather_status_payload()。修复
在
parse_status_output与gather_vault_payload之间补全该函数,完全复用现有工具函数,并保持代码库的防御式风格:返回结构对齐
dashboard/app.js的消费方:parsed/stateFile/consensusHead/logTail/raw/ok/timestamp。验证
curl http://127.0.0.1:8787/api/status返回完整 JSON(loop/daemon/guardian/autostart 状态、共识预览、日志尾部)ok: false而非 500变更文件
dashboard/server.py(+33 行)测试建议
python3 -c "import dashboard.server"无 NameErrorcurl /api/status | python3 -m json.tool校验结构Co-Authored-By: Claude noreply@anthropic.com