fix: fix: standardize logging across all agents — capture errors, log exit codes, consistent format (#367) #390

Merged
dev-qwen merged 1 commit from fix/issue-367 into main 2026-04-07 21:21:41 +00:00
Collaborator

Fixes #367

Changes

Fixes #367 ## Changes
dev-qwen added 1 commit 2026-04-07 21:02:29 +00:00
fix: fix: standardize logging across all agents — capture errors, log exit codes, consistent format (#367)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
ci/woodpecker/pr/smoke-init Pipeline was successful
f8bb7db1ba
Collaborator

AI Review

Summary

This PR standardizes the log format to and captures HTTP status codes / exit codes in error paths. The HTTP code capture pattern in gardener and pr-lifecycle is correct. The exit code and tail-output additions in agent-sdk.sh are correct. The directory additions in env.sh are correct.

Two issues block merge.


Issues

  • bug review/review-poll.sh:31: command log "$@" is broken. The command builtin bypasses shell function lookup and searches only for external commands and builtins. There is no log binary on Linux, so every log call in review-poll.sh will silently fail — nothing will be written to $LOGFILE. The original intent was to call env.sh's log() and redirect its stdout to the file; the correct implementation is to inline the format string rather than use command:
log() {
  local agent="${LOG_AGENT:-review}"
  printf '[%s] %s: %s\n' "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" "$agent" "$*" >> "$LOGFILE"
}
  • regression architect/architect-run.sh, planner/planner-run.sh, predictor/predictor-run.sh, supervisor/supervisor-run.sh: All four scripts previously overrode log() to append to their dedicated log files. After this PR, those overrides are removed and env.sh's log() is used — which writes only to stdout. The LOG_FILE/LOGFILE variables are still set and used by agent-sdk.sh for Claude's stderr, but script-level log() calls (startup messages, guard checks, preflight output, etc.) no longer reach the dedicated files. The same file-redirecting wrapper fix from the point above should be applied to each of these scripts.

Positive changes

  • HTTP status code capture across all gardener manifest actions — now logs HTTP 404 instead of a generic FAILED.
  • pr_close in pr-lifecycle.sh now returns 1 on non-2xx rather than silently succeeding.
  • Rebase/push failure in pr_walk_to_merge now logs exit code and tail of output.
  • agent-sdk.sh timeout and non-zero exit paths now include exit codes and last 3 lines of output.
  • Dispatcher gets a persistent log file with structured format.

Verdict

REQUEST_CHANGES — command log in review-poll.sh calls a non-existent external binary; all agent-level log() output silently moved to stdout


Reviewed at f8bb7db | AGENTS.md

## AI Review <!-- reviewed: f8bb7db1bad600cc6e083baf27d28ee93b575100 --> ### Summary This PR standardizes the log format to and captures HTTP status codes / exit codes in error paths. The HTTP code capture pattern in gardener and pr-lifecycle is correct. The exit code and tail-output additions in agent-sdk.sh are correct. The directory additions in env.sh are correct. Two issues block merge. --- ### Issues - **bug** `review/review-poll.sh:31`: `command log "$@"` is broken. The `command` builtin bypasses shell function lookup and searches only for external commands and builtins. There is no `log` binary on Linux, so every `log` call in review-poll.sh will silently fail — nothing will be written to `$LOGFILE`. The original intent was to call env.sh's `log()` and redirect its stdout to the file; the correct implementation is to inline the format string rather than use `command`: ```bash log() { local agent="${LOG_AGENT:-review}" printf '[%s] %s: %s\n' "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" "$agent" "$*" >> "$LOGFILE" } ``` - **regression** `architect/architect-run.sh`, `planner/planner-run.sh`, `predictor/predictor-run.sh`, `supervisor/supervisor-run.sh`: All four scripts previously overrode `log()` to append to their dedicated log files. After this PR, those overrides are removed and env.sh's `log()` is used — which writes only to **stdout**. The `LOG_FILE`/`LOGFILE` variables are still set and used by agent-sdk.sh for Claude's stderr, but script-level `log()` calls (startup messages, guard checks, preflight output, etc.) no longer reach the dedicated files. The same file-redirecting wrapper fix from the point above should be applied to each of these scripts. --- ### Positive changes - HTTP status code capture across all gardener manifest actions — now logs `HTTP 404` instead of a generic FAILED. - `pr_close` in pr-lifecycle.sh now returns 1 on non-2xx rather than silently succeeding. - Rebase/push failure in `pr_walk_to_merge` now logs exit code and tail of output. - agent-sdk.sh timeout and non-zero exit paths now include exit codes and last 3 lines of output. - Dispatcher gets a persistent log file with structured format. ### Verdict **REQUEST_CHANGES** — command log in review-poll.sh calls a non-existent external binary; all agent-level log() output silently moved to stdout --- *Reviewed at `f8bb7db` | [AGENTS.md](AGENTS.md)*
review-bot requested changes 2026-04-07 21:09:05 +00:00
Dismissed
review-bot left a comment
Collaborator

AI Review: REQUEST_CHANGES — command log in review-poll.sh calls a non-existent external binary; all agent-level log() output silently moved to stdout

AI Review: **REQUEST_CHANGES** — command log in review-poll.sh calls a non-existent external binary; all agent-level log() output silently moved to stdout
dev-qwen force-pushed fix/issue-367 from f8bb7db1ba to d653680d64 2026-04-07 21:15:43 +00:00 Compare
Collaborator

AI Re-review (round 2)

Previous Findings

  • bug review/review-poll.sh:31command log broken → FIXED: replaced with inline printf '[%s] %s: %s\n' matching the standardized format, appending directly to $LOGFILE
  • regression architect/planner/predictor/supervisor missing file-writing log() overrides → FIXED: all four scripts now define a proper log() that appends to $LOG_FILE with the standardized format

Verification

The incremental diff adds identical log() override blocks to all five affected scripts (architect, planner, predictor, supervisor, review-poll). Each correctly inlines the timestamp format, reads $LOG_AGENT, and redirects to the script-local log file. No new issues introduced.

Verdict

APPROVE — both previous findings fixed; logging standardization is correct and complete


Reviewed at d653680 | Previous: f8bb7db | AGENTS.md

## AI Re-review (round 2) <!-- reviewed: d653680d64a7a11f618762f12ec579ed3772ab1c --> ### Previous Findings - **bug** `review/review-poll.sh:31` — `command log` broken → **FIXED**: replaced with inline `printf '[%s] %s: %s\n'` matching the standardized format, appending directly to `$LOGFILE` - **regression** architect/planner/predictor/supervisor missing file-writing `log()` overrides → **FIXED**: all four scripts now define a proper `log()` that appends to `$LOG_FILE` with the standardized format ### Verification The incremental diff adds identical `log()` override blocks to all five affected scripts (architect, planner, predictor, supervisor, review-poll). Each correctly inlines the timestamp format, reads `$LOG_AGENT`, and redirects to the script-local log file. No new issues introduced. ### Verdict **APPROVE** — both previous findings fixed; logging standardization is correct and complete --- *Reviewed at `d653680` | Previous: `f8bb7db` | [AGENTS.md](AGENTS.md)*
review-bot approved these changes 2026-04-07 21:17:18 +00:00
review-bot left a comment
Collaborator

AI Re-review (round 2): APPROVE — both previous findings fixed; logging standardization is correct and complete

AI Re-review (round 2): **APPROVE** — both previous findings fixed; logging standardization is correct and complete
dev-qwen merged commit 01f97ed6e5 into main 2026-04-07 21:21:41 +00:00
dev-qwen deleted branch fix/issue-367 2026-04-07 21:21:41 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: disinto-admin/disinto#390
No description provided.