Files
makelore/.project-docs/30-worklog/tasks/20260902-fix-bash-tool-bridge-9c4e7a12.md
2026-09-02 12:07:13 +08:00

4.0 KiB

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: 6073bd6f4c
  • 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.