refactor(sse): harden SSE with queue-based writer, backpressure, and directory-aware batching

- Replace promise-chaining SSE writer with queue-based pump with MAX_QUEUED_FRAMES backpressure
- Make frontend parts batcher directory-aware with (sessionID, directory) composite key
- Add session content versioning for reliable content change detection
- Add TOOLS_CACHEBUST arg for selective Docker cache invalidation
- Add docker-upgrade.sh modes (cached/tools/full)
- Fix plugin install timeout and spawn error handling
- Fix assistant session endpoint path and ordering params
This commit is contained in:
Chris Scott committed 2026-06-06 11:11:10 -04:00
1 parent fdeffeaab7
commit 12b7387e11
25 files changed
+1632 -181

No files matched your search

+46 -4
View File
@@ -13,9 +13,35 @@ fi
NO_PULL=false
SHOW_LOGS=false
MODE="cached" # cached | tools | full
usage() {
cat <<EOF
Usage: $0 [--tools | --full] [--no-pull] [--logs]
Rebuild modes (pick one):
(default) Cached build. Reuses pnpm install + tool install layers.
Only changed source (and the frontend build) rerun. ~1-2 min.
--tools Cached build, but force a fresh uv/opencode install.
Keeps the expensive pnpm install cached. ~17 min.
--full Full --no-cache rebuild of everything. ~25 min.
Other flags:
--no-pull Skip 'git pull'.
--logs Follow container logs after starting.
EOF
}
while [[ $# -gt 0 ]]; do
case $1 in
--tools)
MODE="tools"
shift
;;
--full)
MODE="full"
shift
;;
--no-pull)
NO_PULL=true
shift
@@ -24,8 +50,12 @@ while [[ $# -gt 0 ]]; do
SHOW_LOGS=true
shift
;;
-h|--help)
usage
exit 0
;;
*)
echo "Usage: $0 [--no-pull] [--logs]"
usage
exit 1
;;
esac
@@ -39,8 +69,20 @@ fi
echo -e "${YELLOW}Stopping container...${NC}"
$DOCKER_COMPOSE down
echo -e "${YELLOW}Rebuilding image with no cache...${NC}"
$DOCKER_COMPOSE build --no-cache
case "$MODE" in
cached)
echo -e "${YELLOW}Rebuilding image (cached, source-only)...${NC}"
$DOCKER_COMPOSE build || exit 1
;;
tools)
echo -e "${YELLOW}Rebuilding image (cached + fresh uv/opencode)...${NC}"
TOOLS_CACHEBUST="$(date +%s)" $DOCKER_COMPOSE build || exit 1
;;
full)
echo -e "${YELLOW}Rebuilding image with no cache (full)...${NC}"
$DOCKER_COMPOSE build --no-cache || exit 1
;;
esac
echo -e "${YELLOW}Starting container...${NC}"
$DOCKER_COMPOSE up -d
@@ -51,4 +93,4 @@ if [ "$SHOW_LOGS" = true ]; then
else
echo -e "${GREEN}Upgrade complete${NC}"
$DOCKER_COMPOSE ps
fi
fi