Skip to content

The agent that grows with you

fix(tui): /timestamps persists on a standalone backend and reports a refused write

Teknium90736daf8b76
diff --git a/tests/tui_gateway/test_config_set_display_toggles.py b/tests/tui_gateway/test_config_set_display_toggles.py
index f3dac3e6e35..f0bf9960bac 100644
--- a/tests/tui_gateway/test_config_set_display_toggles.py
+++ b/tests/tui_gateway/test_config_set_display_toggles.py
@@ -33,6 +33,13 @@ def test_a_mirrored_switch_reaches_the_config_file(config_home, key):
assert _set(key, "true")["result"] == {"key": key, "value": True}
assert yaml.safe_load(config_home.read_text())[section][name] is True
+def test_timestamps_persists_display_timestamps(config_home):
+ """Ink's /timestamps on a standalone backend writes the classic CLI's key, not 4002."""
+ assert _set("timestamps", "on")["result"] == {"key": "timestamps", "value": "on"}
+ assert yaml.safe_load(config_home.read_text())["display"]["timestamps"] is True
+ assert _set("timestamps", "off")["result"] == {"key": "timestamps", "value": "off"}
+ assert yaml.safe_load(config_home.read_text())["display"]["timestamps"] is False
+
def test_a_non_boolean_is_refused_rather_than_written(config_home):
answer = _set("display.in_app_tips", "sometimes")
diff --git a/tui_gateway/methods_config_set.py b/tui_gateway/methods_config_set.py
index d691c1d2a81..5ca0a5175a1 100644
--- a/tui_gateway/methods_config_set.py
+++ b/tui_gateway/methods_config_set.py
@@ -411,6 +411,9 @@ def _toggle_setters() -> dict:
"battery": (_word, "display.battery",
{"on": True, "true": True, "yes": True, "off": False, "false": False, "no": False},
lambda: not bool(_display_cfg().get("battery", False)), on_off),
+ # Ink's /timestamps: the classic CLI's display.timestamps (the shared owner's setter too).
+ "timestamps": (_word, "display.timestamps", _BOOL_WORDS,
+ lambda: not bool(_display_cfg().get("timestamps", False)), on_off),
"statusbar": (_word, "display.tui_statusbar", {"on": "top", **{m: m for m in _STATUSBAR_MODES}},
lambda: "top" if _coerce_statusbar(_display_cfg().get("tui_statusbar", "top")) == "off" else "off",
lambda v: v),
@@ -489,7 +492,7 @@ _CONFIG_SETTERS = {
"model": _set_model, "fast": _set_fast, "busy": _set_busy, "verbose": _set_verbose, "focus": _set_focus,
"approval_mode": _set_approval_mode, "approvals.mode": _set_word, "yolo": _set_yolo,
"reasoning": _set_reasoning, "details_mode": _set_word, "thinking_mode": _set_word,
- "density": _set_toggle, "battery": _set_toggle, "theme": _set_word,
+ "density": _set_toggle, "battery": _set_toggle, "timestamps": _set_toggle, "theme": _set_word,
"statusbar": _set_toggle, "mouse": _set_toggle, "indicator": _set_word, "voice.voice_chat_mode": _set_word,
"cwd": _set_cwd, "terminal.cwd": _set_cwd, "workdir": _set_cwd,
"prompt": _set_prompt, "personality": _set_personality, "skin": _set_skin}
diff --git a/ui-tui/src/__tests__/canonicalSlashCommands.test.ts b/ui-tui/src/__tests__/canonicalSlashCommands.test.ts
index 1d637ed0395..2e384623a01 100644
--- a/ui-tui/src/__tests__/canonicalSlashCommands.test.ts
+++ b/ui-tui/src/__tests__/canonicalSlashCommands.test.ts
@@ -443,4 +443,16 @@ it('/timestamps toggles display.timestamps on the owner (config.set) and the tra
expect(notices).toContain('timestamps off')
expect(notices.some(line => /not available/.test(line))).toBe(false)
expect(request.mock.calls.some(([method]) => method === 'slash.exec')).toBe(false)
+
+ // A backend that refuses the write reports it instead of a silent `timestamps on`.
+ request.mockImplementation(async (method: string) => {
+ if (method === 'config.set') {
+ throw new Error('unknown config key: timestamps')
+ }
+
+ return {}
+ })
+ slash('/timestamps on')
+ await flush()
+ expect(sys.mock.calls.map(([text]) => String(text))).toContain('error: unknown config key: timestamps')
})
diff --git a/ui-tui/src/app/slash/commands/core.ts b/ui-tui/src/app/slash/commands/core.ts
index ed0b808d2e4..d75418e04b7 100644
--- a/ui-tui/src/app/slash/commands/core.ts
+++ b/ui-tui/src/app/slash/commands/core.ts
@@ -359,7 +359,10 @@ export const coreCommands: SlashCommand[] = [
patchUiState({ timestamps: next })
ctx.transcript.sys(`timestamps ${next ? 'on' : 'off'}`)
- saveDisplayPref(ctx, 'timestamps', next ? 'on' : 'off')
+ // A refused write would revert on the next config refresh: say so instead of staying quiet.
+ ctx.gateway.gw
+ .request<ConfigSetResponse>('config.set', { key: 'timestamps', value: next ? 'on' : 'off' })
+ .catch(ctx.guardedErr)
}
},