Skip to content

refactor(cli)!: drop future session new - #774

Merged
huichen merged 1 commit into
mainfrom
refactor/cli-session-drop-new
Sep 22, 2026
Merged

huichen merged 1 commit into
mainfrom
refactor/cli-session-drop-new

Conversation

@huichen

@huichen huichen commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

What

Removes the future session new subcommand added in #771. future session set (#773) is the command that was actually asked for; new was a solution to a problem nobody had — it created a session and printed its id without running anything, while future run --session <id> creates the session it is given anyway, so nothing consumed the result.

$ future session --help
Usage:
  future session list [--json]                       List all sessions
  future session set <id> [options]                  Change settings on an existing session
  future session info <id>                           Show session details + stats
  ...

$ future session new --title X
Unknown command: new
<session help>            # exit 1

Removed

  • session new dispatch + new_session_command + SESSION_NEW_HELP
  • RunClient::new_session_with and NewSessionOptions (the plain new_session(cwd) used by the run orchestration is untouched)
  • session new golden-help entries in lib.rs; the main-help/docs/wiki/{en,zh} wordings say "List, inspect, update, rename, and delete" again
  • The SessionOptions parser now serves set alone (drops the help arm, since set resolves --help before the target id is known) — its tests survive as parse_session_options_requires_values_and_rejects_unknowns, plus a new session_new_is_gone guard

Kept

Verification

  • cargo test -p future-cli — 746 lib + 15 integration pass (7 tests fewer, all removed new cases).
  • cargo fmt --all --check clean; cargo clippy -p future-cli --all-targets --no-deps -- -D warnings clean (workspace-wide local clippy is noisy under Homebrew's 0.1.96; CI runs the pinned 1.97).
  • Manual pass against an isolated agent (future agent --home /tmp/… --grpc-addr 127.0.0.1:49193): sessions created via future run, then session set --parent/--title/--cwd/--thinking reflected in both session list --json and get_state; self/unknown parent, unknown target, and no-options all report and exit 1; --parent "" detaches.
  • Help column alignment re-checked after dropping the line (description column still 52).

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 set covers parent/title/cwd/model/thinking.

`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
huichen enabled auto-merge (squash) September 22, 2026 07:23
@huichen
huichen merged commit 820f5e7 into main Sep 22, 2026
12 checks passed
@huichen
huichen deleted the refactor/cli-session-drop-new branch September 22, 2026 07:28
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant