Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 58 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1772,17 +1772,19 @@ still cannot fit is shortened with an ellipsis. Width updates on resize.
when the option filter is empty). **Escape** closes the list, retaining the draft
and typing focus. Back from a rename or directory review restores the edited
argument in the composer. Speed menus
initially show all options: Up/Down highlights a choice, **Enter REVIEW** stages it,
and **C CONFIRM** applies it. The separate **CURRENT** marker identifies the
initially show all options: Up/Down highlights a choice, and **Enter APPLY** or
clicking an option applies it. Highlighting alone never changes a setting.
The separate **CURRENT** marker identifies the
existing speed; the highlighted choice uses bright text without a reversed background.
The action line shows only the current next step, Enter Review or C Confirm,
without a second confirmation hint. Settings blocked during an active turn show
The action line shows the current next step. Permission changes, directory changes
and unknown actions retain **Enter REVIEW**, then **C CONFIRM**, by default.
Settings blocked during an active turn show
**WAITING FOR IDLE**, with **Ctrl+R REFRESH** in the terminal composer
(**F REFRESH** in the read-only picker) to read their availability again;
speed changes are available during a turn and are sent immediately after confirmation,
speed changes are available during a turn and are sent on explicit selection,
without a local queue. They configure subsequent turns, not a request already in flight.
**HELP** identifies genuine browse-only entries. Model, reasoning and speed changes are provisional until C;
reviewing or changing the highlight sends no settings update. Buttons
**HELP** identifies genuine browse-only entries. Merely navigating or changing
the highlight sends no settings update. Buttons
are clickable. Writable web mode exposes the same catalogue through
**/ COMMANDS**, with the same composer suggestion shortcuts.

Expand All @@ -1800,16 +1802,18 @@ read-only browser mode, except for the terminal-only `/commands` shortcut.

**Connected-session commands — shared app-server required.** Availability depends
on the installed server and session state; unsupported or empty catalogues are
omitted. Changes require explicit confirmation and, in the browser, opt-in
writable mode. Browse-only entries do not execute tools or change configuration.
omitted. Changes require explicit selection and, in the browser, opt-in writable
mode. Reversible session-local changes do not need a second confirmation;
permission/directory changes and unknown actions remain guarded by default.
Browse-only entries do not execute tools or change configuration.

| Command family | Live options and behaviour |
| --- | --- |
| `/cd` | Change the selected session’s directory after review and confirmation while idle and with no queued messages. Absolute, session-relative and `~/` paths are supported; success is verified from running configuration. Retains thread ID/history; does not reproduce native project-config reload/fork. |
| `/cwd`, `/pwd` | Read-only aliases showing the running session’s current directory, including during active turns. |
| `/rename` | Edit the selected session’s saved name, review it and confirm. Uses Codex’s name API; works during an active turn and does not send a prompt or change model settings. |
| `/rename` | Edit the selected session’s saved name and apply it without a second confirmation. Uses Codex’s name API; works during an active turn and does not send a prompt or change model settings. |
| `/model` | Advertised models, their descriptions and supported reasoning levels. Choosing a model resets its explicit speed override to the server default. |
| Advertised speed commands, such as `/fast` | Show the default speed and every advertised tier in one list, initially highlighting the current speed. Up/Down selects; **Enter REVIEW** provisionally selects the highlighted choice while keeping the list visible, then **C CONFIRM** applies it. Changing the highlight cancels the pending confirmation. IDs and descriptions come from the current model's catalogue; no tier IDs are guessed. The changed speed is verified before success is reported. |
| Advertised speed commands, such as `/fast` | Show the default speed and every advertised tier in one list, initially highlighting the current speed. Up/Down highlights; **Enter APPLY** or clicking a choice applies it without a second confirmation. IDs and descriptions come from the current model's catalogue; no tier IDs are guessed. The changed speed is verified before success is reported. |
| `/plan` | Advertised collaboration modes, using Codex's built-in mode instructions. |
| `/permissions` | Named profiles allowed for the session's directory, with supplied descriptions. Review carefully: this changes future permission behaviour. |
| `/skills`, `/apps`, `/mcp`, `/hooks`, `/experimental` | **Browse-only** live inventories and supplied help, including MCP tool descriptions. Invoke/configure these through Codex. |
Expand Down Expand Up @@ -1850,9 +1854,9 @@ The terminal `/statusline` checkbox list uses the same composer expansion, but
deliberately does not filter: **Up/Down** selects, **Space** toggles, **Left/Right**
reorders and **Enter** applies the local display preferences. Escape discards
unapplied changes. Other menu levels keep help subdued on one line, shortened
with an ellipsis when needed. Model, reasoning, speed, name and directory changes
still require separate review and **C CONFIRM**; shrinking the terminal cannot
confirm a hidden control. The composer and conversation remain in place through
with an ellipsis when needed. Reversible settings use **Enter APPLY**; guarded
changes keep separate review and **C CONFIRM** by default. Shrinking the terminal
cannot activate a hidden control. The composer and conversation remain in place through
all levels, including in a wide session row. `/commands` also opens the root
list, including local commands without a shared daemon.

Expand All @@ -1867,10 +1871,11 @@ scope is process-wide rather than session-local. See the official
[app-server API overview](https://learn.chatgpt.com/docs/app-server#api-overview)
for the upstream catalogues.

Renames require a loaded session and explicit confirmation within 30 seconds; a concurrent rename or reconnect invalidates the confirmation. The updated name appears on the next telemetry refresh.
Renames require a loaded session and revalidated options; a concurrent rename or
reconnect invalidates the old choice. The updated name appears on the next telemetry refresh.

Codex session-setting changes require a loaded session and explicit confirmation within
30 seconds. Speed-only changes can be sent while working or waiting for an approval;
Codex session-setting changes require a loaded session. Guarded changes retain
their separate confirmation with a 30-second expiry. Speed-only changes can be sent while working or waiting for an approval;
other settings still require idle and no pending approval. The command and options
are revalidated before sending; stale connections and changed options fail closed.
A normal turn start/completion does not invalidate a speed confirmation, but changed
Expand All @@ -1882,6 +1887,41 @@ confirmations retain the draft and error context. These changes do not modify gl
quota thresholds may later supersede model settings. Uncertain requests are
not retried automatically. Read-only web mode offers no command-control endpoint.

### Fewer confirmation steps

By default, `/rename`, model/reasoning selection, advertised speed changes such as
`/fast`, and `/plan` apply on explicit selection. They do not launch a prompt;
settings affect subsequent turns and can be changed again. Model and speed choices
can still affect quota consumption or API cost. `/cd`, `/permissions`, unknown
commands and other guarded actions retain their existing confirmation steps.
Local display commands and read-only inventories remain immediate or browse-only.

To opt out of Codexometer's extra confirmation clicks for this launch:

```sh
codexometer --no-confirm
codexometer --web --web-control --no-confirm
```

**Quota resets are the one exception: redeeming a reset always requires confirmation.**
Elsewhere, this flag makes explicit actions single-step, including approvals and
persistent grants, quota-profile decisions, sending browser prompts or schedules,
scheduled Send now, native queue deletion, Close All dismissal and guarded benchmark
launches. An accidental click can therefore authorise work, spend quota or change
permissions: use it only when you want that trade-off. It never chooses an action
for you or automatically approves an incoming request.

The flag is not saved in preferences, does not enable web writes without
`--web-control`, and is not forwarded to Codex. Codex's sandbox/approval rules,
fresh-state checks, capability/revision validation and one-use/replay guards remain.
The browser still uses server-side prepare/commit validation, but completes both
phases after the one explicit action. Failed or uncertain writes are never retried
automatically. Unless stated otherwise, confirmation instructions elsewhere in this
README describe the default guarded behaviour.
Recognised key-repeat events are ignored for command submission and approval
shortcuts. Older terminals may not distinguish held-key repeats, so avoid holding
action keys when using `--no-confirm`.

**Slash-command audit:** the [complete version-matched inventory](docs/slash-command-support.md)
compares Codexometer with Codex CLI **0.162.1**, including aliases, partial support
and the reason for each missing adapter. Several missing commands already have
Expand Down Expand Up @@ -2721,6 +2761,7 @@ open directly.
--check-auth verify the current Codex login and exit
--error-log PATH opt into bounded JSON operational diagnostics (off by default)
--verbose add diagnostic context to --error-log; never raw payloads
--no-confirm skip extra confirmation clicks, except quota-reset redemption
--demo preview simulated quota, Sessions, Usage, and benchmark data
--inline render inline instead of using the alternate screen
--web experimental read-only browser interface (loopback only)
Expand Down
14 changes: 14 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@ tests must cover confirmation, navigation/draft isolation, stale controls and te
escaping. Prompt sending/approvals are the only web mutations; benchmarks and
reset redemption still have no routes.

Reversible session-local slash changes (name, model/reasoning, advertised speed,
and collaboration mode) apply on explicit selection without a second UI click.
Permissions, directories and unknown actions remain guarded by default.
`--no-confirm` is a launch-only opt-out from other Codexometer confirmation clicks;
quota-reset redemption remains guarded even with this option. It does not select
approvals automatically, change Codex sandbox policies, enable read-only web
control routes or bypass server-side preparation/commit, source freshness,
revision, one-use capability or replay validation. Browser preparation and commit
remain distinct protected requests even when one user action runs both phases.
Never infer an action's risk from its display label: the shared adapter marks
only an explicit allowlist of reversible RPC methods/fields. Unknown metadata
requires confirmation by default. Test both policies, including unavailable
actions, failed preparation, stale/replaced requests and the reset exception.

Prepared bodies are limited to 64 KiB and each answer to 4,096 characters. At most
one prepared action is retained for 30 seconds per server; replacement invalidates
the previous confirmation. Drafts/answers are not logged or persisted. Secret
Expand Down
14 changes: 9 additions & 5 deletions internal/codex/session_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,22 @@ type SessionCommandChoice struct {
Next string `json:"next,omitempty"`
Action bool `json:"action,omitempty"`
Selected bool `json:"selected,omitempty"`
// Reversible is set only for an explicit allowlist of session-local settings.
// Unknown actions and permission changes retain confirmation by default.
Reversible bool `json:"reversible,omitempty"`
// Unavailable explains a blocked action; an empty reason with no Action is genuine browse-only help.
Unavailable string `json:"unavailable,omitempty"`
method string
params map[string]any
}

type SessionCommandMenu struct {
Title string `json:"title"`
Help string `json:"help"`
Path string `json:"path"`
Revision string `json:"revision"`
Multiple bool `json:"multiple,omitempty"`
ReversibleInput bool `json:"reversibleInput,omitempty"`
Title string `json:"title"`
Help string `json:"help"`
Path string `json:"path"`
Revision string `json:"revision"`
Multiple bool `json:"multiple,omitempty"`
// Picker keeps choices visible; the highlighted option is applied explicitly.
Picker bool `json:"picker,omitempty"`
Input bool `json:"input,omitempty"`
Expand Down
29 changes: 27 additions & 2 deletions internal/codex/session_commands_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ func normalizeCommandMenu(menu SessionCommandMenu) SessionCommandMenu {
o.Unavailable = commandText(o.Unavailable)
o.ID = commandDigest([]any{o.Label, o.Help, o.Next, o.Unavailable, o.method, o.params})
o.Action = o.method != ""
o.Reversible = reversibleSessionCommand(*o)
if !seen[o.ID] {
unique = append(unique, *o)
seen[o.ID] = true
Expand All @@ -206,6 +207,29 @@ func normalizeCommandMenu(menu SessionCommandMenu) SessionCommandMenu {
return menu
}

func reversibleSessionCommand(o SessionCommandChoice) bool {
if !o.Action {
return false
}
switch o.method {
case "thread/name/set":
return len(o.params) == 2 && o.params["name"] != nil && o.params["threadId"] != nil
case "thread/settings/update":
changed := false
for key := range o.params {
switch key {
case "threadId":
case "model", "effort", "serviceTier", "collaborationMode":
changed = true
default:
return false
}
}
return changed && o.params["threadId"] != nil
}
return false
}

func (p *daemonStatusProvider) commandMenu(ctx context.Context, t commandThread, path string, collect func(string, commandMenuBranch)) (SessionCommandMenu, error) {
m := SessionCommandMenu{Title: "/" + path, Help: "Live options from the shared Codex app-server.", Choices: []SessionCommandChoice{}}
parts := strings.Split(path, "/")
Expand Down Expand Up @@ -258,17 +282,18 @@ func (p *daemonStatusProvider) commandMenu(ctx context.Context, t commandThread,
}
}
m.Title = "/ COMMANDS"
m.Help = "Choose a command. Options/help are discovered live. Changes target this session only and require confirmation. Speed changes can be sent during a turn and apply to subsequent turns; other settings require idle. Catalogues marked browse-only do not execute tools or change global configuration."
m.Help = "Choose a command. Options/help are discovered live. Reversible session settings apply on explicit selection; permission and directory changes require confirmation by default. Speed changes can be sent during a turn and apply to subsequent turns; other settings require idle. Browse-only catalogues do not execute tools or change global configuration."
return m, nil
}
if parts[0] == "cd" || parts[0] == "cwd" || parts[0] == "pwd" {
return p.commandDirectoryMenu(ctx, t, path)
}
if parts[0] == "rename" {
m.Title = "/rename"
m.Help = "Rename this session in Codex. Enter a single-line name, then review and confirm the change. It does not send a prompt or change model settings."
m.Help = "Rename this session in Codex. Enter a single-line name and apply it. It does not send a prompt or change model settings."
if path == "rename" {
m.Input = true
m.ReversibleInput = true
m.InputLabel, m.InputLimit = "Session name", SessionRenameInputLimit
m.Value = commandLabel(t.Name)
return m, nil
Expand Down
34 changes: 34 additions & 0 deletions internal/codex/session_confirmation_unix_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//go:build unix

package codex

import "testing"

func TestOnlyAllowlistedSessionChangesAreReversible(t *testing.T) {
for _, tc := range []struct {
method string
params map[string]any
want bool
}{
{"thread/name/set", map[string]any{"threadId": "one", "name": "New name"}, true},
{"thread/settings/update", map[string]any{"threadId": "one", "model": "m", "effort": "high", "serviceTier": nil}, true},
{"thread/settings/update", map[string]any{"threadId": "one", "collaborationMode": map[string]any{}}, true},
{"thread/settings/update", map[string]any{"threadId": "one", "serviceTier": "priority"}, true},
{"thread/settings/update", map[string]any{"threadId": "one", "permissions": "full"}, false},
{"thread/settings/update", map[string]any{"threadId": "one", "model": "m", "permissions": "full"}, false},
{"thread/settings/update", map[string]any{"threadId": "one", "cwd": "/new"}, false},
{"thread/settings/update", map[string]any{"threadId": "one", "futureField": "value"}, false},
{"thread/settings/update", map[string]any{"threadId": "one"}, false},
{"thread/settings/update", map[string]any{"model": "m"}, false},
{"future/write", map[string]any{"threadId": "one"}, false},
} {
menu := normalizeCommandMenu(SessionCommandMenu{Choices: []SessionCommandChoice{{Label: "Option", method: tc.method, params: tc.params}}})
if len(menu.Choices) != 1 || menu.Choices[0].Reversible != tc.want {
t.Fatal("wrong reversible action classification", tc.method, tc.params, menu)
}
}
menu := normalizeCommandMenu(SessionCommandMenu{Choices: []SessionCommandChoice{{Label: "Read only", Reversible: true}}})
if menu.Choices[0].Reversible || menu.Choices[0].Action {
t.Fatal("browse-only metadata became an action")
}
}
26 changes: 26 additions & 0 deletions internal/confirmation/policy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Package confirmation owns launch-scoped UI confirmation policy. Skipping a
// second click never authorises an action or bypasses backend validation.
package confirmation

type Action uint8

const (
Guarded Action = iota // Unknown actions fail closed by default.
Reversible
QuotaReset
)

type Policy struct {
NoConfirm bool
}

func (p Policy) Required(action Action) bool {
return action == QuotaReset || !p.NoConfirm && action != Reversible
}

func Command(reversible bool) Action {
if reversible {
return Reversible
}
return Guarded
}
23 changes: 23 additions & 0 deletions internal/confirmation/policy_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package confirmation

import "testing"

func TestPolicy(t *testing.T) {
for _, tc := range []struct {
noConfirm bool
action Action
want bool
}{
{false, Guarded, true}, {false, Reversible, false},
{false, QuotaReset, true}, {false, Action(99), true},
{true, Guarded, false}, {true, Reversible, false},
{true, QuotaReset, true}, {true, Action(99), false},
} {
if (Policy{NoConfirm: tc.noConfirm}).Required(tc.action) != tc.want {
t.Fatal("wrong confirmation policy", tc)
}
}
if Command(false) != Guarded || Command(true) != Reversible {
t.Fatal("unknown command must remain guarded")
}
}
9 changes: 9 additions & 0 deletions internal/ui/confirmations.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package ui

import "github.com/merefield/codexometer/internal/confirmation"

// SetNoConfirm applies only to this launch, never to saved display preferences.
// Quota-reset redemption remains guarded regardless of this setting.
func (m *Model) SetNoConfirm(value bool) {
m.confirmations = confirmation.Policy{NoConfirm: value}
}
Loading
Loading