Skip to content

fix(agents): add observability to work-item image download#949

Merged
zbigniewsobiecki merged 1 commit intodevfrom
fix/work-item-image-download-observability
Mar 18, 2026
Merged

fix(agents): add observability to work-item image download#949
zbigniewsobiecki merged 1 commit intodevfrom
fix/work-item-image-download-observability

Conversation

@zbigniewsobiecki
Copy link
Copy Markdown
Member

Summary

  • Root cause diagnosed: fetchWorkItemStep silently discarded image downloads when downloadAttachment returned null — no log entry was emitted, making failures completely invisible in run logs (only container stdout was written, which is never captured in cascadeLog)
  • Add INFO/WARN log calls around the parallel image download block so every outcome — start, per-image failure, and final summary — appears in the run log
  • Fix pre-existing URL credential leak: the exception-path WARN already present was logging the full URL including Trello query-param credentials (key=, token=); both WARNs now strip query params with .split('?')[0]
  • Fix stray lowercase log level: builderFactory.ts had a single logWriter('warn', ...) inconsistent with the codebase-wide 'WARN' convention

Changes

File Change
src/agents/definitions/contextSteps.ts INFO before Promise.all (count), WARN on null return (sanitized URL), INFO after (attempted/downloaded/skipped); fix URL sanitization in existing exception WARN
src/agents/shared/builderFactory.ts 'warn''WARN' to match convention
tests/unit/agents/definitions/contextSteps.test.ts Replace 2 tests + add 1 new test covering: null-return WARN with URL sanitization, exception WARN with URL sanitization, INFO log counts

Test plan

  • All 5963 unit tests pass locally
  • Typecheck clean
  • Pre-push hooks (lint + typecheck + changed-file unit tests) pass
  • On next run with an image-bearing work item, run logs will show:
    • [INFO] fetchWorkItemStep: downloading work item images { count: N }
    • [WARN] fetchWorkItemStep: image download returned null { url: <no query params> } (on failure)
    • [INFO] fetchWorkItemStep: image download complete { attempted: N, downloaded: M, skipped: K }

🤖 Generated with Claude Code

…rkItemStep

Silent null returns from downloadAttachment were completely invisible in run
logs, making image delivery failures impossible to diagnose. Add INFO logs
before and after the parallel download, plus a WARN when a download returns
null (with query params stripped from the URL to avoid leaking Trello API
credentials).

Also fix a pre-existing bug where the exception-path WARN logged the full URL
including query-param credentials, and correct a stray lowercase 'warn' log
level in builderFactory.ts to match the codebase-wide 'WARN' convention.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@zbigniewsobiecki zbigniewsobiecki merged commit f3797f1 into dev Mar 18, 2026
8 checks passed
@zbigniewsobiecki zbigniewsobiecki deleted the fix/work-item-image-download-observability branch March 18, 2026 19:32
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant