How I built an open-source container crash-forensics tool using Kiro specifications, external telemetry, Docker termination records and property-based testing.

Two Python containers terminate with the same exit code: 137.

One was deliberately killed with SIGKILL.

The other was killed after Docker recorded an out-of-memory event.

If I examined only the exit codes, I would see the same result. Yet the recorded termination mechanisms are different.

That observation became the central problem behind Coroner, an open-source crash-forensics tool I built using Kiro for the Kiroween 2026 hackathon.

The goal was not to create another dashboard that confidently guesses why a container failed.

I wanted to preserve the evidence that existed before the container died, compare independent sources and show where the available information stops supporting a conclusion.

The problem: What survives a container crash?

When a container terminates unexpectedly, developers often start with a few familiar questions:

  • What was its exit code?
  • Did it run out of memory?
  • What happened immediately before termination?
  • Can the last recorded measurements be trusted?
  • Are we inferring something that the evidence does not establish?

Docker's State.ExitCode is useful, but it is not a complete diagnosis.

Exit code 137 commonly indicates termination by SIGKILL. It does not, by itself, establish an out-of-memory kill.

Another problem is evidence survival.

If telemetry is stored only inside a container that terminates, the information needed for investigation may be lost with the container.

Coroner addresses these issues by preserving acknowledged samples outside the application container and examining them alongside Docker's termination records.

Building the architecture

Coroner has four components.

Component Responsibility
Probe Runs inside the Python application container and captures process samples, including RSS
Collector Receives samples and stores acknowledged evidence outside the failing container
Runner Executes controlled termination experiments and records Docker state
Viewer Reads preserved evidence and presents timelines, recorded values and comparisons

The Probe samples process information every 500 milliseconds by default.

The Collector stores acknowledged samples as JSON Lines evidence on a separate Docker volume. The design distinguishes delivered samples from samples that could not be delivered.

The Runner controls the experiments and collects Docker termination details, including ExitCode, OOMKilled and the run manifest.

Finally, the Viewer displays the preserved evidence through a local, read-only web interface.

The Viewer starts no containers and does not modify saved runs.

That distinction matters. Reviewing evidence should not itself reproduce a destructive experiment.

Three experiments, one important difference

I created three controlled experiments using Docker Desktop with Linux containers on a Windows development machine.

The recorded results were:

Experiment ExitCode OOMKilled Preserved samples
A — Controlled fatal exit 1 false 15
B — Runner sends SIGKILL 137 false 15
C — Docker OOM kill 137 true 45

Experiment A establishes a controlled fatal process exit.

Experiment B terminates after the Runner issues docker kill --signal=KILL. Docker records exit code 137 and OOMKilled: false.

Experiment C also returns exit code 137, but Docker records OOMKilled: true under a 128 MiB memory limit.

The highest preserved RSS sample in C was 141,090,816 bytes, approximately 134.55 MiB.

The sampled RSS and the cgroup memory accounting that triggers an OOM kill are different measurements. Coroner does not treat a high RSS sample alone as proof of why the kernel terminated the container.

The important evidence is the Docker termination record, considered alongside the Runner's actions and preserved samples.

The Viewer's comparison page states the result:

The same exit code does not always mean the same failure.

This is the central demonstration in the project.

A second problem: Clocks do not automatically agree

Building the timeline exposed another issue.

The Probe, Collector, Runner and Docker records have different timestamp sources.

A timestamp without its clock provenance can make an investigation appear more certain than it actually is.

For Experiment B, the Runner recorded one timestamp immediately before issuing the kill command and another after the command returned.

Those recorded timestamps were 425 milliseconds apart.

That interval does not establish when the SIGKILL signal reached the container.

Coroner's Viewer uses a derived host-equivalent axis for B's memory samples. The derivation is labelled and is not independently verified as clock synchronisation.

Experiments A and C retain raw Probe capture time.

The design decision was straightforward: show the clock source, label derived timing information and avoid inventing an ordering that the evidence cannot prove.

How Kiro shaped the development process

I used Kiro's spec-driven development workflow to organise Coroner rather than treating the project as one large coding task.

The repository contains three specifications.

M0 — Evidence pipeline

This milestone established the requirements and design for the Probe, Collector, Runner and controlled experiments.

M1 — Forensic Viewer

This milestone organised the read-only interface, evidence presentation, timing information and comparison behaviour.

M2 — Demonstration and verification

This milestone documented judge instructions, reproducibility checks, safety constraints and recording tasks.

For M0 and M1, the Kiro specifications contain:

  • requirements.md — What the system must do.
  • design.md — Architecture and technical decisions.
  • tasks.md — Development tasks, verification steps and checkpoints.
  • tasks.meta.json — Recorded task execution history.

The development tasks reference requirements and include verification commands, expected behaviour and safety constraints.

Checkpoints require actual test results before work is accepted.

Kiro's task execution history is preserved in tasks.meta.json. I treat those records as evidence of development activity, not proof of correctness.

The tests and acceptance reports provide the separate verification.

You can inspect the actual Kiro files:

https://github.com/prabhakaran-jm/coroner/tree/master/.kiro/specs

Property-based testing uncovered real defects

One of the most useful parts of the development process involved Hypothesis, the Python property-based testing library.

Instead of testing only selected examples, property-based tests generate many inputs and explore behaviours that are easy to overlook.

Coroner includes 28 test_prop_* files containing 83 Hypothesis @given tests.

The properties cover areas such as:

  • Sample sequencing and missing-data accounting.
  • Evidence durability and recovery.
  • Dropped-sample handling.
  • Collector acknowledgement behaviour.
  • Runner verdict and manifest consistency.

The Collector's storage-status probe produced two particularly useful findings.

Defect 1: A later error could hide an earlier failure

If fsync failed and closing the file also failed, the close error could replace the more important earlier failure.

A property-test counterexample exposed this behaviour.

The fix explicitly retained the earlier failure rather than allowing a later close error to mask it.

Defect 2: Exception messages could contain control characters

Generated exception messages demonstrated that non-printable characters could reach the storage-status error text.

The fix replaced those characters with safe printable placeholders.

These findings matter because Coroner's purpose depends on evidence being recorded and reported accurately.

A forensic tool should not quietly misrepresent a storage failure.

Verification results

The recorded full unit-test run used a clean Windows checkout with Python 3.12.10.

Result Count
Collected 5,995
Passed 5,982
Failed 0
Skipped 13
Process exit code 0

The skipped tests include platform-specific checks, a Node-dependent test and tests requiring the unpublished real run files.

The Viewer has also been exercised through automated headless-Chrome checks.

This does not establish that every platform, browser or accessibility scenario has been tested.

The real Docker experiments were verified on one Windows host using Docker Desktop. Native Linux and macOS have not been verified.

A reproducible demonstration without Docker

I wanted other developers and hackathon judges to inspect the Viewer without having to run destructive container experiments.

The public repository includes scripts/make-sample-runs.py.

It generates three clearly labelled synthetic runs carrying the same key ExitCode and OOMKilled values as the recorded demonstration.

These synthetic files are not real container measurements and do not reproduce the Docker experiments.

They provide a safe way to exercise the Viewer and its comparison behaviour.

The complete setup instructions are available in JUDGING.md.

What I learned

Building Coroner reinforced three engineering lessons.

First, preserving information is not the same as understanding its cause.

An exit code is a recorded fact. A root-cause explanation requires further evidence.

Second, an accurate interface must distinguish recorded facts from derived values and missing observations.

A graph becomes more useful when the viewer knows which timestamps are measured, which are derived and what remains unknown.

Third, tests and development records serve different purposes.

A completed task shows development progress. A verified test provides evidence about a particular behaviour under particular conditions.

Kiro's specification workflow helped keep those distinctions visible throughout the project.

The most useful outcome was not a larger codebase. It was a tool with clearer boundaries around what its evidence can establish.

What comes next?

Coroner is an open-source foundation for further container failure investigation.

Possible next steps include:

  • Testing on native Linux hosts and macOS.
  • Supporting more container termination scenarios.
  • Improving the presentation of timing uncertainty.
  • Expanding human usability and accessibility testing.
  • Making saved evidence easier to share and examine across environments.

I also want to explore how developer tools can communicate uncertainty without making the user work harder.

Explore Coroner

Coroner is open source under the MIT licence.

GitHub repository:

https://github.com/prabhakaran-jm/coroner

Demo video — Kiroween 2026:

https://youtu.be/V1TVWcnrygg

Run Coroner locally:

https://github.com/prabhakaran-jm/coroner/blob/master/JUDGING.md

Kiro specifications:

https://github.com/prabhakaran-jm/coroner/tree/master/.kiro/specs

This article was written as part of the Kiroween 2026 hackathon, where I built Coroner using Kiro's spec-driven development workflow.

If you were investigating a production container crash, which evidence would you trust first, and what would you refuse to conclude without further measurements?