Skip to content

chore(release): v0.2.0 — chat-first harness, mobile-ready core - #51

Merged
ajianaz merged 35 commits into
mainfrom
develop
Aug 28, 2026
Merged

ajianaz merged 35 commits into
mainfrom
develop

Conversation

@ajianaz

@ajianaz ajianaz commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

What

Releases v0.2.0 to main: the completed v1.1 roadmap (chat, system prompt, session UX, dynamic tools, uteke first-class) plus the mobile/embedder profile (shell-tools gate, dead-dep cleanup) and the first CHANGELOG.

Why

GitFlow release promotion (develop → main → tag), mirroring the uteke release pipeline: tags must point at commits on main. The current v0.2.0 tag was cut from develop — this PR puts main at the release commit so the tag can be re-pointed correctly.

Testing

All changes individually PR-reviewed and CI-green on develop (PRs #32–#50); 138/138 tests; soak-validated; tole-core v0.2.0 already published to crates.io from this tree (verified live on the registry).

ajianaz and others added 30 commits August 26, 2026 10:47
All repo documentation must be English per language standard
(codecora-ops refs/language-standard.md). Content and structure
unchanged - translation only.
Follow the pattern proven by Claude Code, Codex (rollout files), and
pi: one append-only JSONL file per session as the default backend.
The file is a replay recipe - open replays lines into in-memory maps,
all queries run in RAM. Torn final line is discarded whole; compaction
via temp file + atomic rename is optional.

SQLite remains an optional feature-gated backend behind the same
Storage trait for query-heavy consumers. Updated PRD (FR-D1), E1
epic, W1 sprint plan, and architecture diagrams accordingly.
- Effect sandwich / sequence diagram: replace BEGIN IMMEDIATE with
  atomic JSONL array-line commits
- Test tier A: torn-line discard + format version check instead of
  migrate-on-open SQL specifics
- FR-S2: restore via session file replay, not SQLite
- Fix duplicate 'kind' key in JSONL example (cora review finding)
* ci: align CI jobs, cora-review workflow, PR template, and dependabot with org standard

* style: cargo fmt

* ci: add CLA check workflow and CODE_OF_CONDUCT for open-source readiness

* fix(ci): pass PR author via env in cla-check to prevent script injection

* ci: adopt full workflow suite from org standard (pr-checks, source-branch-check, security, project-sync)

* fix(ci): clean audit ignores, avoid echoing untrusted PR title

* fix(ci): distinguish CLA fetch failure from genuinely unsigned contributor

* fix(ci): restore PR_AUTHOR env on comment step, validate signatures JSON

* fix(ci): restore PR_AUTHOR env on fail step

* fix(ci): use GraphQL variables instead of string interpolation in project-sync

* fix(ci): remove empty duplicate env key in cla-check

* fix(ci): robust CLA fetch chain, pass event fields via env in project-sync

* fix(ci): merge duplicate env block, remove .cora local artifacts from repo

---------

Co-authored-by: ajianaz <[email protected]>
* feat(core): JSONL session storage layer (E1)

Implement the durable storage foundation per docs/architecture.md:

- entry.rs: write-once tree entries with EntryType taxonomy
- register.rs: namespaced mutable cells (lane/op/pending/fact)
- state.rs: operation state machine (pc + seq CAS token)
- storage.rs: Storage trait + JsonlStorage backend
  * one file per session, replay-on-open recipe format
  * strictly increasing global seq across all record kinds
  * atomic commit: validate-all-then-append single line
  * torn final line discarded whole (crash mid-append safe)
  * newer storageVersion = hard error, older replays cleanly
  * compaction rewrites header + live records, seq preserved
  * stale transition (CAS mismatch) rejected, never overwritten

11 integration tests cover all E1 acceptance criteria incl.
roundtrip, compact, torn-tail, stale CAS, invalid commits,
intra-commit parent chaining, and seq monotonicity.

* fix(core): fsync committed lines and compact rename for crash durability

Address cora review MAJOR: compact() renamed temp file over the
live path without fsync, risking data loss on crash. Now:
- append_line fsyncs after every commit line (committed records
  never lost; torn tail still discarded whole on open)
- compact: write temp -> fsync -> rename -> fsync parent dir
  (POSIX; no-op on non-Unix targets)

* style: satisfy clippy len-zero lint in sync_dir

* fix(core): track committed usage rows in memory and expose usages()

CodeCora finding: commit() serialized usage records into the commit
line but never pushed them to the in-memory list. Consequence:
compact() rewrites the file from that list, silently dropping every
usage row committed since open. Regression test now asserts usage
rows survive compact and reopen.

Also add Storage::usages() accessor (was missing from the trait).

* fix(core): physically truncate torn tail on open before appending

CodeCora finding (valid): open() replayed around a torn final line
but left the partial bytes on disk. The append handle then wrote the
next commit line directly onto the fragment, permanently corrupting
the file (the merged line is no longer the final line, so the next
open fails with a hard Corrupt error).

open() now tracks the end of the last complete line and truncates +
fsyncs the torn bytes away before the writer is ever used. The
torn-tail test now commits after reopening a torn file and reopens
again to prove the file stays valid.

* fix(core): count blank lines in good_bytes to prevent bad truncation

CodeCora finding (valid): the replay loop's 'continue' for blank
lines skipped the good_bytes increment, so a stray blank line made
open() believe the file had a torn tail and truncate away the last
valid commits — silent data loss.

good_bytes now advances immediately after each complete physical
line is read, before any skip logic. Regression test opens a file
with an injected blank line and asserts both entries survive a
double reopen.

---------

Co-authored-by: ajianaz <[email protected]>
#15)

Consolidates dependabot PRs #11, #12, #13 into a single update that
passes repo governance (CLA, branch naming, PR template):
- actions/checkout v4 -> v7 (all workflows)
- actions/github-script v7 -> v9 (cla-check)
- rusqlite 0.32 -> 0.40 (workspace dep, not yet used in code)

Full workspace test + clippy verified locally.

Co-authored-by: ajianaz <[email protected]>
* feat(core): enforce state machine legality and effect sandwich (E2)

- state.rs: explicit legal transition table (can_transition) per
  architecture §5; illegal moves are errors, never panics
- storage.rs: commit() validates CAS + legality before writing a single
  byte; replay enforces the same table (tampered logs rejected at open)
- Record::State gains a 'snapshot' flag: compact() writes a materialized
  state record, not an illegal transition; backward compatible (serde
  default)
- machine.rs (new): effect sandwich driver — begin (intent + pending
  cell + pc→Executing, one atomic commit) / settle_ok / settle_err /
  finish, with ReplaySafety contracts (idempotent/guarded/never)
  persisted in the intent payload
- Deterministic resume: reads only the durable pending cell, resolves to
  Clean / ReExecute / Fail
- 8 new tests incl. crash-at-each-sandwich-point determinism proof:
  resumed durable state == no-crash reference run

* fix(core): guard effect sandwich invariants

Addresses cora review round 2 (both findings valid):
- begin() refuses when the pending cell is already set (one sandwich at
  a time; the cell is the crash sentinel and must never be overwritten)
- settle_ok/settle_err verify the handle matches the pending cell's
  intentId before settling (catches wrong-handle and double-settle)
- new StorageError::Effect variant for sandwich invariant violations
- 3 regression tests: double-begin, wrong-handle settle, double-settle

---------

Co-authored-by: ajianaz <[email protected]>
…E3) (#17)

* feat(core): provider trait, mock provider, tool registry, turn loop (E3)

- Provider trait: single-step Final | ToolCall over replayed transcript
- MockProvider: scripted + always modes, deterministic, no network (Tier A)
- Tool trait + Risk (ReadOnly/Write/Destructive) + ToolRegistry
- run_turn(): single-threaded loop Idle→Planning→(sandwich)*→Final
  - MAX_STEPS=32 loop guard (BudgetExhausted is durable)
  - Write/Destructive → ApprovalRequired (gate lands in E6)
  - tool error → settle_err → replan (no panic, §10)
  - provider error → ProviderFailed, session stays consistent
- Tier A tests: 12 new (36 total), all green in <0.5s, no network

Closes #3

* fix(core): enforce run_turn precondition and durable budget-exhausted record

Addresses CodeCora findings on PR #17:
- run_turn now checks pc == Idle and refuses with Invalid otherwise
  (previously documented but not enforced — double-drive protection)
- BudgetExhausted now writes a durable error entry so the loop-guard
  trip is visible to replay (pc stays parked in Planning for the host)

* fix(core): attach budget-exhausted entry to the turn's user message

Local cora review flagged the root-level error entry as breaking the
entry chain. The budget-exhausted record now attaches to the turn's
user message — the chain stays connected and replay can attribute the
loop-guard trip to the originating turn.

* fix(core): durable error records for ProviderFailed and BudgetExhausted

ProviderFailed now appends the same durable ERROR entry as
BudgetExhausted (append_turn_error helper), so both abort paths leave
a replay-visible record attached to the turn's user message. Also
addresses the local cora finding about the entry chain by attaching to
the user message instead of a dangling root.

* fix(core): durable error records for UnknownTool and ApprovalRequired

Both abort paths now append the same replay-visible ERROR entry
(append_turn_error) so every way a turn stops mid-Planning leaves a
durable trace. Regression test covers both paths.

---------

Co-authored-by: ajianaz <[email protected]>
…ch tool (E4) (#18)

* feat(core): approval gate, OpenAI-compatible provider, cora_search tool (E4)

- AllowlistApprover + Decision/Verdict types; ToolRegistry refuses
  Write/Destructive registration unless an approver is wired in
- turn loop consults the approver before executing non-ReadOnly tools
- OpenAiProvider (ureq 3, sync): env-resolved config (CORAGENT_*),
  scrubbed errors, structurally-leak-proof Display
- CoraSearchTool: ReadOnly hybrid search via 'cora brain --json'
- 47/47 tests green (9 unit + 38 integration), clippy clean

* fix(core): real transcript flattening and subprocess timeout

- request_body now flattens actual message entries (role/text) instead
  of sending a placeholder; non-message kinds and unknown roles are
  filtered out
- cora_search subprocess wrapped in run_with_timeout: poll + kill after
  30s ceiling so a hung 'cora brain' can no longer freeze the turn loop
- regression tests: timeout kills 'sleep 30' in <5s, fast commands pass
  through, flattening preserves order and filters odd kinds/roles

* fix(core): drain subprocess pipes on reader threads, optional system prompt

- run_with_timeout now takes ownership of stdout/stderr pipes and drains
  them on dedicated threads; a child writing >64KB can no longer block
  on a full pipe and trigger a bogus timeout
- system prompt becomes an explicit provider option (with_system_prompt),
  prepended as the first message; default is absent, never invented

---------

Co-authored-by: ajianaz <[email protected]>
)

* feat(core): e2e crash-resume proof with golden-file comparison

- Layer 1: deterministic cut points — truncate reference JSONL to
  header+k lines (faithful crash state, one fsynced line per commit),
  reopen, resume, compare golden content for every k in 0..=10.
- Layer 2: real SIGKILL — child process parks inside the effect window
  (intent durable, settlement not), parent kills it and resumes the
  same session file; recovered content equals the reference.
- resume_turn: new public API for crash recovery; handles pc=ToolCall
  without pending intent (crash window) by legal replan.
- state: (ToolCall, Planning) added to the transition table — decision
  not yet durable means replanning is the only honest exit.
- Golden compare canonicalises wall-clock timestamps only; ids, seqs,
  kinds, payloads must match exactly.

* fix(core): enforce guarded replay contract on resume re-execution

Pre-commit cora review caught a MAJOR: Resume::ReExecute ignored the
intent's recorded safety contract, so a Guarded (Write/Destructive)
effect could double-fire when a crash landed before the effect ran
(the intent was durable but the side effect had not happened yet).

resume_turn now gates Guarded intents behind a fresh approval:
- unregistered tool -> durable UnknownTool abort (wiring changed)
- non-ReadOnly risk without a resolvable gate -> durable
  ApprovalRequired abort; the pending cell survives so the host may
  re-approve and resume again
- ReadOnly tools replay freely (guard is trivially satisfied)

Regression test: a Guarded bomb tool that panics if replayed must
surface ApprovalRequired, and the pending cell must remain set.

---------

Co-authored-by: ajianaz <[email protected]>
New name, same engine. Tole = Javanese for 'boy/son' — the dependable
helper you task with getting things done. Also reads as TOlong +
LEngkapi: the user asks for help completing a request, Tole completes
it.

- crates: cora-agent-core -> tole-core, cora-agent-cli -> tole-cli
- all crate names, package names, and import paths updated
- references to the cora-code review tool (a separate product:
  cora search / cora brain) are intentionally kept

Zero breaking: nothing published, no tags cut.

Co-authored-by: ajianaz <[email protected]>
…ctive CLI (#21)

Core:
- Add `Approver` trait (decide per tool/risk/input, interactive marker)
- `AllowlistApprover`: glob patterns, always Deny for Destructive
- `ToolRegistry`: holds `Box<dyn Approver>`; refuses Destructive
  registration behind a non-interactive approver (structural rule)
- `Tool::describe()` for human-readable approval prompts
- `Risk::as_str` public for prompt labels

CLI:
- clap host: run/resume/status subcommands, --sessions-dir
- `InteractiveApprover` (y/N over stdio, injectable PromptFn):
  Destructive always prompts; --allow glob and --yes cover Write only
- `write_file` tool (Write risk) jailed to cwd: per-component parent
  walk refusing symlinks, O_NOFOLLOW leaf open via libc (TOCTOU-safe)

Tests: 77 passing (6 new approval-flow e2e over the real turn loop:
denied/allowed/pattern-skip/destructive-always-prompts/registry-
refusal/prompt-fields), clippy clean

Co-authored-by: ajianaz <[email protected]>
- E10: fingerprint consecutive identical tool calls (name + canonical
  JSON input); trip at LOOP_TRIP_AFTER=3 with durable error entry and
  TurnOutcome::LoopDetected. Budget test updated to use distinct inputs
  so it exercises the ceiling, not the guard.
- E11: scrub() now also applied to message text in request_body — the
  API key never leaves the machine in cleartext; durable log untouched.
- CLI: report LoopDetected with resume hint (exit code 7).

Closes #22, closes #23

Co-authored-by: ajianaz <[email protected]>
* feat(core): E7 tools — uteke_search, read_file, gh

- uteke_search (ReadOnly): semantic memory recall via uteke CLI
- read_file (ReadOnly): jailed file read, symlink-escape proof, 1 MiB cap
- gh (Write, approval-gated): whitelisted ops only (issue_comment,
  issue_create, pr_create), fixed --repo, injectable binary for tests
- refactor: shared subprocess module (run_with_timeout + 30s ceiling)
  replaces the copy inside cora_search
- wiring: all tools registered in tole-cli build_registry

Closes #7

* fix(gh): reject argument injection in whitelisted ops

CodeCora PR review flagged that number/base/title were passed to gh as
arbitrary non-empty strings; a leading-dash value could inject flags and
redirect the fixed --repo. Now:
- number: ASCII digits only
- base: branch charset [A-Za-z0-9._/-], no leading dash
- title: no leading dash
- body: payload of --body (clap consumes it as a value); audit string
  still quotes anything dash-led

Adds rejects_argument_injection test.

---------

Co-authored-by: ajianaz <[email protected]>
* feat(core): E4.5 real provider tool-calling

- Tool::spec() supplies JSON Schema parameters per tool; registry
  serializes specs() into the OpenAI tools array (sorted, deterministic)
- OpenAiProvider: with_tool_specs(), ChatRequest.tools, ChatMessage
  tool_calls/tool_call_id, response parsing emits ProviderOutput::ToolCall
- flatten transcript: Intent entries become assistant tool_calls messages,
  ToolResult entries become tool-role messages with tool_call_id
- specs for cora_search, uteke_search, read_file, gh (validated live:
  model now sends correct arguments)
- CLI wires registry.specs() into provider for run and resume

Closes #27

* fix(core): scrub tool results on wire, surface malformed tool arguments

- tool_result/error content now passes through scrub() before the wire,
  extending E11 redaction to tool outputs that may echo the API key
- malformed tool_calls arguments are surfaced to the model as a
  parse-error result instead of silently running with {}

* fix(core): never execute tools on malformed arguments

- new ProviderOutput::InvalidToolArgs variant: parse failures in
  tool_calls.arguments no longer produce a synthetic ToolCall input
- turn loop records the intent and settles it as an error sandwich
  WITHOUT executing the tool — the model sees the parse error and
  can retry with well-formed JSON

* fix(core): skip turn-level errors when flattening to wire

Turn-level errors (budget exhausted, invalid tool arguments) have no
parent intent; emitting them as tool messages with a null tool_call_id
makes the OpenAI API reject the next request with 400.

---------

Co-authored-by: ajianaz <[email protected]>
- .cora.yaml modeled on the org standard (uteke): focus areas,
  Tole-specific rules encoding intentional patterns (env-resolved
  credentials, argv-validated subprocess tools, wire-only redaction,
  loop-guard budget), ignore rules for known FP categories
- CONTRIBUTING.md: document the three-level cora workflow (pre-commit
  hook, manual scan, CI check) with exit-code reference

Closes #29

Co-authored-by: ajianaz <[email protected]>
#32)

* feat(tools): edit_file + delete_file — full CRUD file capability (E12)

read_file now returns a 16-hex content hash; edit_file requires quoting
it (hashline anchoring): stale anchors are refused before any mutation,
with a re-read recovery instruction. old_text->new_text exact-match
replacement (1 match required; 0/2+ are actionable errors). Atomic
temp+rename write. delete_file is Destructive risk: interactive
approver only, prompts every call, --yes/allowlists never apply.

Live smoke (Bifrost/GLM): read->edit(hash quoted)->create->delete all
verified via durable log + on-disk state. Loop guard correctly tripped
on degenerate empty write_file calls.

Closes #24, closes #31

* fix(tools): self-heal stale edit temps + cora ignore rule for SQL-injection FP

CodeCora review on PR #32 caught a real bug: atomic_write's create_new
refuses to overwrite a stale .tole-edit-{pid}.tmp left by a crashed
attempt, bricking edit_file for the session. Now: on AlreadyExists the
stale temp is removed once and the open retried; write/rename failures
also clean the temp. Regression test included.

Also adds 'SQL injection via string concatenation' to .cora.yaml ignore
rules — the scanner flags format! error strings in file_tools.rs which
contains no SQL (pure fs + json! tool). Same FP was dismissed locally
(findings #1211-1213).

---------

Co-authored-by: ajianaz <[email protected]>
Agent-made change: tole session s-1a0419d5d57-13aaf4 executed the full
loop read_file (hash 2fa04d023a98c53b) -> edit_file hash-anchored
(hash quoted from read) -> read_file verify (8943e9ff28371ed5) with
zero wrong-file or stale-context errors. Only the status line changed.

Intervention log (E8 acceptance criteria):
1. gh issue comment denied by token scope (GITHUB_TOKEN env override)
   - fixed by maintainer posting the agent's comment verbatim.

Closes #33

Co-authored-by: ajianaz <[email protected]>
Gate passed: issue #33 -> PR #34 merged via agent-executed edit chain.
Retro captures what worked (hash anchoring, risk gates, durable resume)
and the Phase 3 backlog (read-only gh ops, git tool, token-scope fix,
scoped pre-auth for headless runs).

Co-authored-by: ajianaz <[email protected]>
from_env now tries CORAGENT_* then OPENAI_* as complete triples; the
first prefix whose full triple (BASE_URL/MODEL/API_KEY) is present
wins. Prefixes are never mixed — a half-configured environment cannot
silently blend two sources. Whitespace-only values count as absent.

This removes the manual env mapping step that broke the first E8 run
attempt (binary rejected an OPENAI_*-only environment).

Validated live: OPENAI_*-only env, tole run completed a read_file turn
against the real provider. 112/112 tests, clippy clean.

Housekeeping: preserve the E8 run log as docs/e8-session-log.jsonl
(E8 'documented run' artifact, verified secret-free) and gitignore
.tole/ so future runs never leak session files into commits.

Co-authored-by: ajianaz <[email protected]>
…I_* fallback) (#37)

The project is named tole; the env contract should say so.
Resolution order: TOLE_* > CORAGENT_* (pre-rename legacy) > OPENAI_*,
complete-triple semantics unchanged (no blending, whitespace = absent).

- ENV_BASE_URL/MODEL/API_KEY now point at TOLE_* (constant consumers
  updated: e2e test message fixed in the same pass)
- unit tests extended: TOLE priority over legacy, half-set TOLE falls
  back to CORAGENT whole-triple
- CLI error message and .cora.yaml doc rule updated

Validated live: TOLE_*-only env and CORAGENT_*-only env each completed
a real provider turn. 112/112 tests, clippy clean.

Co-authored-by: ajianaz <[email protected]>
Nothing is released yet — no compatibility surface to protect. The
pre-rename CORAGENT_* prefix is removed entirely; resolution is now
TOLE_* (canonical) > OPENAI_* (standard fallback), complete-triple
semantics unchanged.

Docs, CLI error message, .cora.yaml rule, and the env-snapshot test
list updated in the same pass. Grep-clean: zero CORAGENT references
remain in the tree.

Validated live: CORAGENT_*-only env is now rejected with the new
guidance message; TOLE_*-only env completes a real provider turn.
112/112 tests, clippy clean.

Co-authored-by: ajianaz <[email protected]>
The agent can now read GitHub state itself; mission prompts no longer
need to embed issue bodies. Whitelisted read ops, same argv validation
discipline as the write ops:

- issue_view NUMBER: --json number,title,body,state,url,labels,
  createdAt,closedAt
- issue_list: --json number,title,state,url,updatedAt, optional
  state=open|closed|all (whitelisted) and limit (digits, 1..=200)
- pr_view NUMBER: --json number,title,body,state,url,baseRefName,
  headRefName,mergeable,statusCheckRollup

All free-form inputs (number/state/limit) validated before spawn;
repo stays fixed at registration. Tool remains Risk::Write as a whole
(per-op risk would need a trait change — noted for later); the
approval prompt shows the exact read command anyway.

Live validation: agent session read real issue #33 via issue_view and
answered title + content correctly. 114/114 tests, clippy clean.

Co-authored-by: ajianaz <[email protected]>
… B chat) (#40)

PRD: add §0 Identity — tole is a durable conversational harness
(personal-assistant chatbot + tool calling + resumable sessions),
coding-lite via tools, uteke/cora as optional first-class integrations,
dynamic tools via generic run_command (TOML DSL rejected). Validation
workflow statuses updated (W1/W2 validated, W3 targeted by Track B).

Epics: rewritten around Track A (A1 scoped pre-auth, A2 git tool) and
Track B (B1 chat mode keystone, B2 system prompt, B3 session UX,
B4 run_command + probing + uteke first-class). Track C (E9 hardening)
deferred. Execution order A1→A2→B1→B2→B3→B4.

Co-authored-by: ajianaz <[email protected]>
* feat(tools): git tool — status/diff/add/commit (A2)

Light git for the coding-lite loop; closes the last manual-intervention
gap short of push (push stays human by design). Same argv-whitelist
discipline as gh.rs: op enum (status|diff|add|commit), validated fields
(paths no leading dash + -- separator, message <=500 chars, no free-form
flags), refusal before spawn. git add ['.'] is the sanctioned catch-all.

Git subprocesses get their own 120s budget (vs 30s generic): hosts
commonly install pre-commit hooks (this host's global template runs
cora review, an LLM call) — the generic ceiling killed legitimate
commits in live validation.

Live validation (sandbox repo, real provider): agent ran status ->
read_file (hash quoted) -> hash-anchored edit_file -> git add . ->
git commit (hook passed) -> status verify; commit 3b23e28 landed.
121/121 tests (+7 git), clippy clean.

* fix(tools): git add path jail — reject absolute paths and .. traversal

CodeCora caught a real gap on PR #41: the comment claimed jail-side
validation that didn't exist. A path like ../other/file (or an absolute
path) would be staged by git when the repo root sits above the workdir
(monorepo subdirectory case). Lexical rejection before spawn: no
leading / or \, no '..' path component anywhere. 5 new injection tests.
122/122 tests.

---------

Co-authored-by: ajianaz <[email protected]>
* feat(cli): tole chat — durable multi-turn REPL (B1 keystone)

Core: state machine gains the (Final, Planning) re-open transition —
a delivered answer re-opens when the next user message arrives; the
tree stays append-only. run_turn now accepts pc Idle|Final as turn
boundaries (mid-flight states still refused — resolve via resume).

Host: 'tole chat' — one durable session, many turns. REPL loop with
state-aware dispatch: boundary starts a new turn; any mid-flight state
(denial / provider failure / loop guard / budget) is resolved via
resume_turn on the next message, so a failed turn never wedges the
conversation. /exit /quit /status commands; --resume <id> and --last
(most recently modified session); Ctrl-D/EOF clean exit — every commit
was already durable, so a killed chat resumes losslessly.

Live validation (real provider): 3-turn chat with mid-conversation
read_file tool call; cross-process --resume recalled context from the
prior process (codeword test); --last picked the newest session
(entries 10 -> 14). 123/123 tests, clippy clean.

* fix(cli): chat mid-flight resolve never drops user input

CodeCora caught a real UX bug on PR #42: when resume_turn surfaced a
non-Final outcome (re-denial, provider still down), the freshly typed
message was silently discarded. Now the dispatch loop keeps resolving
(bounded: 2 retries per message) until the session lands on a turn
boundary, and only then runs the user's message — input is never
dropped, and a wedged session surfaces its state instead of spinning.

---------

Co-authored-by: ajianaz <[email protected]>
…2) (#43)

Storage: header line gains an optional systemPrompt field (serde default
+ skip-if-absent, so pre-B2 files replay unchanged — verified by test).
create_with pins it at creation; open() re-loads it; compact() carries
it through rewrites. Storage trait exposes system_prompt().

Host: --system flag on run and chat (highest priority) > TOLE_SYSTEM_PROMPT
env > none. Fresh sessions pin the resolved value in the header; resume
paths (tole resume, tole chat --resume/--last) re-apply exactly the
header-pinned prompt — never the ambient env, which may have changed
since the session was created.

Live validation (real provider): pirate persona via --system applied
and held; systemPrompt present in the JSONL header; a resumed process
without the flag stayed in character (header-sourced).

Also: corrects the mid-flight comment from PR #42 (the exhausted-retries
path surfaces status but does not auto-queue the typed message — the
user retypes; comment now says exactly that).

Co-authored-by: ajianaz <[email protected]>
New 'tole sessions': one line per session in the dir, newest first —
id, pc, seq, turns (user messages), mtime (UTC, no chrono: civil-from-
days). Unreadable files are skipped, not fatal — the listing always
renders.

Enriched 'tole status': turns, system-pinned indicator, and usage
totals (prompt/completion tokens + cost from usage records). Fixed
negative-zero cost display ('-0.0000' -> '0.0000') — a sum of zero
records must not look like a negative cost.

Live validated against the B2 smoke sessions (list + status output
verified).

Co-authored-by: ajianaz <[email protected]>
ajianaz and others added 5 commits August 28, 2026 06:52
#45)

* feat(tools): run_command + uteke first-class + startup probing (B4/B5)

run_command (B4): generic dynamic tool, owner-approved design. Input
command line is split to argv with a shlex-compatible subset (single/
double quotes, backslash escapes) — NO shell, so pipes/&&/redirects are
literal characters. Runs cwd-jailed to the session dir with the hard
subprocess timeout. Risk ceiling is structurally Write. The approval
prompt shows the exact argv: what you approve is what runs. 9 tests
incl. jail cwd + exit-code passthrough + unterminated-quote errors.

uteke first-class (B4): UtekeRecallTool (B5 rename of uteke_search —
the name now matches the verb; gains real room-scoped recall via
'uteke room recall <room> <query>', which the old spec advertised but
never wired) + UtekeDocumentTool (owner's markdown-to-room workflow:
doc create via stdin — no argv length limits, no content in ps output
— then room add-document; slug/room validated against leading-hyphen
argv-flag injection). 11 tests.

Startup probing (B4): binary_available() gates CLI-backed tools; a
missing uteke binary degrades to an explicit warning — no phantom
tools that fail on every call.

Live validation: run_command approved and executed (uname -s → Linux)
via the interactive gate; uteke_recall called room-scoped from the
durable log; the host's broken uteke binary surfaced its error to the
model gracefully and the conversation survived.

* fix(tools): address CodeCora findings on PR #45

1. Pipe deadlock (uteke.rs): doc-create wrote markdown to the child's
   stdin while stdout/stderr sat unread — classic pipe-buffer deadlock
   for large documents or chatty CLIs. New shared helper
   run_with_timeout_stdin: writer thread for stdin, drain threads for
   stdout/stderr, hard timeout. Regression test feeds stdin AND reads
   200KB of output simultaneously.

2. Missing timeout (uteke.rs): doc-create bypassed run_with_timeout —
   a hung uteke would freeze the agent loop forever. Now on the same
   SUBPROCESS_TIMEOUT ceiling as every other invocation.

3. Inconsistent room validation (uteke.rs): UtekeRecallTool passed
   input[room] straight into argv — a model-supplied '--json' would be
   parsed as a CLI flag. Recall now applies the same leading-hyphen +
   charset defense as the document tool. 2 regression tests.

---------

Co-authored-by: ajianaz <[email protected]>
Found during the uteke-mobile integration audit: tole-core declared
tokio (full) and rusqlite (bundled) but imports neither — the core is
synchronous by design (thread-drain subprocess helper, sync ureq,
blocking JSONL IO) and storage is file-based JSONL, not SQLite.

Two benefits: smaller compile graph for any embedder (notably
flutter_rust_bridge/mobile targets where every C-linked dep is a
cross-compile liability), and no phantom 'SQLite storage' signal in
the dep list — Cargo.toml now tells the truth about the crate.

Verified: workspace builds, 138/138 tests, clippy clean.

Co-authored-by: ajianaz <[email protected]>
Phase 0 of the uteke-mobile integration plan: subprocess-backed tools
(run_command, git, gh, cora_search, uteke) move behind the shell-tools
feature, default-on so the CLI host is unchanged. Embedders on
shell-less platforms (Android/iOS via flutter_rust_bridge) build
tole-core with --no-default-features and register their own tool set;
storage/state machine/turn loop/provider remain pure std+serde.

Verified both profiles: default 138/138 tests + clippy clean; mobile
profile (--no-default-features) compiles and passes 85/85 core tests.
tole-cli mirrors the feature so its cfg resolves; documented the
embedder profile in the crate docs.

Co-authored-by: ajianaz <[email protected]>
Version bump 0.1.0 -> 0.2.0 and the first CHANGELOG (Keep a Changelog).
Headlines: tole chat multi-turn REPL with resume; header-pinned system
prompt; sessions/status UX; run_command + uteke first-class tools with
startup probing; shell-tools feature gate for embedders (mobile/FFI
profile); dead-dep cleanup (tokio, rusqlite); corrected crate
description (JSONL storage, not SQLite).

Co-authored-by: ajianaz <[email protected]>
* ci: publish tole-core to crates.io on release

Mirrors the uteke release pipeline: on a published GitHub release (or
manual dispatch), publish tole-core with the org-level
CARGO_REGISTRY_TOKEN secret (now selected for this repo). Idempotent —
crates.io rejects an already-published version, so re-runs are no-ops.

* fix(ci): classify publish failures explicitly instead of swallowing them

CodeCora caught a real flaw on PR #50: continue-on-error made genuine
failures (bad token, compile error) indistinguishable from the
already-published no-op — the workflow always reported success. Now the
step classifies: exit 0 on success AND on an explicit already-published
rejection (matched in the log), exit 1 on anything else. The job
outcome now tells the truth.

---------

Co-authored-by: ajianaz <[email protected]>
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

⚠️ Review could not complete. Cora produced an empty result. Check the workflow logs for errors.


Review powered by cora-code · BYOK · MIT

@ajianaz ajianaz changed the title release: v0.2.0 — chat-first harness, mobile-ready core chore(release): v0.2.0 — chat-first harness, mobile-ready core Aug 28, 2026
@ajianaz
ajianaz merged commit ad9b410 into main Aug 28, 2026
15 of 16 checks passed
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