fix(design): keep site gallery filled under queue floods - #81
Conversation
Dashboard recent_runs prioritized newest queued rows, so the screenshots-only site filter returned an empty design gallery despite many awaiting_admin PNGs. Prefer post-sanitize stages in recent_runs, and fall back the marketing leaderboard to previous-round ratings when the open round has no winners yet.
Parallel libtest raced set_var/remove_var on AGENTIC_ENABLE_RUN_COMMAND and flaked the pre-push workspace suite.
📝 WalkthroughWalkthroughThe pull request serializes environment-sensitive tests, changes dashboard recent-run selection, adds previous-round leaderboard fallback behavior, and updates site API documentation. ChangesTest environment isolation
Site API behavior
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
crates/design-http/src/stats.rs (1)
123-136: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueAdd the
list_runsdescending-order contract.Both persisted and memory
list_runsimplementations use the latest rows, butDesignStore::list_runsis unsigned. Add a short doc/contract next to the trait method so future store implementations do not break dashboard ordering.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/design-http/src/stats.rs` around lines 123 - 136, Document the descending-order requirement on the DesignStore::list_runs trait method, stating that implementations must return the latest runs first so dashboard ordering remains consistent across persisted and in-memory stores. Do not change select_recent_runs or the list_runs implementation logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/challenge-agentic/src/tools.rs`:
- Around line 707-715: Update both tests protected by RUN_COMMAND_ENV_LOCK,
run_command_executes_in_sandboxed_cwd and
run_command_disabled_without_container_env, to capture the existing
AGENTIC_ENABLE_RUN_COMMAND value and restore it via a scoped guard before the
mutex guard is released, including during panic unwinding. Preserve each test’s
current environment mutations while ensuring the original present or absent
value is reinstated afterward.
---
Nitpick comments:
In `@crates/design-http/src/stats.rs`:
- Around line 123-136: Document the descending-order requirement on the
DesignStore::list_runs trait method, stating that implementations must return
the latest runs first so dashboard ordering remains consistent across persisted
and in-memory stores. Do not change select_recent_runs or the list_runs
implementation logic.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: fbdfaaf9-8f4d-4583-b0ac-79e9768ac71a
📒 Files selected for processing (4)
crates/challenge-agentic/src/tools.rscrates/design-http/src/stats.rscrates/site-api/src/handlers.rsdocs/SITE_API.md
| /// `AGENTIC_ENABLE_RUN_COMMAND` is process-global; serialize the two tests | ||
| /// that mutate it so parallel libtest cannot race enable vs disable. | ||
| static RUN_COMMAND_ENV_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(()); | ||
|
|
||
| #[test] | ||
| fn run_command_executes_in_sandboxed_cwd() { | ||
| let _guard = RUN_COMMAND_ENV_LOCK | ||
| .lock() | ||
| .unwrap_or_else(std::sync::PoisonError::into_inner); |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Restore AGENTIC_ENABLE_RUN_COMMAND after each test.
The mutex serializes the two tests, but it does not restore the previous process-global value. run_command_executes_in_sandboxed_cwd removes the variable at Line 729, and run_command_disabled_without_container_env removes it at Line 746. The review container sets this variable in crates/review-docker/src/lib.rs:79-95. A later test can therefore observe the wrong ToolContext::from_request mode. Capture the previous value and restore it with a scoped guard before releasing RUN_COMMAND_ENV_LOCK, including during panic unwinding.
Also applies to: 743-746
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@crates/challenge-agentic/src/tools.rs` around lines 707 - 715, Update both
tests protected by RUN_COMMAND_ENV_LOCK, run_command_executes_in_sandboxed_cwd
and run_command_disabled_without_container_env, to capture the existing
AGENTIC_ENABLE_RUN_COMMAND value and restore it via a scoped guard before the
mutex guard is released, including during panic unwinding. Preserve each test’s
current environment mutations while ensuring the original present or absent
value is reinstated afterward.
Summary
/v1/site/arenas/design/submissionsbuilds from dashboardrecent_runs. Prod’s newest 40 runs were allqueued(no PNGs), so the gallery filtered to empty even though dozens ofawaiting_adminruns have liveindex.pngs. Leaderboard was empty because the open round has no winners yet while previous-round ratings (21) were only used for deltas.recent_runs(wider 500-row scan), and fall back the marketing design leaderboard to previous-round standings when current ratings are empty.run_commandenv tests that raced under parallel libtest (pre-push flake).200 image/png,Cross-Origin-Resource-Policy: cross-origin).Test plan
cargo test -p design-http select_recent_runscargo test -p site-api design_leaderboard_falls_backcargo test -p challenge-agentic --lib tools::tests::run_commandGET https://chain.joinbase.ai/v1/site/arenas/design/submissionsreturnstotal > 0withscreenshotUrlGET .../leaderboardreturns previous-round rows when current ratings emptySummary by CodeRabbit
Improvements
Documentation