Skip to content

refactor(cli): one memory loop for every face (#428, 2/3) - #431

Merged
ajianaz merged 1 commit into
developfrom
refactor/session-memory
Oct 26, 2026
Merged

ajianaz merged 1 commit into
developfrom
refactor/session-memory

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

What

The memory loop's pre-turn recall injection and session remember move into turn_runner, used by every face. Part 2 of 3 of #428.

Why

The CLI (HostConfig::inject_memory / remember) and the session host each had their own copy. The session host's remember dropped its result silently, so a failing store on tole serve / ACP went unnoticed.

Changes

  • turn_runner::with_recalled_memory(memory, prompt): the prompt with the recalled block appended; no memory, nothing recalled, or a failed recall (stderr note, feat(memory): injection hygiene for the uteke integration — bounded, deduped, no silent fallback #384) gives the bare prompt.
  • turn_runner::remember(memory, session_id, first_prompt, last_answer, wrote): best-effort summary, reported on stderr either way; first_prompt is the pre-injection prompt, so recalled memory is never echoed back into the store.
  • main.rs: HostConfig::inject_memory / remember delegate to them.
  • session_host.rs: the first-turn recall and the per-turn remember use them; the first_prompt_done lock is released before the recall subprocess runs.
  • CHANGELOG.

Testing

  • New unit tests with fake uteke binaries: a hit is appended, an empty result and a failing binary both leave the bare prompt; remember stores the pre-injection prompt in the room (--room, --type decision for a write session); no memory is a no-op.
  • cargo fmt, cargo clippy --workspace --all-targets -- -D warnings, bare-profile clippy (none / shell-tools), cargo test --workspace: all green; rebased onto refactor(cli): one session provider for every face (#428, 1/3) #430 and rebuilt.
  • Cora agent-as-reviewer on the exact staged diff: should_block: false, 0 issues (deterministic hits were bug-println on the intended stderr reporting and bug-expect on the existing lock pattern, both ignored by .cora.yaml).

turn_runner::with_recalled_memory (pre-turn recall injection, bare prompt on failure with a stderr note) and turn_runner::remember (best-effort session summary, reported on stderr) replace the copies in HostConfig and the session host. Server-face sessions no longer drop the remember result silently.
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit 4249ca8 into develop Oct 26, 2026
16 checks passed
@ajianaz
ajianaz deleted the refactor/session-memory branch October 26, 2026 09:22
ajianaz added a commit that referenced this pull request Oct 26, 2026
… sibling watcher (#428, 3/3) (#432)

## What

`tole resume` and `tole chat` now run their turns on a session cancel
token with the child-agent sibling watcher attached, like `tole run`.
Part 3 of 3; closes #428.

## Why

Only `tole run` created a cancel token and started the sibling watcher
(#380); `resume` and `chat` called `run_turn` / `resume_turn` without a
token. A child agent driven through `tole chat` or `tole resume`
therefore never received sibling change notices.

## Changes

- `turn_runner::cli_turn_token()`: the session's `CancelToken` plus, in
a child agent, the watcher that queues sibling notices on it (a no-op
outside a child).
- `main.rs`: run uses it (replacing its inline copy); resume and chat
create it once per session and call `run_turn_with_cancel` /
`resume_turn_with_cancel`.
- `sibling_notice_e2e.rs`: the two-child scenario now also runs with
child A on `tole chat` and on `tole resume`. The tests in this file are
serialized because the scenario is timing-based (B's edit must land
inside A's slow step).
- CHANGELOG (Fixed + Changed).

## Testing

- New e2e `a_sibling_edit_reaches_a_child_running_tole_chat` /
`..._tole_resume`: both fail on the previous `main.rs` and pass with
this change; the original `run` scenario still passes.
- `cargo fmt`, `cargo clippy --workspace --all-targets -- -D warnings`,
bare-profile clippy (none / shell-tools), `cargo test --workspace`: all
green; rebased onto #431, rebuilt, lib and sibling tests re-run.
- Cora agent-as-reviewer on the exact diff, judged from
`review_finalize`: `should_block: false`, 0 issues. (`review_prepare`
lists a `crypto/hardcoded-secret` hit on `CancelToken::default()`; it is
a false positive and `.cora.yaml` already ignores it, which `finalize`
applies.)

Co-authored-by: ajianaz <[email protected]>
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