Skip to content

Conversation

@s-hamdananwar
Copy link
Contributor

@s-hamdananwar s-hamdananwar commented Jan 16, 2026

Summary by CodeRabbit

  • New Features
    • Added ability to specify participant attributes when running agent load tests via CLI flags (--attribute for individual values and --attribute-file for configuration files).

✏️ Tip: You can customize this high-level summary in your review settings.

@s-hamdananwar s-hamdananwar requested review from a team and mike-r-mclaughlin January 16, 2026 19:54
@coderabbitai
Copy link

coderabbitai bot commented Jan 16, 2026

📝 Walkthrough

Walkthrough

This change adds support for participant attributes in the agent load test functionality. It introduces CLI flags for specifying attributes directly or via JSON files, parses them at runtime, and propagates them through load testing parameters to be used when joining rooms.

Changes

Cohort / File(s) Summary
CLI and Configuration
README.md, cmd/lk/perf.go
Added --attribute and --attribute-file flags to agent-load-test command. Implements parsing of key-value attribute pairs from CLI and JSON file input with error handling.
Load Testing Integration
pkg/loadtester/agentloadtest.go, pkg/loadtester/agentloadtester.go
Extended AgentLoadTestParams struct with ParticipantAttributes field and propagated it to ConnectInfo during room join.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Through flags and files, attributes flow,
Each participant steals the show,
With traits declared, the load test leaps,
Our fuzzy validation never sleeps! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add participant attributes for agent load test' clearly and accurately describes the main change in the pull request, which adds a new ParticipantAttributes field across multiple files to enable participant attribute support in agent load testing.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

🧹 Recent nitpick comments
README.md (1)

423-429: Consider documenting --attribute-file for agent-load-test.

The example only shows --attribute, but the implementation also supports --attribute-file (as documented for lk room join). Consider adding a note or example showing that --attribute-file works here too, or referencing the earlier room join documentation.

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 86d6dde and 94f6e59.

📒 Files selected for processing (4)
  • README.md
  • cmd/lk/perf.go
  • pkg/loadtester/agentloadtest.go
  • pkg/loadtester/agentloadtester.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: test (ubuntu-latest)
  • GitHub Check: test (windows-latest)
  • GitHub Check: test (macos-latest)
  • GitHub Check: build
  • GitHub Check: Analyze (go)
🔇 Additional comments (5)
pkg/loadtester/agentloadtester.go (1)

174-180: LGTM!

The ParticipantAttributes propagation to ConnectInfo is correctly implemented. The LiveKit SDK handles nil maps gracefully, so no nil-check is needed here.

pkg/loadtester/agentloadtest.go (1)

23-32: LGTM!

The new ParticipantAttributes field is properly added to the params struct with the appropriate type for key-value pairs.

cmd/lk/perf.go (3)

113-121: LGTM!

The CLI flag definitions are well-structured with appropriate usage descriptions. The TakesFile: true properly enables file path completion for --attribute-file.


271-276: File attributes override CLI attributes — is this intentional?

maps.Copy(participantAttributes, fileAttrs) copies file attributes into the map, meaning file values will overwrite any CLI-provided values for the same key. Typically, CLI flags take precedence over file-based configuration. If this is the intended behavior, consider adding a comment to clarify the precedence order.

If CLI should take precedence, swap the merge order:
-		// Add attributes from file to the existing ones
-		if participantAttributes == nil {
-			participantAttributes = make(map[string]string)
-		}
-		maps.Copy(participantAttributes, fileAttrs)
+		// Merge file attributes first, then CLI attributes take precedence
+		if participantAttributes == nil {
+			participantAttributes = fileAttrs
+		} else {
+			maps.Copy(fileAttrs, participantAttributes)
+			participantAttributes = fileAttrs
+		}

Or more simply:

-		maps.Copy(participantAttributes, fileAttrs)
+		// File provides defaults, CLI flags override
+		for k, v := range fileAttrs {
+			if _, exists := participantAttributes[k]; !exists {
+				participantAttributes[k] = v
+			}
+		}

7-7: No action required. The project's minimum Go version is 1.25.0, which fully supports the maps package (introduced in Go 1.21).

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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

Copy link
Contributor

@real-danm real-danm left a comment

Choose a reason for hiding this comment

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

lgtm

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.

3 participants