Skip to content

Enclosing code reads carry linked file lessons - #1139

Merged
zlareb1 merged 1 commit into
mainfrom
fix/enclosing-code-lessons
Nov 22, 2026
Merged

zlareb1 merged 1 commit into
mainfrom
fix/enclosing-code-lessons

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 22, 2026

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Improvement

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

code.enclosing returns readable memories about the files of resolved definitions, with their code freshness state and the same bounded lesson enrichment as other code reads.

Why

An agent can read a definition through code.enclosing without ever calling code.symbol. That path returns the code but omits its linked history, so a memory-enabled session can receive no notes despite reading the relevant file. Enclosing answers use the shared file-lesson enrichment after the code answer is assembled.

Scope and risk

Only files containing resolved locations supply lesson candidates. Unresolved locations remain in the answer and contribute none; repeated locations share a file read. Existing namespace authorization, narrowed-token exclusion, path limits, timeout, token cap and supersession filtering apply. The added read can increase latency; callers can disable it. No model call is added.

Compatibility, rollout and rollback

  • Wire: code.enclosing accepts include_lessons (default true) and lesson_namespaces (default empty); output adds optional lessons and lessons_left_out. Empty lesson fields are omitted. No fields are removed.
  • Operator steps: none. No schema, extraction or re-index change.
  • Rollback: revert the code and regenerated API documentation and SDK types; no stored data changes.

Tests

Ruff lint and format, the function-length gate, the server mypy gate, SDK type checking, generated API/SDK refresh and diff checks pass. Unit coverage is added for resolved versus unresolved locations, opt-out, narrowed scope, namespace filtering, duplicate paths, registry wiring and wire serialization. An integration case covers authorized lessons, inaccessible memory namespaces and opt-out through the registered HTTP endpoint.

Local unit tests are not run at the requester's direction. Integration tests are authored but not run locally alongside the active timing evaluation. A fresh agent review is required before merging; CI is not awaited. The active evaluation remains on its frozen source and does not measure this change.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Codex; checked the shared authorization and enrichment path, generated surfaces and source discovery evidence.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Full test suites pass; not run locally at the requester's direction.
  • Generated files are regenerated in this PR.
  • No migration or plugin version change is required.
  • Docs describe the operation's lesson enrichment and opt-out.
  • Commits are signed off.

Agents can read definitions by location without a symbol lookup. Reuse bounded result enrichment so those reads carry authorized file history too, excluding unresolved locations.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
@vercel

vercel Bot commented Nov 22, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
loom-docs Building Building Preview Nov 22, 2026 4:26am UTC

Request Review

@zlareb1
zlareb1 merged commit dc65a21 into main Nov 22, 2026
57 of 60 checks passed
@zlareb1
zlareb1 deleted the fix/enclosing-code-lessons branch November 22, 2026 04:28
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