Skip to content

Refactor experimental RLM checkout caching#1202

Merged
snimu merged 2 commits intomainfrom
sebastian/rlm-cache-2026-04-20
Apr 20, 2026
Merged

Refactor experimental RLM checkout caching#1202
snimu merged 2 commits intomainfrom
sebastian/rlm-cache-2026-04-20

Conversation

@snimu
Copy link
Copy Markdown
Contributor

@snimu snimu commented Apr 20, 2026

Description

  • Introduce commit-keyed experimental RLM checkout caching with rlm_ref
  • Add shared experimental utils for git checkout caching and upload locks
  • Make stale cached checkouts auto-prune when they are no longer in use

Changes:

  • add verifiers.envs.experimental.utils.git_checkout_cache for ref resolution, commit-keyed cache materialization, and stale-checkout pruning
  • add verifiers.envs.experimental.utils.file_locks for shared/exclusive path locks during archive creation and cleanup
  • switch the experimental RLM harness to use rlm_ref (default main) instead of branch-keyed cache resolution
  • keep local_checkout as a validation-only bypass for an existing checkout
  • memoize the resolved checkout per harness instance so one run stays pinned to one resolved commit
  • update ComposableEnv archive creation to hold a shared lock while reading local upload dirs
  • update the focused experimental RLM/composable tests to cover the new cache and locking behavior

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Test improvement

Testing

  • All existing tests pass when running uv run pytest locally.
  • New tests have been added to cover the changes

Checklist

  • My code follows the style guidelines of this project as outlined in AGENTS.md
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Note

Medium Risk
Changes how git checkouts are mirrored, materialized, and pruned, and adds filesystem locking around uploads; mistakes could cause flaky caching behavior or unintended deletion of cached worktrees. Scope is limited to experimental harness/utilities but touches subprocess/git and concurrency-sensitive paths.

Overview
Refactors experimental RLM checkout resolution to use a new shared verifiers.envs.experimental.utils package, including generic file_locks and a git_checkout_cache that maintains a repo mirror plus per-commit worktrees and supports branch/tag/full-SHA refs.

Updates the RLM harness API from rlm_branch to rlm_ref, treats local_checkout as a validation-only bypass, memoizes the resolved checkout per harness instance, and prunes stale cached worktrees when they are not locked for upload.

Adds upload-time shared locking in ComposableEnv._build_dir_archive to avoid pruning/races while archiving local directories, and expands test_rlm_composable_env.py to cover ref-to-commit materialization, per-instance pinning vs. new instance updates, lock-protected stale checkout retention, and GH token redaction on clone errors.

Reviewed by Cursor Bugbot for commit 6f0d86b. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b0ec724. Configure here.

Comment thread verifiers/envs/experimental/utils/git_checkout_cache.py
Comment thread verifiers/envs/experimental/utils/git_checkout_cache.py Outdated
Comment thread verifiers/envs/experimental/utils/git_checkout_cache.py
@snimu snimu merged commit 2081f23 into main Apr 20, 2026
6 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.

2 participants