Repository navigation
feat: add --agent-role to CLI session create - #1286
Merged
Leeeon233 merged 3 commits intoOct 11, 2026
Merged
Conversation
Resolve a workspace Agent Role by fixed id or unique name in `lody session create`, reusing the MCP resolution extracted into lib/agent-role-create.ts. The Role's machine, agent config, run configuration, and prompt prefix override --machine/--agent/ --agent-config/--mode/--model/--config-option with a stderr warning, and Role id/revision/snapshot freeze as creation provenance. Work-context flags and --parent still apply. Closes LodyAI#1282. Model: kimi-code (runtime model ID not exposed)
…eate-agent-role # Conflicts: # apps/cli/src/commands/session.ts
Resolve MCP imports and relocated CLI reference conflicts. Preserve Role creation behavior and record integration verification. Model: gpt-6
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.
Related issue
Closes #1282
Problem / pressure
lody session createhad no way to select a workspace Agent Role. CLI operators and automation had to hand-assemble machine, agent config, and run configuration fromlody agent-role get, which loses Role version provenance, drops the prompt prefix, and drifts when the Role changes — while the MCP create tools already resolve all of this fromagentRoleId.Summary
lody session creategains--agent-role <idOrName>, resolved from the workspace Role catalog by fixed id or unique name.apps/cli/src/lib/agent-role-create.ts; both surfaces use it. The Role's machine, agent config, run config, and prompt prefix are authoritative; manual--machine/--agent/--agent-config/--mode/--model/--config-optionare cleared with a stderr warning, and Role id/revision/snapshot freeze as creation provenance via the existing session-meta/input-config path.--repo/--branch/--local-project/--worktree/--parentstill apply as work context. A missing Role fails fast with the candidate list; unavailable targets keep failing in the existing create validation, matching MCP semantics.Visual explanation
Before / after
lody session create --helplists no Role option; Role config hand-copied fromlody agent-role get--agent-role <idOrName>resolves the catalog Role; its machine, agent config, run configuration, and prompt prefix win, with a warning for ignored flagsTest plan
apps/cli/src/lib/agent-role-create.test.ts(12 tests): selector id/unique-name/ambiguous/not-found, dispatch config and prompt derivation, ignored-override listing, catalog load via mockedLoroDocumentManager, provenance binding, work-context coexistence, and a parity test running the same Role fixture through the CLI resolver and MCP'sresolveMcpSessionCreate+buildMcpCreateOptions(equal machine, agent config, prompt, dispatch config, provenance).agent-role-create,lody-mcp-server,session): 145/145 pass. Fullapps/clisuite: 3493 passed, 1 failure ingithub-git-transport.test.tsthat only occurs under this session's injected git credential shim (passes 6/6 in a clean environment; unrelated code).tsgo --noEmit, oxlint (0 errors),check:public-boundary,check:platform-boundaries,check-code-collab-imports,lint:i18n, andoxfmtall pass.lody session create --agent-roleagainst a real workspace (no commander-level harness exists for this command, consistent with existing coverage of the other create flags).Context handoff
Original user prompt
Show original prompt
Shared conversation
Status: shared
Link: https://share.lody.ai/s/r1730r4h2j6yyhss06ahqrhkg18fvmqr#access=v1.5779813d5136883df772f3281853b19d544d65c44b6ba847339df3e09f935a00