Skip to content

fix(sessions): keep the step's outputs when a session log is over 1 GB - #855

Merged
artempartos merged 1 commit into
developfrom
artempartos/fix-kiro-file-too
Nov 23, 2026
Merged

artempartos merged 1 commit into
developfrom
artempartos/fix-kiro-file-too

Conversation

@artempartos

Copy link
Copy Markdown
Contributor

Problem

A Kiro workflow step failed with Output collection failed: Validation failed: File is too large (max is 1 GB), and the outputs it had written were lost.

  • The container uploads /var/log/mitm/http.log straight to cache storage. LogCollector#persist then attaches it, and SessionLogUploader refuses anything over 1 GB.
  • Nothing rescued that error. It left LogCollector#call and stopped AgentSessionStrategy#before_cleanup at its first line, collect_logs. Everything after it was skipped: outputs, refreshed credentials, credential metadata and usage. The activity then marked the session, and the step, failed.
  • The log grew that large because the Kiro adapter tracked all of amazonaws.com. Everything the agent does against AWS (aws CLI answers, image layers pulled from S3) was written with full bodies. Kiro's own traffic, and everything #collect_usage reads, is on *.kiro.dev.

Change

  • Sessions::LogCollector: each log succeeds or fails on its own.
    • A log whose listed size is over SessionLogUploader::MAX_SIZE skips the upload and keeps a bounded tail.
    • An upload that storage refuses falls back to the bounded read.
    • Any other storage error is recorded and the next log is collected.
    • All three cases are written to log-collection-report.txt.
  • AgentSessionStrategy#collect_logs rescues like collect_terminal_output already does. A log can no longer take outputs, credentials or usage down with it.
  • Agents::KiroCliAdapter#mitm_tracked_domains: kiro.dev only.
  • SessionLogUploader::MAX_SIZE names the limit the validator and the collector share.

Tests

  • log_collector_test: a log over the limit is kept as a tail, the rest are still collected, and the report says why. An upload storage refuses falls back to the bounded read.
  • workflow_step_strategy_test: outputs are collected when log collection raises.
  • kiro_cli_adapter_test: the proxy tracks kiro.dev only.

The three new collector and strategy tests fail on develop with the original exception and pass here. I ran the touched test files, the full rubocop and brakeman locally.

🤖 Generated with Claude Code

A log the container uploaded but storage refused (over SessionLogUploader's
1 GB limit) raised out of LogCollector and aborted before_cleanup at its
first line, so the step failed and its outputs, rotated credentials and
usage were never collected. Each log now succeeds or fails on its own: one
over the limit keeps a bounded tail, a refused upload falls back to the
bounded read, and either lands in the collection report.

Kiro tracked all of amazonaws.com, so the agent's own AWS traffic (aws CLI
answers, image layers from S3) went into http.log with bodies. Its usage is
read from kiro.dev hosts only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
@artempartos
artempartos merged commit f921528 into develop Nov 23, 2026
18 checks passed
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