Commit Graph

414 Commits

Author SHA1 Message Date
alan 2307d45417 Release native chat runtimes on lifecycle changes
Ensure /new and chat close stop native foreground and background work before changing registry state. Preserve transcripts while surfacing release and recovery cleanup failures instead of reporting false success, with focused adapter and server regressions.
2026-11-11 17:11:40 +00:00
alan ef9b279014 Say when a Claude usage limit resets
Run 355 stopped on the 5-hour usage window with the balance wording. The
diagnostic now names the reset time the CLI reports.
2026-11-11 15:24:17 +00:00
alan a3fdecbbcb Keep long Claude stream records valid in the retained evidence
RedactEvidence truncates at 16 KB and appends a line break, which cut long
stream-json records in two. The session export parses that stream, so the
first real Claude stage (run 346) parked on "Session export pending". The
stream is now redacted record by record without truncation.
2026-11-11 10:48:42 +00:00
alan bd07abcde8 Run pipeline stages on Claude Code (harness=claude)
A model stage with harness=claude, provider=anthropic and a Claude model id
runs one claude -p process per visit with the server user's Claude sign-in.
Only the declared tools exist (--tools) and nothing else is approved
(--permission-mode dontAsk); edits are approved only below the run directory
and the stage's artifacts directory. A permissions block, run write paths,
delivery=true and reasoning_effort none/minimal are refused, not widened.

Usage comes from the CLI's final result and counts toward budgets. Failures
are fixed text; billing, quota and rate-limit refusals map to
ErrProviderQuota. The redacted stream is the session export and evidence.
provider-check --harness claude and model overrides are covered.
2026-11-11 10:30:37 +00:00
alan 16643b9f1b Stop a run when the model provider refuses for balance or quota
Ten runs each burned five visits in seconds on "OpenCode agent reported an
execution error": the provider answered HTTP 402 provider.quota and the
classifier read neither field. That refusal is now its own error with fixed
text, is not retried inside the stage, and ends the run instead of
following the error edge.
2026-11-11 10:10:40 +00:00
alan c2b992542b Tell the next stage what failed when an error edge leads onward
A failed visit was recorded on its step only, so a landing gate that sent
the run back to implement gave the implementer nothing about which checks
failed. The diagnostic (bounded) is now the next stage's previous output
and a memory entry.
2026-11-11 00:39:36 +00:00
alan 1b698a1241 Capture committed .env templates instead of skipping them
Every run in this repository reported an incomplete file-change capture
because the tracked .env.example matched the secret-file rules and was
skipped. Committed templates (.example, .sample, .template, .dist) hold
placeholders, so they are captured like any file; real secret files and
protected directories stay excluded.
2026-11-10 17:49:58 +00:00
alan 532ba48927 Run every pipeline run in its own worktree
A fresh run started from a repository's main checkout gets its own
worktree and branch next to the repository, so runs never share a tree
or see the operator's uncommitted work, and several can run at once.
Retries and runs started in a linked worktree keep their directory. A
clean, landed run tree is removed after success; anything else is kept.

The delivery gate commits what the land stage left uncommitted in a run
worktree, and no longer requires the operator's main checkout to be
clean: Git's fast-forward refuses safely when a local change conflicts.
2026-11-10 16:06:40 +00:00
alan 1ad85de1f1 Keep step-up elevation for the signed-in session and stop gating terminals
The proxy forwards an HMAC-derived session id (X-Pipelines-Session) on
/connect and POST /files; the server trusts it only on token-authenticated
requests and keys elevation by it, so reconnects stay elevated up to a 24 h
cap. Terminals rely on their su -l login. The app no longer forgets the
elevation on disconnect and asks again only on a fresh refusal.
2026-11-10 03:00:45 +00:00
alan 50535dc5ea Merge branch 'worktree-agent-a7f96a1eb9a56587d'
# Conflicts:
#	cmd/pipelines-server/main.go
#	internal/server/websocket.go
#	scripts/manage.py
#	scripts/setup-native.py
#	web/serve.mjs
#	web/src/peerRelay.js
2026-11-10 01:25:04 +00:00
alan f11ff8650d Require step-up password confirmation for shells, terminals and file changes
A new elevate request verifies the web sign-in password (scrypt hash, read-only,
rate-limited, constant time) and elevates that connection for 15 minutes.
chat_shell_run/input, rename/move/delete, terminal_open/input and POST /files
(via a per-connection upload token) are refused with code elevation_required
until then.
2026-11-10 01:21:15 +00:00
alan a0f2cfec16 Merge branch 'worktree-agent-ac54c8919e940163a'
# Conflicts:
#	scripts/setup-native.py
2026-11-10 01:07:12 +00:00
alan ad6cdab418 Listen on loopback and tailnet by default; make the plain-HTTP LAN opt-in
The web proxy binds the wildcard and drops connections that are not
loopback or Tailscale at both ends. A LAN listener is opt-in (web.lan) and
refuses sign-in and signed-in pages over plain HTTP unless
web.lan_plain_login is set. Existing installs keep their bind address with
a warning. Without the LAN the mDNS advert carries only the tailnet and
public routes (lan=0).
2026-11-10 01:02:02 +00:00
alan 41e9b10c9d Merge branch 'worktree-agent-a37f45fa108430592'
# Conflicts:
#	internal/server/websocket.go
2026-11-10 01:00:49 +00:00
alan 84f7e33872 Guard the Go server's request boundary: loopback Host, no Origin on /connect, shared token
The server answered any Host, so a DNS-rebinding page reached /connect (101)
and could drive terminals. Every route now refuses a non-loopback Host on a
loopback connection (421), /connect refuses any Origin (403), and a server
started with -token-file requires X-Pipelines-Token (401; /mcp and /healthz
exempt). The CLI/TUI send the token only to loopback URLs.
2026-11-10 00:59:39 +00:00
alan ec5c690bea Split the terminal lifetime tests from the login tests 2026-11-10 00:45:39 +00:00
alan 227c036aa5 Start machine terminals at the su login prompt instead of tmux
A new terminal runs su -l for the server's own account in its PTY, so the
operator types the account password before getting a shell. Opening is
refused when su is missing, the server runs as root, or su opens a shell
without asking. The Pipelines-owned tmux backing, its reattach and its
persisted session names are removed: terminals end with the server and
are listed as ended. A starting server ends leftover pipelines-term_*
sessions on tmux -L pipelines only.
2026-11-10 00:37:11 +00:00
alan f2520a09b8 Keep dismissed shell commands and restore them without a time limit
A dismissed run keeps its command, status, times and output within the
usual history bounds. chat_shell_runs lists dismissed runs apart
(chat_shell_dismissed_runs), chat_shell_run_output still reads them, and
the purge timer and startup purge are gone. Rows an older server purged
are listed with purged set and cannot be restored.
2026-11-09 23:29:25 +00:00
alan 9bbd9e0c9b Merge branch 'worktree-agent-a2791c24c562412e3'
# Conflicts:
#	app/lib/features/chat/conversation/chat_thread_view.dart
#	internal/protocol/message.go
2026-11-09 22:07:45 +00:00
alan acd160b49e Add the app's terminal surface: bottom panel, floating window and full-screen page 2026-11-09 21:42:52 +00:00
alan a5842e6b3b Format terminal manager 2026-11-09 21:30:23 +00:00
alan 277384c864 Add persistent machine terminals with tmux-backed reattach 2026-11-09 21:30:15 +00:00
alan 03123c23fd Dismiss and restore operator shell commands per chat
chat_shell_dismiss hides finished runs from every readback and pushes a
dismissal frame to every watcher; chat_shell_restore undoes it within a
30 s window, after which the command, output and error are purged and only
a tombstone remains, reported by chat_shell_runs for clients that missed
the event.
2026-11-09 21:22:07 +00:00
alan 8f06f12d49 Merge branch 'worktree-agent-a26df8b0059ab1b12' 2026-11-09 20:54:12 +00:00
alan 2332143e5b Fit chat terminals to their output, keep pastes and keys in the terminal
Finished terminals are sized synchronously from their rows at the view's
width (the post-frame fit made the transcript re-anchor forever); blank rows
xterm.dart keeps when rewrapping are dropped; desktop typing uses key events;
the composer leaves Cmd/Ctrl-V to a focused terminal; Ctrl-A reaches the
process. The probe fixture gains coloured terminal runs and an interactive
login. Notes record behaviour, protocol, security and verification.
2026-11-09 20:51:59 +00:00
alan 9246c168ac Add opt-in live thinking-level checks and notes 2026-11-09 20:22:33 +00:00
alan 06001697c8 Add per-chat thinking levels for Codex, Claude Code and OpenCode
Codex: model/list supportedReasoningEfforts per model, turn/start effort,
thread reasoningEffort as the current level. Claude Code: initialize
supportedEffortLevels, apply_flag_settings effortLevel at the next turn
start. OpenCode v2: model variants via the session model endpoint.
chat_effort sets a level; rows and chat_models carry the levels; Codex and
Claude levels persist in operator_sessions.chat_effort and are re-applied
before every turn.
2026-11-09 20:07:41 +00:00
alan 355b722a1d Run chat shell commands in a pseudo-terminal with typed input and resize
Commands start in a PTY (creack/pty; macOS and Linux) of the client's size
with TERM=xterm-256color in their own session. chat_shell_input writes typed
UTF-8 text in order through a bounded queue; chat_shell_resize sets the size.
Output stays the raw terminal stream with byte offsets as sequence numbers,
chat_shell_run_output resumes from an offset, and a plain-text rendering is
persisted for Copy output and Send to agent. Input is never stored or logged.
2026-11-09 19:57:46 +00:00
alan 96b71d122e Merge branch 'worktree-agent-aae8756320b8309f6'
# Conflicts:
#	app/lib/features/chat/conversation/chat_thread_view.dart
#	app/tool/perf/perf_fixture.dart
#	internal/protocol/message.go
#	internal/server/chat_hub.go
2026-11-09 16:56:55 +00:00
alan f3ddd3e1ec Attribute OpenCode code-mode tool calls, keep same-instant shown items in order, and record the chat tools notes 2026-11-09 16:55:28 +00:00
alan 9791f09230 Serve the Pipelines chat tools over a loopback MCP endpoint and register it with Claude Code, Codex and OpenCode chats 2026-11-09 16:34:21 +00:00
alan 7841aa7dea Merge branch 'worktree-agent-a672970b929d7358c'
# Conflicts:
#	internal/pipeline/store.go
#	internal/server/chat_hub.go
2026-11-09 16:21:55 +00:00
alan 0696ab849a Record each chat turn's workspace changes for every harness
Snapshot the chat directory with internal/filediff when a turn starts and
compare it when the turn ends; store changed turns (newest 100 per chat),
push chat_turn_diffs summaries, attach them to chat_messages replies and
serve one turn's patches through chat_turn_diff.
2026-11-09 16:08:35 +00:00
alan e6bc57c901 Run operator shell commands in a chat's directory on the server
chat_shell_run starts $SHELL -lc in the chat session's directory in its own
process group, streams merged output to every watcher of the session, keeps a
1 MiB tail and persists each run; chat_shell_stop interrupts the group and
kills it after a grace period. chat_shell_share queues an ordinary prompt
with the command and a bounded output tail.
2026-11-09 15:55:14 +00:00
alan c61490aeb0 Add rename_path, move_path and delete_path for home files
The chat Files panel needs to rename, move and delete entries. Three
websocket requests, dispatched beside list_directory, operate on one
entry inside the operator's home and reply with path_mutated {path} or
an error frame (does not exist, already exists, is not empty, outside
the home directory, cannot be moved into itself).

The entry's parent folder and the move destination are resolved through
symlinks and must stay inside home; the entry's own symlink is never
followed, so a link is renamed, moved or removed as a link. The home
directory itself, anything outside it and pseudo filesystems are
refused. A folder is deleted only when empty unless recursive is set;
os.RemoveAll unlinks symlinks rather than descending into them.
2026-11-09 01:32:31 +00:00
alan 49f36a9456 Merge branch 'worktree-agent-ab6edc0d99947642f' 2026-11-09 00:11:40 +00:00
alan 929e4cc017 Advertise tailnet and public routes in server discovery
The mDNS record now carries ts= (tailnet IPv4 addresses) and public= (the
installer's HTTPS origin from PIPELINES_WEB_PUBLIC_URL) in TXT, and browse,
the discover_servers RPC and /discovery return every route to a machine as
addresses with kinds lan, tailscale and public. Endpoint stays the LAN route
for older clients. Unsafe ts/public values are dropped.
2026-11-08 23:59:19 +00:00
alan 81460c4a4d Add POST /files to store an uploaded file inside a home folder
The handler reuses the home-path resolution of GET /files, refuses special
filesystems and non-directories, writes with O_EXCL so an existing name is
answered 409 instead of overwritten, enforces the chat upload size limit and
replies with the stored name, path and size.
2026-11-08 23:57:53 +00:00
alan 349428f11d Discover LAN servers and relay authenticated browser peer connections 2026-11-08 21:58:23 +00:00
alan 3fbfb85ace Observe native Claude automations and preserve pending timers 2026-11-08 15:52:22 +00:00
alan 9d3358be47 Expose session-owned chat automation metadata 2026-11-08 15:24:23 +00:00
alan 87a140754c Merge retry of initial recovered stream attachment 2026-11-07 16:43:35 +00:00
alan 6699d10eb8 Retry initial recovered chat stream attachment failures 2026-11-07 16:43:24 +00:00
alan d02bab3e4a Merge startup chat admission recovery gate 2026-11-07 16:41:58 +00:00
alan 692eb181c3 Merge conservative legacy task readback recovery 2026-11-07 16:41:58 +00:00
alan 62406f7fdb Hold external chat admission until live turn recovery completes 2026-11-07 16:41:02 +00:00
alan d0f616babc Keep trimmed legacy host task readback explicitly incomplete 2026-11-07 16:40:44 +00:00
alan d30b99e18e Merge metadata-only startup reattachment and unknown-readback handling 2026-11-07 16:37:01 +00:00
alan 63a89ec99c Retry retained Claude hosts from metadata readback without spawning work 2026-11-07 16:36:48 +00:00
alan d1f7c2141a Merge durable background-only startup recovery 2026-11-07 16:34:30 +00:00