Skip to content

Commit b06ada3

Browse files
authored
Merge pull request #209 from Fr-e-d/contrib/sync-1776860855
sync: update 3 file(s) in core/
2 parents e65ff01 + 741b7a3 commit b06ada3

3 files changed

Lines changed: 43 additions & 15 deletions

File tree

.gaai/core/scripts/daemon-monitor-tail.sh

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,25 +89,45 @@ parse_log() {
8989
tool_count=$(grep -c '"type":"tool_use"' "$log_file" 2>/dev/null || echo 0)
9090
fi
9191

92-
# ── Last activity (from system task_progress events) ──
93-
local last_activity=""
94-
local last_tool=""
92+
# ── Last activity: main agent + sub-agent (implement / QA), same compact format ──
93+
# jq filter: per-tool arg formatting (basename ONLY for file_path-based tools,
94+
# raw command for Bash — avoids "null" from `split("/") | last` on `2>/dev/null`).
95+
local JQ_TOOL_LINE='
96+
def clean: tostring | gsub("\n"; " ") | gsub(" +"; " ");
97+
def arg:
98+
if .name == "Bash" then (.input.command // "" | clean)
99+
elif .name == "Grep" then (.input.pattern // "" | clean)
100+
elif (.name == "Read" or .name == "Edit" or .name == "Write" or .name == "NotebookEdit") then ((.input.file_path // "" | clean) | split("/") | .[-1] // "")
101+
elif .name == "Task" then (.input.description // "" | clean)
102+
elif .name == "TodoWrite" then "(todos updated)"
103+
else ((.input.description // .input.file_path // .input.command // .input.query // "") | clean) end;
104+
"\(.name) \(arg)"
105+
'
106+
local last_main="" last_sub=""
95107
if $HAS_JQ; then
96-
last_activity=$(tail -300 "$log_file" 2>/dev/null \
97-
| jq -r 'select(.type=="system" and .subtype=="task_progress") | .description // empty' 2>/dev/null \
108+
# Main: task_progress.description first, fall back to compact tool_use
109+
last_main=$(tail -500 "$log_file" 2>/dev/null \
110+
| jq -r 'select(.type=="system" and .subtype=="task_progress" and (.parent_tool_use_id // null) == null) | .description // empty' 2>/dev/null \
98111
| tail -1 || true)
99-
if [[ -z "$last_activity" ]]; then
100-
# Fallback: last tool_use name + file_path if available
101-
last_activity=$(tail -300 "$log_file" 2>/dev/null \
102-
| jq -r 'select(.type=="assistant") | .message.content[]? | select(.type=="tool_use") | "\(.name) \(.input.file_path // .input.command // .input.pattern // "" | tostring | split("/") | last // "")"' 2>/dev/null \
112+
if [[ -z "$last_main" ]]; then
113+
last_main=$(tail -500 "$log_file" 2>/dev/null \
114+
| jq -r "select(.type==\"assistant\" and (.parent_tool_use_id // null) == null) | .message.content[]? | select(.type==\"tool_use\") | $JQ_TOOL_LINE" 2>/dev/null \
115+
| tail -1 || true)
116+
fi
117+
# Sub-agent: same logic, ptuid != null
118+
last_sub=$(tail -500 "$log_file" 2>/dev/null \
119+
| jq -r 'select(.type=="system" and .subtype=="task_progress" and (.parent_tool_use_id // null) != null) | .description // empty' 2>/dev/null \
120+
| tail -1 || true)
121+
if [[ -z "$last_sub" ]]; then
122+
last_sub=$(tail -500 "$log_file" 2>/dev/null \
123+
| jq -r "select(.type==\"assistant\" and (.parent_tool_use_id // null) != null) | .message.content[]? | select(.type==\"tool_use\") | $JQ_TOOL_LINE" 2>/dev/null \
103124
| tail -1 || true)
104125
fi
105126
else
106-
last_tool=$(tail -200 "$log_file" 2>/dev/null \
127+
last_main=$(tail -200 "$log_file" 2>/dev/null \
107128
| grep -o '"type":"tool_use"[^}]*"name":"[^"]*"' \
108129
| tail -1 \
109130
| sed 's/.*"name":"\([^"]*\)".*/\1/' 2>/dev/null || true)
110-
last_activity="$last_tool"
111131
fi
112132

113133
# ── Cost ──
@@ -126,7 +146,9 @@ parse_log() {
126146
fi
127147

128148
echo -e " ${color}${health_icon}${NC} ${tool_count} tools | Last update: ${color}${age_label} ago${NC}${duration_label:+ | Running: ${duration_label}}${cost:+ | \$${cost}}"
129-
[[ -n "$last_activity" ]] && echo -e " ${DIM}${last_activity}${NC}"
149+
# Use printf %s for data so literal "\n" in Bash commands stays literal (not interpreted)
150+
[[ -n "$last_main" ]] && printf ' %b→ %s%b\n' "$DIM" "$last_main" "$NC"
151+
[[ -n "$last_sub" ]] && printf ' %b ↳ %s%b\n' "$DIM" "$last_sub" "$NC"
130152
}
131153

132154
while true; do

.gaai/core/workflows/delivery-loop.workflow.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ git remote get-url origin 2>/dev/null || {
8484
# Resolve worktree path ONCE as absolute — all subsequent operations use $WORKTREE_PATH
8585
REPO_ROOT="$(git rev-parse --show-toplevel)"
8686
REPO_NAME="$(basename "$REPO_ROOT")"
87-
WORKTREE_PATH="${GAAI_WORKTREE_BASE:-${REPO_ROOT}/../.gaai/${REPO_NAME}/worktrees}/${id}-workspace"
87+
WORKTREE_PATH="${GAAI_WORKTREE_BASE:-${REPO_ROOT}/../.gaai-worktrees/${REPO_NAME}}/${id}-workspace"
8888
mkdir -p "$(dirname "$WORKTREE_PATH")"
8989

9090
# Step 0a: Sync with latest staging (under flock if concurrent)
@@ -118,7 +118,7 @@ fi
118118

119119
All sub-agents operate exclusively inside `$WORKTREE_PATH`. The main working directory stays on `staging` and is never switched. If two Stories run in parallel, each has its own worktree — zero filesystem conflicts. Worktree isolation is **unconditional** regardless of story tier.
120120

121-
Default worktree location is `<parent-of-repo>/.gaai/<repo-name>/worktrees/<story-id>-workspace` — this keeps all GAAI worktrees grouped under a single `.gaai/` folder at the parent level, avoiding pollution of the parent directory when multiple projects share it. Override by setting `GAAI_WORKTREE_BASE` (e.g., `export GAAI_WORKTREE_BASE=/tmp/gaai-worktrees` for cloud-synced repos).
121+
Default worktree location is `<parent-of-repo>/.gaai-worktrees/<repo-name>/<story-id>-workspace` — this groups all GAAI worktrees under a single dedicated folder at the parent level, avoiding pollution of the parent directory when multiple projects share it. The `.gaai-worktrees/` name avoids collision with the in-project `.gaai/` folder. Override by setting `GAAI_WORKTREE_BASE` (e.g., `export GAAI_WORKTREE_BASE=/tmp/gaai-worktrees` for cloud-synced repos).
122122

123123
### 1. Select Next Story
124124

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
---
99

10-
## [Unreleased]
10+
## [2.19.0] - 2026-04-22
1111

1212
### Changed
13+
- feat(daemon-monitor): surface sub-agent activity + fix "Bash null" rendering
1314
- fix(framework): use .gaai-worktrees/ naming to avoid in-project .gaai/ collision
15+
- chore(framework): group delivery worktrees under <parent>/.gaai/<repo>/worktrees/
16+
- feat(impl-routing): DEC-72 — env-driven default (secondary when configured)
17+
- chore: bump local VERSION to v2.19.0 [sync]
18+
- feat(delivery-loop): §7c unify non-.gaai deletions into sub-agent reviewer
19+
1420

1521
## [2.19.0] - 2026-04-22
1622

0 commit comments

Comments
 (0)