Skip to content

Add 100-agent harness stress profiling - #177

Merged
senamakel merged 5 commits into
tinyhumansai:mainfrom
senamakel:harness-stress-profiling
Sep 20, 2026
Merged

senamakel merged 5 commits into
tinyhumansai:mainfrom
senamakel:harness-stress-profiling

Conversation

@senamakel

Copy link
Copy Markdown
Member

Summary

  • add an offline release-mode stress matrix for 1 to 100 concurrent agents with JSON and human-readable reports
  • add reusable process CPU/RSS profiling and durable observability sink health counters
  • remove listener-free event dispatch queueing and replace per-event listener vector copies with shared snapshots
  • document capacity testing, Linux perf workflows, interpretation guidance, and measured before/after results

Performance

For 100 concurrent agents with 100 local mock runs each:

  • observability off: throughput improved from about 172k to 439k runs/s; peak RSS fell from about 38 MiB to 9 MiB
  • counter listener: throughput improved from about 156k to 190k runs/s
  • full in-memory event retention: throughput improved from about 130k to 191k runs/s
  • sustained 100,000-run sample completed at about 262k runs/s with 9.7 MiB peak RSS and zero failures

These are single-host measurements of harness overhead with a deterministic local mock provider. The checked-in driver supports repeatable JSON output for machine-specific comparisons.

Validation

  • cargo fmt --all -- --check
  • cargo test --workspace
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test -p tinyagents-integration-tests --test harness_stress --release -- --ignored --nocapture
  • release stress matrices for off, count, and record observability modes
  • git diff --check upstream/main...HEAD

The explicit ignored capacity test successfully ran 100 concurrent agents and 2,000 total harness invocations.

senamakel and others added 3 commits September 20, 2026 10:16
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 15 billable files and costs up to $3.75.

Or wait 36 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: de95c7fc-101c-42fa-9bf3-8a4458dbb264

📥 Commits

Reviewing files that changed from the base of the PR and between 2cedd17 and 0d3bb14.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (15)
  • crates/tinyagents-harness/Cargo.toml
  • crates/tinyagents-harness/src/events/mod.rs
  • crates/tinyagents-harness/src/events/test.rs
  • crates/tinyagents-harness/src/events/types.rs
  • crates/tinyagents-harness/src/lib.rs
  • crates/tinyagents-harness/src/observability/README.md
  • crates/tinyagents-harness/src/observability/mod.rs
  • crates/tinyagents-harness/src/observability/profile.rs
  • crates/tinyagents-harness/src/observability/test.rs
  • crates/tinyagents-harness/src/observability/types.rs
  • crates/tinyagents-integration-tests/examples/harness_stress.rs
  • crates/tinyagents-integration-tests/tests/harness_stress.rs
  • docs/modules/harness/README.md
  • docs/modules/harness/performance.md
  • docs/spec/README.md

Comment @coderabbitai help to get the list of available commands.

@tinysweeper

tinysweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

Tiny Sweeper reviewed this change across 6 lane(s) and found 2 active actionable finding(s). Detailed lane evidence and any incomplete work are listed below.

State: Ready for maintainer review
Priority: medium
Reviewed head: 0d3bb14ef629
Updated: 1789891047 (Unix time)

Review snapshot

Change surface Files Review signal Count
Production 6 Active findings 1
Tests 4 Noted findings 0
Documentation 4 Resolved findings 9
Configuration 1 Pending checks/questions 0

Completeness: Complete
Test assessment: No supported feature-to-test mapping was available; this does not mean tests are absent or passed.

What changed

The review could not produce a supported behavioral summary; inspect the cited changed surface and lane details below.

Features

None identified with supported citations.

Tests

No supported feature-to-test mapping was produced. Test execution is not inferred.

Findings

  • medium · critique · Account for RSS when sampler creation fails — If `spawn` fails (for example, because the process has exhausted its thread limit), `.ok()` leaves `sampler` as `None`. `finish` still captures `final_snapshot`, but never adds its (crates/tinyagents\-harness/src/observability/profile\.rs:88)

Resolved this pass

  • Count only successful RSS samples
  • Test error paths for SinkHealth counters
  • Count only successful RSS samples
  • Test error paths for SinkHealth counters
  • Count only successful RSS samples
  • Count only successful RSS samples
  • Test error paths for SinkHealth counters
  • Count only successful RSS samples
  • Test error paths for SinkHealth counters

Before merge

None.

How this fits together

flowchart LR
  n0["smoke_sink_clone_shares_state<br/>changed"]:::changed
  n1["subscribe"]:::impacted
  n2["new"]:::impacted
  n0 -->|calls| n1
  n0 -->|tests| n1
  n0 -->|calls| n2
  n0 -->|tests| n2
  classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
  classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
  classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
  classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Loading
Agent review details

critique

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: Reviewed 2 files; 1 finding. _The code index is behind this pull request (indexed at `603163346f01`), so retrieved context may be out of date._ _Memory was unavailable (model: cortex: v1/recall: timed out after 10s), so this review ran without it._
  • Evidence: crates/tinyagents\-harness/src/observability/profile\.rs — Account for RSS when sampler creation fails

security

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: Reviewed 2 files; 0 findings. (1 earlier finding(s) still open) _The code index is behind this pull request (indexed at `603163346f01`), so retrieved context may be out of date._ _Memory was unavailable (model: cortex: v1/recall: timed out after 10s), so this review ran without it._

tests

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: Adds process profiling, stress driver, and sink health reporting; fixes earlier findings about RSS sample counting and error-path tests. Safe to merge. _The code index is behind this pull request (indexed at `603163346f01`), so retrieved context may be out of date._ _Memory was unavailable (model: cortex: v1/recall: timed out after 10s), so this review ran without it._

commits

  • Conclusion: Neutral
  • Scope reviewed: all assigned evidence
  • Lane summary: Nothing sensitive found in what this pull request commits.

description

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: Adds a reusable process CPU/RSS profiler, a stress test driver, and SinkHealth counters; earlier concerns about sample counting and error-path coverage are addressed in the new test and profile implementation. _The code index is behind this pull request (indexed at `603163346f01`), so retrieved context may be out of date._ _Memory was unavailable (model: cortex: v1/recall: timed out after 10s), so this review ran without it._

e2e

  • Conclusion: Neutral
  • Scope reviewed: all assigned evidence
  • Lane summary: No end-to-end harness in this repository: no e2e test files and no e2e workflow.
Evidence and run details
  • Models: ladder/vectors, gpt-5.6-luna, deepseek/deepseek-v4-flash
  • Spend: $0.019929
  • Tokens: 248293 input · 15262 output · 18338 cached · 1177 embedding
Head State Pass summary
2084514c1948 ready for maintainer review 2 active finding(s), 0 resolved finding(s) (at 1789889619)
0d3bb14ef629 ready for maintainer review 1 active finding(s), 9 resolved finding(s) (at 1789891047)

tinysweeper 0.1.0

@senamakel senamakel self-assigned this Sep 20, 2026

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

tinysweeper found nothing blocking. Approving.

             $0.0597 · 896,737 in / 32,150 out · 50,469 cached (6%) · ladder/vectors, gpt-5.6-luna, deepseek/deepseek-v4-flash, deepseek-v4-flash · 1,173 embedded
critique:    $0.0313 · 468,079 in / 12,496 out · 22,325 cached (5%) · gpt-5.6-luna, deepseek/deepseek-v4-flash
security:    $0.0237 · 365,016 in / 6,165 out  · 10,992 cached (3%) · gpt-5.6-luna
tests:       $0.0033 · 28,252 in  / 4,383 out  · 0 cached (0%)      · deepseek/deepseek-v4-flash
description: $0.0006 · 19,130 in  / 6,705 out  · 1,024 cached (5%)  · deepseek-v4-flash

@tinysweeper tinysweeper Bot added the priority: p2 Soon. Real but survivable — a rough edge, a gap, a thing that will bite later. label Sep 20, 2026
senamakel and others added 2 commits September 20, 2026 10:37
…ilure tests

The sample counter in ProcessProfiler was incremented on every sampling attempt, even when the RSS query failed, which inflated the count on systems where memory information is unavailable. The counter now only increments when a successful RSS reading is obtained, and the initial count is set to one only if the initial RSS value is present. Additionally, a new test verifies that both JournalSink and JsonlSink correctly report append failures when their underlying backends are unavailable.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The test for sample count now only runs on Linux, where profiling samples are reliably collected. On other platforms the assertion verifies that no samples are recorded, preventing false failures in cross-platform test runs.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@senamakel
senamakel merged commit e8e55d6 into tinyhumansai:main Sep 20, 2026
2 checks passed

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

tinysweeper found nothing blocking. Approving.

             $0.0199 · 248,293 in / 15,262 out · 18,338 cached (7%)  · ladder/vectors, gpt-5.6-luna, deepseek/deepseek-v4-flash · 1,177 embedded
critique:    $0.0082 · 106,236 in / 7,808 out  · 12,704 cached (12%) · gpt-5.6-luna, deepseek/deepseek-v4-flash
security:    $0.0052 · 81,319 in  / 1,655 out  · 5,634 cached (7%)   · gpt-5.6-luna
tests:       $0.0027 · 26,324 in  / 2,034 out  · 0 cached (0%)       · deepseek/deepseek-v4-flash
description: $0.0017 · 17,257 in  / 949 out    · 0 cached (0%)       · deepseek/deepseek-v4-flash

});
let worker = Arc::clone(&shared);
let interval = sample_interval.max(Duration::from_millis(1));
let sampler = std::thread::Builder::new()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

priority medium critique confident

Account for RSS when sampler creation fails

If spawn fails (for example, because the process has exhausted its thread limit), .ok() leaves sampler as None. finish still captures final_snapshot, but never adds its RSS to shared.peak_rss_bytes or sample_count; the reported peak therefore remains the initial RSS and can miss the entire workload's memory increase. Either return the thread-creation error or fold the final snapshot into the peak and sample count regardless of whether a sampler thread was created.

[RULE] unchecked-resource-failure ·

senamakel added a commit that referenced this pull request Oct 22, 2026
…egistry

refactor(subagents): remove registry forwarding shim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p2 Soon. Real but survivable — a rough edge, a gap, a thing that will bite later.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant