Skip to content

Add ExtensionContext.paths to expose resolved TauPaths - #627

Open
AmirF194 wants to merge 1 commit into
huggingface:mainfrom
AmirF194:fix/598-extension-context-paths
Open

Add ExtensionContext.paths to expose resolved TauPaths#627
AmirF194 wants to merge 1 commit into
huggingface:mainfrom
AmirF194:fix/598-extension-context-paths

Conversation

@AmirF194

Copy link
Copy Markdown

ExtensionRuntime.load() receives a TauResourcePaths that carries the resolved TauPaths, but never stores it. ExtensionContext exposes cwd, model, session_id, and other session values, but nothing about the Tau home, so an extension has no way to find TauPaths.home when a host moved it with TauPaths(home=...). Extensions end up hardcoding ~/.tau, which reads and writes the wrong location once the home moves (the tau-subagents extension does this in four places, recorded as a workaround in its ADR 0003).

Fix: ExtensionRuntime.load() now stores paths.paths or TauPaths(home=paths.root), the same fallback session.py already uses to build the trust store, and exposes it through a new ExtensionRuntime.paths property. ExtensionContext.paths reads that property under the same assert_active() generation check as every other context property, so a context captured before a /reload raises ExtensionError instead of reading the reloaded world.

Verification:

  • New test test_context_paths_exposes_resolved_paths_from_load and test_context_paths_falls_back_to_resource_root_home fail on main with AttributeError: 'ExtensionContext' object has no attribute 'paths' and pass on this branch (both run in the same Docker image).
  • test_session_exposes_extension_paths_at_moved_home exercises the real CodingSession.load() path end to end, same fail-before/pass-after check.
  • Added a context.paths staleness assertion next to the existing context.cwd one in test_reset_for_reload_invalidates_prior_context_and_ui.
  • Full suite (uv run pytest), ruff check ., ruff format --check ., and mypy all pass.

Fixes #598

@AmirF194
AmirF194 requested a review from alejandro-ao as a code owner August 21, 2026 04:45
@AmirF194
AmirF194 force-pushed the fix/598-extension-context-paths branch 2 times, most recently from bd63e38 to ce6f0d9 Compare August 24, 2026 21:53
ExtensionRuntime.load() received a TauResourcePaths carrying the
resolved TauPaths but never stored it, so ExtensionContext had no way
to hand extensions the same home directory a host may have moved with
TauPaths(home=...). Extensions had to hardcode "~/.tau".

Store the resolved paths on the runtime with the same fallback used in
session.py (paths.paths or TauPaths(home=paths.root)) and expose them
through a new ExtensionContext.paths property, following the same
generation check as the other context properties.

Fixes huggingface#598
@AmirF194
AmirF194 force-pushed the fix/598-extension-context-paths branch from ce6f0d9 to 5f86885 Compare August 24, 2026 21:54
@AmirF194

Copy link
Copy Markdown
Author

No rush, just checking in on this one. CI is sitting behind the first-time-contributor workflow approval wall, so it has not actually run yet, happy to rebase again if that helps.

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.

Expose the resolved TauPaths to extensions through ExtensionContext

1 participant