docs: integrate Bash tool bridge fix

This commit is contained in:
inman
2026-09-02 12:11:04 +08:00
parent 55bf80e88e
commit 774beee508
5 changed files with 88 additions and 86 deletions

View File

@@ -4,6 +4,15 @@ This file is the integrated default-branch snapshot. Feature tasks record progre
## Integrated Through
- Bash tool-bridge source `49112b6` from task
`20260902-fix-bash-tool-bridge-9c4e7a12` is integrated through merge
`55bf80e` by task `20260902-integrate-bash-tool-bridge-e81a5c6d`.
Pi's prepare-all behavior can no longer deadlock two tools against Makelore's
same-project write lease before either tool starts: built-in `bash`, `edit`,
and `write`, plus dynamically declared product tools that acquire that lease,
execute sequentially within an assistant tool batch. Read-only batches retain
parallel execution, and Bash command timeout remains authoritative once its
child process starts.
- Coding terminal-settlement source `f1fd13a` from task
`20260901-fix-session-settlement-a47d2e91` is integrated through merge
`e76a1e1` by task `20260902-integrate-session-settlement-6e41c8b2`.
@@ -243,7 +252,7 @@ Makelore 在会话恢复、登录和刷新后由 Electron Main 请求 Works `/ap
AI 学习现在是已启用的运营精选项目目录,并继续受登录和 `module_access.learning` 控制。Renderer 通过 Main-owned Host API 获取分页项目卡片和 README 详情;Markdown 支持 GFM、禁用原始 HTML。服务端发布时只校验图片 URL 为无凭据、默认端口、无 fragment 且当前 DNS 结果全部为公网地址的 HTTPS URL,保留地址而不下载、识别格式、转码或镜像;客户端仅为 README 图片节点启用直连,因此 SVG 和 Electron 支持的其他格式可直接显示,单图失败不阻断详情。封面和历史发布媒体继续走受控路径。详情页的下载按钮打开系统保存对话框;Main 将 ZIP 流式写入临时文件,只允许最多五跳同 Works origin 重定向,不校验 `Content-Length`、`archiveBytes`、实际流字节数或客户端大小上限,校验 SHA-256 和 ZIP 签名后原子保存,Renderer 只接收 `saved` 或 `cancelled`。课程生成、进度、本地课程库、OpenMAIC player、Agent、ASR、课堂 runtime、Learning IPC 和 player artifact 打包已删除且没有兼容读取路径;历史课程数据保留但不再读取。服务端和客户端源码契约已完成,不代表生产部署或真实账号安装包联调已经完成。
AI 编程已经硬切到精确 pin 的 Pi `0.84.2`,不存在 OpenCode fallback 或双 runtime。project、Agent 与 Conversation 只在 `.makelore/project.json` 和 `.makelore/conversations.json` 使用本地 schema v2;当前客户端不从 `.niancode` 或 `.opencode` 读取、迁移或删除项目元数据。Electron Main 按需启动一个长驻父 Agent Server,每条 active/warm Conversation 在其中拥有独立 Runtime/Session/channel、credential store、extension context、generation/seq、Snapshot/Patch、model/thinking、队列、interaction 与错误状态,Composer 在 lazy prepare 期间仍可编辑。Renderer 只通过 `/api/coding/*` 和 Snapshot-first/`patch-batch` SSE 消费产品中立合同;gap/reconnect 只恢复目标 Conversation,accepted/uncertain mutation 不自动重放。Session hydration 沿完整 active branch 投影可见历史,Pi compaction 只改变模型上下文并保持 summary 私有;Renderer 首次挂载最近 120 个节点,向上滚动时按 100 个节点追加更早内容并补偿新增高度以保持阅读锚点。折叠的 thinking、助手过程说明与工具输出固定展示第一条可见内容和首个非空行,横向偏移保持为零,展开后仍显示完整内容。未解析 Conversation 第一次选模先 validate 并持久化 resolved metadata,再 prepare;同账号模型切换使用 target `set_model`,跨账号只重建目标逻辑线程。top-level 逻辑 turn 并发为 4,warm idle logical-thread LRU 为 8;independent child 进程并发为 4 并使用 FIFO 进程预算 8;coding child 与 parent 共用项目 write lease。prompt/compact confirmation timeout 后仍保留 run/Agent-Server-or-child-process/background ownership,迟到 success/failure/exit/abort 单调且 exactly-once 收敛,页面隐藏不会停止 active/uncertain run。线程级替换只使目标 generation 失效;整个 Agent Server 退出会统一使所有旧 channel 失效,但 Main/Renderer 存活且下次恢复只重启一个 Server。Pi `0.84.2` 手动 compact 不发 `agent_settled`,由 correlated compact RPC 结果终结。父 Provider credential 只进入选中逻辑线程的内存 credential store,child 凭据只进入该短命进程;确定性的 Works user-context 缺失会失效 gateway credential、fail fast、不重放并投影固定 Provider-auth 错误,不归类为 Pi crash。精确的 `403 token_point_balance_exhausted` / `词元点数余额不足` 上游响应会在 Main 内归类为不可重试的配额耗尽,Renderer 只收到稳定 `CODING_PROVIDER_QUOTA_EXHAUSTED` 与安全中文提示;重开会话仍保留该提示,不暴露上游 request id 或原始错误正文。真实 Provider 验证仍为用户明确接受的未验证风险,macOS x64/arm64 与 native non-WSL Linux 也未通过平台发布门禁。
AI 编程已经硬切到精确 pin 的 Pi `0.84.2`,不存在 OpenCode fallback 或双 runtime。project、Agent 与 Conversation 只在 `.makelore/project.json` 和 `.makelore/conversations.json` 使用本地 schema v2;当前客户端不从 `.niancode` 或 `.opencode` 读取、迁移或删除项目元数据。Electron Main 按需启动一个长驻父 Agent Server,每条 active/warm Conversation 在其中拥有独立 Runtime/Session/channel、credential store、extension context、generation/seq、Snapshot/Patch、model/thinking、队列、interaction 与错误状态,Composer 在 lazy prepare 期间仍可编辑。Renderer 只通过 `/api/coding/*` 和 Snapshot-first/`patch-batch` SSE 消费产品中立合同;gap/reconnect 只恢复目标 Conversation,accepted/uncertain mutation 不自动重放。Session hydration 沿完整 active branch 投影可见历史,Pi compaction 只改变模型上下文并保持 summary 私有;Renderer 首次挂载最近 120 个节点,向上滚动时按 100 个节点追加更早内容并补偿新增高度以保持阅读锚点。折叠的 thinking、助手过程说明与工具输出固定展示第一条可见内容和首个非空行,横向偏移保持为零,展开后仍显示完整内容。未解析 Conversation 第一次选模先 validate 并持久化 resolved metadata,再 prepare;同账号模型切换使用 target `set_model`,跨账号只重建目标逻辑线程。top-level 逻辑 turn 并发为 4,warm idle logical-thread LRU 为 8;independent child 进程并发为 4 并使用 FIFO 进程预算 8;coding child 与 parent 共用项目 write lease。同一助手工具批次内,内置 `bash`/`edit`/`write` 与声明需要该 write lease 的动态产品工具按顺序执行,避免 Pi 在批量 prepare 阶段形成租约自锁;纯只读工具批次仍可并行。prompt/compact confirmation timeout 后仍保留 run/Agent-Server-or-child-process/background ownership,迟到 success/failure/exit/abort 单调且 exactly-once 收敛,页面隐藏不会停止 active/uncertain run。线程级替换只使目标 generation 失效;整个 Agent Server 退出会统一使所有旧 channel 失效,但 Main/Renderer 存活且下次恢复只重启一个 Server。Pi `0.84.2` 手动 compact 不发 `agent_settled`,由 correlated compact RPC 结果终结。父 Provider credential 只进入选中逻辑线程的内存 credential store,child 凭据只进入该短命进程;确定性的 Works user-context 缺失会失效 gateway credential、fail fast、不重放并投影固定 Provider-auth 错误,不归类为 Pi crash。精确的 `403 token_point_balance_exhausted` / `词元点数余额不足` 上游响应会在 Main 内归类为不可重试的配额耗尽,Renderer 只收到稳定 `CODING_PROVIDER_QUOTA_EXHAUSTED` 与安全中文提示;重开会话仍保留该提示,不暴露上游 request id 或原始错误正文。真实 Provider 验证仍为用户明确接受的未验证风险,macOS x64/arm64 与 native non-WSL Linux 也未通过平台发布门禁。
Updater 仍由 Electron Main 选择目标 feed、记录原始诊断并保持失败语义。正式稳定源缺少对应平台 manifest 时,设置页只显示一条简洁中文提示并允许重试,不把缺包误报为已是最新版,也不向普通界面暴露堆栈、URL、路径或错误码;签名产物发布和真实升级安装仍属于外部 Release Gate。
@@ -251,6 +260,12 @@ Robot 绑定设备默认先显示“引导配网 / 已有激活码”路径选
## Recently Completed
- 2026-09-02: Integrated the Pi write-leased tool-batch correction. Multiple
Bash/edit/write or lease-requiring product tools emitted by one assistant
response now execute sequentially instead of waiting on a lease before any
command can start; read-only batches remain parallel. A real Agent Server
regression covers two Bash calls, a command-level timeout, and rejection of
the former HTTP-idle-timeout `fetch failed` path.
- 2026-09-02: Integrated bounded recovery for a missing Pi prompt settlement.
A final persisted assistant response can no longer leave the Composer permanently
processing merely because `agent_settled` was lost: Main waits for the normal

View File

@@ -1,84 +0,0 @@
# Task: Fix Bash tool execution bridge
## Identity
- Task ID: 20260902-fix-bash-tool-bridge-9c4e7a12
- Mode: Feature
- Branch: codex/20260902-fix-bash-tool-bridge-9c4e7a12-fix-bash-tool-bridge
- Worktree: /Users/inmanx/Documents/makelore-fix-bash-tool-bridge-9c4e7a12
- Base commit: 6073bd6f4ce269b067b13e1eed0371b38dc2c054
- Owner: codex
- Status: Completed
## Scope
- Reproduce and fix the Makelore-managed Pi tool-batch deadlock that delays
parallel Bash calls until the five-minute HTTP idle timeout.
- Preserve project-scoped write-lease isolation while making Bash/edit/write
tools execute sequentially inside one assistant tool batch.
- Add real Agent Server coverage for two Bash calls, including a command-level
timeout, and verify the same resource path used by packaged builds.
## Intent And Constraints
- Keep Pi `0.84.2` as the sole runtime and keep Renderer isolated from Pi wire.
- Do not replay an accepted mutation or weaken the cross-Conversation/project
write lease; only remove the same-batch pre-execution self-deadlock.
- Retain parallel execution for batches containing only read-only tools where
Pi supports it.
- Treat packaging as a verification path, not as a substitute for the source
correction.
## Outcome
- Reproduced the stall with the real Pi Agent Server process. Pi `0.84.2`
prepares every tool in a parallel batch before it executes any of them, while
Makelore acquires the project write lease in `tool_call` and releases it in
`tool_result`. Two Bash calls in one assistant response therefore self-deadlocked:
the first held the lease without starting and the second waited for that lease.
- Confirmed that the apparent five-minute Bash hang came from the Agent Server
HTTP idle timeout around the managed-extension request, not from a missing
shell dependency or the Bash command timeout. Packaging alone would retain the
same behavior because it ships this Agent Server resource and extension bundle.
- Marked built-in `bash`, `edit`, and `write` tools as sequential whenever an
Agent thread is rebound. Marked dynamically declared product tools that require
the same project write lease as sequential in the generated Makelore extension.
Read-only tool batches keep Pi's parallel behavior.
- Advanced the managed extension artifact from v4 to v5 and synchronized the
release proof and worker-opening expectations.
- Added a real-process regression that emits two Bash calls in one assistant
response. The first exercises its explicit command timeout and the second must
still run successfully without waiting for the HTTP idle timeout.
## Verification
- Pre-fix regression: the new real-process test failed with the second Bash result
equal to `fetch failed`, reproducing the production failure under a 250 ms HTTP
idle timeout.
- Focused regression: `pnpm exec vitest run
tests/unit/pi-agent-server-process-real.test.ts
tests/unit/pi-extension-bundle.test.ts
tests/unit/pi-managed-worker-opener.test.ts --maxWorkers=2` passed 3 files and
9 tests.
- `pnpm run typecheck` passed.
- `pnpm test` passed 213 files and 1,733 tests; 3 tests were skipped.
- `pnpm run lint:check` passed with 0 errors and 5 existing warnings in
`src/pages/Home/index.tsx` and `src/pages/Makelore/index.tsx`.
- `pnpm run build:vite` passed for Renderer, Electron Main, Preload, and the
release utility worker, proving the fixed Agent Server resource is included by
the production build path.
- `git diff --check` passed.
## Follow-ups
- Integrate this feature branch into local `main`, update the canonical current
state/README, restart Makelore, and use the real-process regression as the
non-destructive smoke check instead of replaying the user's accepted turn.
## Promotion Candidates
- Promote the write-lease batch rule to README/current state: write-leased Pi
tools are serialized within one assistant batch, while read-only tools may
remain parallel.
- Record the full-suite, production-build, and real-process regression results in
the evidence index during integration.

View File

@@ -0,0 +1,70 @@
# Task: Integrate Bash tool bridge fix
## Identity
- Task ID: 20260902-integrate-bash-tool-bridge-e81a5c6d
- Mode: Integration
- Branch: main
- Worktree: /Users/inmanx/Documents/makelore
- Base commit: 6073bd6f4ce269b067b13e1eed0371b38dc2c054
- Owner: codex
- Status: Completed
## Scope
- Merge completed feature task `20260902-fix-bash-tool-bridge-9c4e7a12`
(`49112b6`) into local `main`.
- Reconcile the write-leased Pi tool-batch rule with README, canonical current
state, and the evidence index.
- Re-run focused real-process coverage, typecheck, and the production Vite build
on the integrated tree, then restart the local Makelore platform.
## Intent And Constraints
- Preserve the feature task's bounded semantics: only tools that acquire the
project write lease are serialized; read-only Pi tool batches remain parallel.
- Do not replay or mutate the user's accepted, currently stuck Conversation as a
smoke test. Use the disposable real-process regression instead.
- Merge only to local `main`; do not push, package, deploy, or alter unrelated
user changes.
- Treat production build success as proof that packaging consumes the fixed
resources, not as permission to claim an installer artifact was produced.
## Outcome
- Merged source commit `49112b6` into local `main` as merge commit `55bf80e`.
- Integrated the bounded Pi tool-batch correction: built-in `bash`, `edit`, and
`write`, plus dynamic product tools that acquire the project write lease, are
sequential within one assistant response. Read-only batches retain parallel
execution.
- Updated README, canonical current state, and the evidence index with the exact
failure mechanism and verification boundary. A production build was verified;
no installer was created, pushed, deployed, or published.
- Stopped the old development process cleanly so its already-open Agent Server
could not keep serving the pre-fix resource. The platform restart is the final
operational handoff after the integration commit.
## Verification
- Source branch: the pre-fix real-process regression reproduced the second Bash
result as `fetch failed` under a 250 ms managed-extension HTTP idle timeout.
- Source branch: 3 focused files / 9 tests, 213 full files / 1,733 tests with 3
skipped, typecheck, lint with 0 errors / 5 existing warnings, and the full
Renderer/Main/Preload/utility Vite production build passed.
- Integrated `main`: the 3 focused Pi process/extension/worker files passed all
9 tests, `pnpm run typecheck` passed, and `pnpm run build:vite` passed for all
four production targets.
- The regression verifies that a timed-out first Bash does not block the second
Bash, the second returns `SECOND_OK`, and neither result contains `fetch failed`.
## Follow-ups
- A signed installer is unnecessary to correct this source-level deadlock. Build
an installer only when release validation or distribution is requested; the
normal packaged resource path already consumes the corrected Agent Server and
v5 extension bundle.
## Promotion Candidates
- None; the relevant runtime contract and evidence were promoted during this
integration task.