Skip to content

perf: warm Code Mode sandbox and cache repository context for batch refactors - #2

Merged
Raezil merged 51 commits into
mainfrom
feat/codemode-repository-context-fastpath
Oct 9, 2026
Merged

Raezil merged 51 commits into
mainfrom
feat/codemode-repository-context-fastpath

Conversation

@Raezil

@Raezil Raezil commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

CodeMode repository performance improvements

PyLattice now reuses source context and the Monty runtime between coding steps, and can refactor/create multiple files with fewer policy-checked tool calls.

Runtime & context

  • Warm sandbox: one Monty worker pool per agent run, isolated execution sessions per program; always closed after the task.
  • context_collect: search or explicitly select up to 24 files in one bounded read-only call, with relevance-centered code excerpts, line offsets, SHA-256 revisions and index_hits/disk_reads diagnostics.
  • Workspace search index: bounded 8 MiB metadata-validated in-memory index avoids re-reading unchanged files on repeated queries.
  • Context Manager integration: bounded LRU of 64 verified full-source snapshots / 4 MiB, automatically selects context relevant to subsequent CodeMode steps, detects staleness and redacts model credentials.
  • Security: raw repository snippets are included as explicitly untrusted user-level reference data, never promoted to system instructions.

Repository edits

  • apply_patchset: one approval for up to 24 edits and creations, with schema validation, exact unique replacements, optional expected SHA-256, per-file diffs and sandbox policy.
  • Preflight all mutations before staging; no-clobber hard links for new files; source invalidation and best-effort rollback on partial errors. Not a cross-file atomic transaction.
  • Read-only policy and approval hooks remain enforced through the existing ToolRegistry/ToolPolicy boundary.

Verification

  • 294 tests passed; Ruff lint and Python compilation passed: successful CI.
  • A reproducible synthetic benchmark checks 240 files / 2.09 MB on the GitHub Actions runner:
    • Cold scan: 47.165 ms, 240 disk reads.
    • Warm median: 25.819 ms, 0 disk reads, 240 index hits.
    • Warm search approximately 1.83× faster under those conditions.
  • This measurement is only filesystem context collection on CI, not end-to-end model/tool routing or overall refactoring speed. No unsupported total speedup claims.

Docs

README includes ready-to-run CodeMode examples for context collection and a multi-file patchset, plus the benchmark command.

@vercel

vercel Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
py-lattice Ready Ready Preview Oct 9, 2026 8:04pm UTC
pylattice Canceled Canceled Oct 9, 2026 8:04pm UTC

@vercel

vercel Bot commented Oct 9, 2026

Copy link
Copy Markdown

Deployment failed for project py-lattice with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/protocol-lattice?upgradeToPro=build-rate-limit

@vercel

vercel Bot commented Oct 9, 2026

Copy link
Copy Markdown

Deployment failed for project pylattice with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/protocol-lattice?upgradeToPro=build-rate-limit

@Raezil
Raezil merged commit 13094e4 into main Oct 9, 2026
1 of 3 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.

1 participant