Four places formatted a time with strftime(localtime_r(&tt, &tm)) and
threw the NULL away. When localtime_r cannot represent the value - a
cooldown file can hold anything - tm is untouched and strftime formats
whatever the stack held: the operator read a limit that lifts at
"219250468--1414812756--1414812757", and a NULL deref in the die-hard case.
agent.c, engine.c, session.c and plugins/cli now check the return and fall
back to "?", the answer the foreign plugin already gives for a time it does
not know.
Found by review; the strftime call site is the same shape in all four.
- lcm: the sidebar widget and /status segment show the context, the number of
compactions, messages and bytes of the last cut, and how many old tool
outputs were trimmed. The counters are the compactor's own, not an estimate.
- cost: a provider-reported USD cost (usage.cost/cost_usd) is carried through
sse/openai, the agent and the engine. /cost reports it with the cache share
and splits judged from plain turns; the notes say that an upstream judge is
not visible in the provider's usage. The status plugin and junction prefer
the reported number over list-price arithmetic.
- curses: the running turn's seconds moved from the input line to the status
bar. Notes and errors are transcript rows below the cause, never text in the
input line or the status bar; a failed backend request is a status row and is
retried by the agent. The steer prompt is only "steer> " and what was typed.
- model: /model probe works in the chat. The picker lists the configuration at
once, then asks the endpoint the session is on what it serves and adds those
models, so a router's whole menu is selectable. provider/model selectors now
apply the right provider instead of becoming a model name. The choice is
written to <session>.model and restored when that session is reopened; /new
carries the current model into the new session.
- sidebar: plugin titles are bold and underlined (this curses has no italic
attribute), with a rule between the plugin blocks.
- run/cli: a command timeout is an idle window. Every chunk on stdout or
stderr resets it, and the process is asked with waitpid(WNOHANG) whether it
is still there before the window is extended. A long build that keeps
reporting progress is no longer killed for being long; a silent hang is.
- config: ';' separates settings on one line, so
plugin lcm { keep = 6; tool_trim = 8192 } parses as two keys.
- tests: lcm widget/status counters, one-line config blocks, session model
restore and /model probe, cli idle timeout with a talkative and a silent
command, run output reset, and the UI status/retry rows.
make check: all tests passed.
A kind = cli provider now has a default model and a prefix
(provider = opencode), so -m occli/deepseek-v4.1-flash-free runs
"opencode run --model opencode/deepseek-v4.1-flash-free". {model} in cmd
marks where the model goes, otherwise --model is appended; a model that
already has a '/' is used as it is. sp_cli_command() builds the command for
-m, delegates and the cli plugin's pool fallback. Model names are limited to
letters, digits and ._:/@+- since the command goes through /bin/sh.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- kind = anthropic: the Messages API over curl, OAuth tokens (sk-ant-oat)
as Bearer with the oauth beta, tool_use/tool_result blocks.
- --doctor spends no tokens: it asks /models and the provider's own usage
route (ollama /api/balance, opencode go /v1/usage) instead of a tiny turn;
cli providers are only checked for the program. /usage shows the same
provider figures, cached for a minute.
- endpoint names the API base (https://host/v1); sp_endpoint_url() builds
chat/completions (default), messages, models and usage from it. A full
route is still accepted and cut back to the base.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cli_fallback = claude1, claude0 names cli delegates whose cmd and env=
take over when cli_cmd answers with its limit. The main command is
benched as "cli", a fallback under its own id, on the same bench the
delegation uses (sp_limit_parse, sp_cooldown_until, sp_cooldown_set are
now exported from libsplinter). The session key stays, so claude
resumes the same conversation under the next account. With everyone
benched the turn fails with the first reset, as WAIT_QUOTA ready_at=.
A fallback's env= goes through a 0600 file the shell sources, not a
command line. A delegate's child is benched under the delegate's id
(SPLINTER_CLI_ID), never as "cli".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The cli transport keys the program's own session on SPLINTER_CLI_SESSION
(the splinter session id, plus ':<delegate>' for a delegate child):
claude gets a derived UUID, --session-id first and --resume after, with
one retry when claude disagrees; opencode gets --session ses_<derived>;
other programs can use {session} and {uuid}. Consecutive calls continue
one conversation and hit the provider cache (measured: 17.6k read, 80
written on the second call).
A delegate whose answer is a limit (429, rate/usage/weekly limit, quota)
is benched until the reset it names - claude's "resets 3am
(Europe/Lisbon)" is read through date(1) - in ~/.splinter/cooldown/<id>,
and the task goes to the next delegate that fits. choose() skips benched
delegates, also when one is asked for by name.
run_child now carries the tail of the child's output in its error and
treats a signal as failure; "exited 1" alone hid every limit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
env=NAME=VALUE on a delegate line (repeatable) is set in the child right
before exec and beats what the parent exported, so two delegates can run
the same cli with two accounts. Remotely it goes in front as
`env 'NAME=VALUE'`, quoted like the rest. cli_env = NAME=VALUE does the
same for the main cli transport. A bad name is an error with the line.
Also in this commit, the work in progress from the tree: swarm and
provider state, the provider/scheduler/planner/tmux plugins, the ui test,
whose tmux session name is now per run so parallel runs do not collide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Telegram gateway
- A tool call of the gateway's own turn that needed consent was either denied
(a daemon has no approval stream) or, with ack channels set, waited for an
"ok <id>" that only the blocked gateway could have read. It now asks in the
chat the turn came from, keeps reading while it waits, resolves answers
(also other processes' and 'splinter --ack'), ignores strangers and tells
everything else to wait. The update offset is shared, so nothing is handled
twice. New cfg flag approve_is_channel: such an approve is asked directly.
- send_message wrote its error through err, and half the callers pass NULL: the
first refused message (too long, bad UTF-8) crashed the gateway. It also
missed '"ok": true' by substring; the reply is parsed now.
- tests/test_gateway.sh drives the real daemon against a fake Bot API and a
fake model (tests/fake_telegram.py), with "ok" and with "no". In make check;
.gitignore no longer hides tests/test_*.sh.
Approvals
- A channel was told "Zustimmung <id>" and nothing else: a phone said yes to a
number. The message now names the tool and its arguments (cut at 300 bytes)
and how to answer, and goes to the channel as "$1", never parsed by sh.
Smaller
- ring: an exit that already streamed text is not retried on the next one
(the operator saw a second answer after half of the first); the header now
says what moves the ring - limits and providers that are down.
- cli: the program's stderr went over the curses screen and the error quoted
stdout. stderr goes to a file and into the error; temp paths are quoted;
the BODY_CAP no-op is gone. (That is the "kaputt" make check used to print.)
- memory: memory_key_env became an env var curl never reads, so no request had
a key. It is "Authorization: Token <key>" now, on curl's stdin. Tested.
- docs/CONFIG.md: the real default path, and the seven keys it did not know
(telegram_allow, memory_url, memory_key_env, skills_dir, env_delegates,
exit, delegate) with the line formats, checked against the parser.
- The no-token message named a config key that does not exist.
Left as it is, on purpose: 'read' stays unrestricted (decision); the fsync per
session line stays (durability over latency).
make check: 26 test binaries and the gateway script, green, also under
ASan/UBSan.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pressing Ctrl-C killed the harness. cbreak() leaves ISIG on, so the terminal
driver turned the key into SIGINT and the process died before wgetch() could
return 3 - the 'Ctrl-C cancels' line was a claim, and one keystroke disproved it.
raw() hands every byte to the program.
Cancelling a turn also only took effect between steps, so a request in flight
kept running to completion. The transport used popen(), which returns a stream
and not a process id, so there was nothing to kill. It now forks and execs,
keeps the pid, and both the read loop and the streaming loop poll with a 200 ms
timeout and SIGKILL the child when the turn is cancelled. Measured: Ctrl-C during
a streaming request returns to the prompt in 510 ms and the UI survives.
Temp files no longer use a fixed /tmp path: $TMPDIR, then /var/tmp. Three sites,
including the cli plugin, and they carry the conversation, so the path is now a
512-byte buffer built at runtime instead of a literal.
Four things, three of them reported by the operator.
1. Rows are counted from the real line structure. The old arithmetic
(strlen/cols) assumed one long line; a model's reasoning is full of '\n', so
the true height was far larger than the estimate and the text painted over
the answer below it - 'it just goes anywhere on the screen'. text_rows() and
row_offset() split on newlines first, then wrap. entry_lines() now measures
the string that is actually drawn ('role: text'), which also fixes the last
character of an entry being cut off (a truncated code fence).
2. Tool calls are visible: the agent's tool_begin hook fires before each call,
the UI drains the list under its lock and writes 'werkzeug: run
{"command":"echo a"}' into the transcript; the one at the top of the live
area shows the call while it runs. The reasoning entry is inserted before
those lines, so the transcript reads du, denkt, werkzeug, modell.
3. The chat pane has a black background, and the status line sits between the
pane and the prompt, the way Hermes shows it.
4. i18n is complete: every remaining literal in ui.c, main.c and the plugins
goes through the catalogue, including widget texts and format strings.
sp_td() carries a compiled-in English default, so a missing catalogue can
never drop a printf placeholder. tools/check_i18n.py runs in make check and
fails when a key used in the code is missing from any catalogue, or when a
catalogue key is used nowhere.
Seventeen test binaries green.
First run against a real model (Qwen3.6-35B-A3B on kontron, strata-poly)
exposed two things a stub never would:
- our tool schema sent "properties":{}, which tells the model that no
arguments exist. Tools now carry a real JSON schema (echo/command/clock), and
the loop completes a tool round against the 35B: request 1 -> tool_call,
request 2 -> "Das Ergebnis ist: ping".
- an answer longer than the screen was not drawn at all: the entry did not
'fit', so the viewport skipped it and the chat looked empty. draw_history is
now a real viewport (total height, bottom-anchored, entries taller than the
screen start at the offset that puts their end on screen).
Steering: a turn runs on its own thread while the UI keeps reading keys. Enter
queues text the loop picks up at the next step boundary; Ctrl-C cancels; in a
single-step turn the text becomes the next message instead of disappearing.
Curses remains UI-thread-only. A dangling ag->cfg after the turn made a steer
run twice - the caller's config is now restored, and the session log confirms
one user line per steer.
Transports are plugins now (sp_host_add_transport / --transport). plugins/cli
makes any program the model: SPLINTER_CLI_CMD, run through /bin/sh, prompt on
stdin, stdout as the answer, 4 MiB cap, non-zero exit with the program's stderr,
empty output is an error. Verified with sed, with claude -p (2.9 s, answer OK)
and with cat.
Eleven test binaries green, test_cli included.