wmh run: host-answered github_search connector tool#192
Closed
kfallah wants to merge 2 commits into
Closed
Conversation
The built-in pi agent can call github_search during `wmh run`. The CLI process (the host) answers the tool call, resolving a GitHub token from the environment and fetching via wmh.connect, then returns the rendered items as the observation. On --harness-backend e2b the executor runs in the CLI process (the sandbox only carries frames), so the token never enters the sandbox: the CLI counterpart to platform#340's host-answered model, using the wmh.connect library from #174. - wmh/harness/connector_tools.py: GITHUB_SEARCH ToolSpec, github_search_available() (true iff a credential resolves host-side via WMH_GITHUB_TOKEN or a stored connector credential), and github_search_fetch() rendering ContextItems into a capped observation; missing token / ConnectError map to a clean is_error ToolOutcome. - wmh/cli/agent_session.py: _assemble gains extra_tools (appended as ToolSpec objects past the closed-set resolve_tools gate); LocalLiveDriver offers github_search only when a token resolves and dispatches it to the host-side fetch before the local jail executor. Co-Authored-By: Claude Fable 5 <[email protected]>
Greptile P1: github_search_available() offered the tool on a ConnectError (a present-but-unusable credential), promising the fetch would report the real error, but the fetch swallowed the same ConnectError and returned the misleading "not configured" message. The fetch now distinguishes an absent credential (-> "set WMH_GITHUB_TOKEN") from a corrupt one (-> "credential is invalid: <reason>"), so availability and fetch agree. Dropped the now-dead _resolve_auth helper; added a regression test for the corrupt-credential path. Co-Authored-By: Claude Fable 5 <[email protected]>
Contributor
Author
|
Closing as out of scope for the current WMH development stack. |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Wires a
github_searchtool intowmh runso the built-in pi agent can pull GitHub context mid-run. It's the CLI counterpart to platform#340 (same host-answered tool in the hosted runner), consuming thewmh.connectlibrary from #174.How (and why no secret reaches the sandbox)
Answered host-side:
wmh run'sLocalLiveDriver(in the CLI process) resolves the GitHub token from the environment, runswmh.connectget_connector("github").pull(...), and returns the renderedContextItems as the observation. On--harness-backend e2bthe executor runs in the CLI process (the sandbox only carries frames), soWMH_GITHUB_TOKENnever enters the sandbox. Bare-local has no sandbox; the token stays local as usual.wmh/harness/connector_tools.py—GITHUB_SEARCHToolSpec;github_search_available();github_search_fetch()rendering items into a capped observation, missing-token /ConnectError→ cleanis_erroroutcome (token never in the observation).wmh/cli/agent_session.py—_assemblegainsextra_tools(appended as ToolSpec objects past the closed-setresolve_toolsgate);LocalLiveDriveroffersgithub_searchonly when a token resolves and dispatches it to the host-side fetch before the local jail executor.Test plan
Full gate green: ruff, ty, pytest (1,965 passed). Inline tests (no network): render + capping, missing-token /
ConnectErrorclean errors, token never in observation; tool offered iff a credential resolves;_executedispatchesgithub_searchhost-side, never the jail executor.Scope
GitHub only, mirroring #340; Google/Slack/Notion/Brave are the same additive pattern. Token from
WMH_GITHUB_TOKEN; nowmh connectCLI is added here.🤖 Generated with Claude Code