Repository navigation
refactor(cli)!: drop future session new - #774
Merged
Merged
Conversation
`future session new` (#771) turned out to be a solution to a problem nobody had: it only created a session (`new_session` + print the id) without running anything, while the actual request was to change an existing one — which is `future session set` (#773). Keeping both meant two commands with overlapping option surfaces and a create path whose result no command consumes (`future run --session <id>` also creates the session it is given). Removed: the `new` subcommand, `SESSION_NEW_HELP`, `RunClient::new_session_with` and `NewSessionOptions` (the plain `new_session(cwd)` used by the run orchestration is untouched, and the session options parser now serves `set` alone). The agent-side `set_parent_session` stays — `session set` needs it. A session can still be created without a token: it just isn't a CLI command, matching how every other client does it (they create on first prompt).
huichen
enabled auto-merge (squash)
September 22, 2026 07:23
huichen
added a commit
that referenced
this pull request
Oct 3, 2026
…#897) `future session info` reads the persisted journal and `future session set` reached only five options, so a headless caller could start a run and then had no way to see how the session was configured, stop it, or answer an approval it was parked on. This closes those gaps, mostly by wrapping RPCs the TUI and Desktop already used. Observation - `future session status <id> [--json] [--metrics]` reads `get_state`: the effective tool permission, the sandbox tier, context occupancy (tokens/window/percent, as opposed to `session info`'s lifetime totals), the loaded context files and skills, active/queued runs and pending approvals. A session pinned to `workspace` while the global default is `all` is only answerable here; `config get` and `session info` cannot express it. - `session transcript` now carries every entry's run outcome and token usage, and `--runs` prints a one-row-per-run ledger (status, duration, tokens, error). `--counts` gained run-status and token sections. - `--counts`/`--runs` cover the whole session by default: the byte budget only applies when the caller asks for it, so a distribution is never quietly partial. A cut now says to raise `--max-bytes` instead of pointing at `--cursor`, which the summaries reject. Configuration - `session set` gained the live-session group: `--tools`, `--no-tools`, `--no-builtin-tools`, `--system-prompt`, `--append-system-prompt`, `--permission`, `--sandbox`, `--context-files`, `--auto-compact`, `--auto-retry` — each validated here, each scoped to the target session, and readable back with `session status`. `--tools` and the two disable switches are mutually exclusive whichever order they arrive in. Control - `future session abort|cancel|approvals|approve|reject` — the CLI counterpart of the TUI's `/stop`, `/cancel`, `/approve` and `/reject`. `approve --allow <glob>` installs the standing rule *before* the decision (so the approved tool already sees it) and, if the decision then fails, says so rather than hiding the permission it left standing. Lifecycle - `session new|fork|forks|clone|title|export`. `new` returns deliberately: #774 dropped it because "a create path whose result no command consumes", and that premise is now gone — `session set` configures and `session status` reads the session back. `title` is a model call, so it prints the suggestion and only renames with `--apply`; its language defaults to the desktop app's `titleLanguage`. Wire contract - `SessionState` gained `optional string sandbox_tier = 41`. `--sandbox` was write-only: the agent stored the policy but nothing read it back, so a caller could never tell an explicitly chosen tier from the default. Absent means "no policy set", which is not the same as `off`. Additive and optional, so an older agent simply omits it (verified against the running one). Docs updated in both languages (self-inspection, session-history, the CLI wiki).
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
Removes the
future session newsubcommand added in #771.future session set(#773) is the command that was actually asked for;newwas a solution to a problem nobody had — it created a session and printed its id without running anything, whilefuture run --session <id>creates the session it is given anyway, so nothing consumed the result.Removed
session newdispatch +new_session_command+SESSION_NEW_HELPRunClient::new_session_withandNewSessionOptions(the plainnew_session(cwd)used by the run orchestration is untouched)session newgolden-help entries inlib.rs; the main-help/docs/wiki/{en,zh}wordings say "List, inspect, update, rename, and delete" againSessionOptionsparser now servessetalone (drops the help arm, sincesetresolves--helpbefore the target id is known) — its tests survive asparse_session_options_requires_values_and_rejects_unknowns, plus a newsession_new_is_goneguardKept
future session setto change an existing session's parent/title/cwd/model/thinking #773:future session setand the agent-sideset_parent_sessioncommand (the wire contract still has no other way to change a session's parent), the--helpand docs entries forset.run::VALID_THINKING_LEVELSstayspub(crate)(shared byrunandsession set).RunClient::new_sessionkeeps its own mock test assertingcreatedBy: "cli"and empty lineage/name/model/level fields.Verification
cargo test -p future-cli— 746 lib + 15 integration pass (7 tests fewer, all removednewcases).cargo fmt --all --checkclean;cargo clippy -p future-cli --all-targets --no-deps -- -D warningsclean (workspace-wide local clippy is noisy under Homebrew's 0.1.96; CI runs the pinned 1.97).future agent --home /tmp/… --grpc-addr 127.0.0.1:49193): sessions created viafuture run, thensession set --parent/--title/--cwd/--thinkingreflected in bothsession list --jsonandget_state; self/unknown parent, unknown target, and no-options all report and exit 1;--parent ""detaches.Breaking change is limited to a subcommand that shipped hours ago in #771 and has no other consumers (grep: no references outside
cli/).Follow-up
Nothing pending;
future session setcovers parent/title/cwd/model/thinking.