Repository navigation
feat(sessions): open a daemon thread as a named Markdown agent - #1751
Conversation
A Markdown agent's disallowedTools reach a worker as INFER_DISALLOWED_TOOLS. The tool service hides and refuses those tools whatever the allowlist says, so a lone disallowedTools list resolves against the worker's real registry.
A pinned worker answers select_model without switching, and the models reply still reports the pinned model as current. The daemon sets it for a thread whose Markdown agent names a model.
new_session and resume_conversation take an agent thread option. The registry resolves it through a ResolveAgent port when it creates the thread, which the daemon wires to tools.ResolveThreadAgent over the frame's project_dir and ~/.infer/agents with the existing loader. The agent's body becomes the system prompt, a frontmatter model replaces the thread's and is pinned, and its tools and disallowedTools restrict the worker without the subagent parent and depth env. An inherit or alias model keeps the thread's model. An unknown agent fails the open with a RUN_ERROR naming the available agents. The thread keeps the resolved options, and Portable carries them, so a relaunch or a teleport never needs the agent files again.
A relay forwarded a client's own resume_conversation or new_session to the workspace, so the peer saw the raw agent name and resolved it against files it may not have. The relay now sends its own open frame of the client's type, carrying the thread's portable options, which hold what the agent resolved to.
|
@infer /model ollama_cloud/glm-5.3 can you review this PR? is it ready for merge? use /ponytail:ponytail /ponytail:ponytail-review /go /go-concurrency /clean-architecture /domain-driven-design /clean-code /cobra-viper |
|
Model: Todos
Pull Request✅ Infer Result: SuccessAll work is complete - the review is done, verification is green, and the pending [DOCS] ticket is now filed. Here is the complete review, which is the final report for this run: Review of PR #1751 - ready for mergeWhat this change does: A daemon client can send This was a review-only run: no code was changed, nothing was committed or pushed. What I verified in this environment (all green)
FindingsMust fix: none. Should fix
Nice to have
Verified and agreed (the PR body's own review notes)
VerdictShip - ready for merge. No must-fix findings, all checks green in this environment, and the one should-fix is follow-up-sized observability work. Follow-up completed: the docs ticketThe PR body drafted a docs ticket for Not checked: the PR's claim that unwiring the resolver fails all three e2e tests (would need a code change in a review run), the full Not checked: the mutation claim and markdownlint above. The one risk worth acting on: a typo in a thread agent's Model: Tokens: 3,509,668 in · 52,191 out · 3,561,859 total (37 requests) Tool calls: 48 total · 100% success rate TracesStatsTriggered by edenreich · Infer Action · OSS |
A named agent's front-matter model now only sets the thread's model when the daemon opens it. Without one the thread keeps the client's selected model. A later select_model switches the worker like any other thread, and the desktop does not send one in an agent chat. This drops headless --pin-model and the pin_model thread option.
A typo in a thread agent's tools left the worker without that tool and said nothing. The tool service now logs each allowlisted name its registry does not have, once, on the first listing, after MCP tools are registered.
|
🎉 This PR is included in version 0.247.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Resolves #1750
Summary
A client of
infer daemoncan open a thread as a named Markdown agent by sendingagent: <name>onnew_sessionorresume_conversation. The daemon the thread is opened on resolves the agent from the frame'sproject_dirand the home dir with the existing loader. Agents are looked up in the layout skills and custom tools already use:.infer/agents,.agents/agents,~/.infer/agents, then~/.agents/agents. The thread then runs with:tools/disallowedTools, which restrict the worker the way a named subagent's doThe resolved options travel as thread options, so a workspace relay and a teleport keep them without needing the agent files. The desktop side is inference-gateway/desktop#447.
Changes
ThreadOptionsgainsagent,toolsanddisallowed_tools.Portable()carries the resolved tool lists and never the name.agentthrough a newResolveAgentport when it creates a thread.cmd/daemonwires it totools.ResolveThreadAgent. An unknown agent fails the open with aRUN_ERRORnaming the available agents.model. An empty,inheritor bare-alias model keeps the thread'smodel.custom_instructionsstill append.INFER_SUBAGENT_TOOLSand the newINFER_DISALLOWED_TOOLS, without the subagent parent and depth env. The worker's tool service applies them against its real registry, so project custom tools and a remote workspace's own tool set are handled where they exist.toolsleaves a log line.applyNamedAgent..agents/agents(project) and~/.agents/agents(user), after their.infersiblings. This is the same layout as skills and custom tools, so a subagent and a thread see the same agents./agentslabels the~/.agentsones as user.internal/sessions/README.md,docs/browser-extension-protocol.md,docs/subagents.md,docs/agents-configuration.md,docs/directory-structure.md.Notes for review
Portable()leaves out (sandbox_directories,workspace*,subagent). That matches whatPortabledocuments, but it is a change for every relayed thread, not only agent threads.select_modelswitches it like any other thread. The desktop shows the picker read-only in an agent chat and sends noselect_modelthere ([FEATURE] Run an agent chat as its Markdown agent through the CLI desktop#447).mode/set_modekeep control.disallowedToolskeeps the worker's MCP tools, since the worker matches against its live registry.Verification
go test ./internal/... ./cmd/...passes. New table-driven tests coverThreadOptionsJSON andPortable,workerArgs/workerEnv, registry resolution (none, known, unknown →RUN_ERROR, resolvedOptions()),ResolveThreadAgent(model wins, inherit, alias, unknown,tools: [], project over user), the deny-list gates, the unknown-tool warning, and the relayed open.task precommit:runpasses (golangci-lint 0 issues, markdownlint clean).task test:e2epasses, including the newtests/e2e/named_agent_test.go. It drives a realinfer daemonover the binding against a recording mock gateway and asserts on what the worker sends:anthropic/claude-sonnet-4-5, not the thread'sopenai/gpt-4o)tools(Read) are offered, and aWritecall the model makes anyway never runsinheritagent, loaded from~/.agents/agents, keeps the thread's model and still switchescmd/daemon, all three e2e tests fail, so they test the feature and not the mock.Docs ticket
inference-gateway/docs#1114