Repository navigation
feat(hub): a filter on an upstream tool's result before the agent reads it (ADR-0069) - #505
Merged
Merged
Conversation
…ds it (ADR-0069) The hub runs a local command (such as `veilq mark -`) on fields of an upstream tool's result before `devstack mcp` gets it, and stores the command's `write` back through a tool of the same upstream. Filters are the user's alone (`[[filter]]` in `upstreams.toml`, the MCP upstreams page); they fail closed: no answer from the command fails the call. Closes #502 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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 and why
Agents read tickets through devstack's upstreams, and a ticket's description often holds the personal data of the people it is about. The only place to redact it before an agent reads it is between the upstream and the agent: in the hub. This adds a filter on an upstream tool's result: the hub runs a local command (such as
veilq mark -, veilq ADR-0024) on fields of the result and hands the agent the command'stext; when the command answers withwrite, the hub stores it back through the same upstream (save_issue), so the next read finds veilq's marker.crates/devstack-hub/src/filters.rs: the filter, its check, paths (description,issues[*].description), running the command (exit 0 or 1 with{text, write?}, 30 s, its own process tree), applying it to aCallToolResult(text content parsed as JSON andstructuredContentalike).upstreams.rs:[[filter]]inupstreams.toml, run incall(), so it holds for every harness behinddevstack mcpand forDEVSTACK_NO_HUB; write-backs;upstreams/filters.log(never content); removing an upstream removes its filters.GET/PUT /hub/upstreams/filters,POST /hub/upstreams/filters/test.docs/dashboard-api.md, thedevstackskill.Review card
Approved by the owner in the conversation on 2026-11-10: all six points.
devstack mcpgets it (amends ADR-0069, which left rewriting content out of scope). If wrong: a filter misconfigured to pass content through looks like protection.upstreams.tomland the MCP upstreams page, never by a pool or a stack file: a filter runs a command, and a pool runs no command on a member's machine (ADR-0094).structuredContentalike;[*]steps through arrays) and the command. The command gets the field's string on stdin and answers JSON withtext(required) andwrite(optional); exit 0 or 1 count as an answer.write(save_issue,{id: "$args.id", description: "$write"}), only for a path without[*]; the hub calls it with the user's login.text, or a result that is not JSON where a filter applies, turns the tool call into an error; the raw content is never returned. An absent path means nothing to filter. A failed write-back still returns the filtered text and is logged.Decided while building (in the addendum): the command gets the hub's environment; every content item must be text holding JSON (an image or resource fails the call); an upstream's error result is handed on; the write-back runs before the hub answers (not in the background as first planned: simpler, one round trip per ticket); its tool need not be in the allowlist.
Checked
cargo fmt --check,cargo clippy --workspace --all-targets -D warnings,cargo test -p devstack-hub(158, 7 new, among them an end-to-end test through a fake upstream with write-back and fail-closed),cargo test -p devstack --test hub,cargo test -p devstack-skills;ui: typecheck,npm test,npm run build.veilq0.1.0 (Windows) on a synthetic body: exit 1,text/writeas expected, name and phone number replaced in the filtered result.Closes #502
🤖 Generated with Claude Code