Skip to content

fix: enrich dev logs with connection retry details and full stack traces#181

Merged
notgitika merged 1 commit into
mainfrom
fix/137-enrich-dev-logs
Feb 9, 2026
Merged

fix: enrich dev logs with connection retry details and full stack traces#181
notgitika merged 1 commit into
mainfrom
fix/137-enrich-dev-logs

Conversation

@notgitika

Copy link
Copy Markdown
Contributor

Fixes #137

Description

Enrich dev logs with detailed connection retry info and full error stack traces.

Changes:

  • Extended SSELogger interface with optional log() method
  • Log each retry attempt (attempt number, error, delay)
  • Log full stack trace on final failure (not just message)
  • Added InvokeOptions interface for logger support (backwards compatible)

Example log output:
[12:34:56] [WARN] Connection failed (attempt 1/5): ECONNREFUSED. Retrying in 500ms...
[12:34:58] [ERROR] Failed to connect after 5 attempts: Error: ECONNREFUSED
at fetch (...)
at invokeAgent (...)

Related Issues

#137

Documentation PR

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

How have you tested the change?

  • I ran npm run test:all
  • I ran npm run typecheck
  • I ran npm run lint
  • If I modified src/assets/, I ran npm run test:update-snapshots and committed the updated snapshots

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.

@aidandaly24 aidandaly24 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me i like this

@notgitika notgitika merged commit e234ecf into main Feb 9, 2026
9 of 14 checks passed
@notgitika notgitika deleted the fix/137-enrich-dev-logs branch February 9, 2026 14:56
@agentcore-cli-automation

Copy link
Copy Markdown

Reviewed post-merge — changes look good overall. The logging enrichment is minimal, focused, and the interface extension (log?() on SSELogger) is backwards compatible.

A couple of non-blocking observations for future follow-up:

  1. No tests added / no tests exist for this module. The new behavior (per-attempt retry warning, final-failure log with stack trace, non-connection error log path) is not exercised by any test. src/cli/operations/dev/invoke.ts has no dedicated test file at all. Since the original bug (enrich dev logs #137) was about observability/debuggability, a small test verifying that the logger receives the expected warn/error calls on retry would help lock in this behavior. Could be done by injecting a fake logger and mocking only fetch (the true I/O boundary).

  2. Retry + logging logic is now duplicated in two places (invokeAgentStreaming and invokeAgent). The retry loop was already duplicated before this PR, but this PR copies the new logging lines into both branches as well, making divergence more likely over time. Worth extracting into a shared helper like withRetries(logger, fn) in a follow-up.

  3. SSELogger name is now slightly misleading — it's no longer purely about SSE events, it's a general logger for the invoke path. Not worth renaming in this PR, but if the interface grows further it's worth reconsidering (or splitting into SSELogger and InvokeLogger).

None of these are blockers; the PR is fine as merged.

jariy17 pushed a commit that referenced this pull request May 21, 2026
…ows (#181)

Use actions/create-github-app-token@v1 to generate a short-lived token
for cloning the CDK repo instead of the CDK_REPO_TOKEN PAT secret.
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.

enrich dev logs

3 participants