Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

feat(agent-core): checkpoint-v4, the checkpoint request is the harness's, not the user's (#2486)

Call White4948af1885f6
diff --git a/core/agent_core/harness/context.py b/core/agent_core/harness/context.py
index a1788e052..1f0deaada 100644
--- a/core/agent_core/harness/context.py
+++ b/core/agent_core/harness/context.py
@@ -7,8 +7,8 @@ the adapter supplies a ``ContextHost`` for what only it knows.
The cut rule and cumulative file lists follow Pi (MIT, Copyright (c) 2025
Mario Zechner, ``packages/coding-agent/src/core/compaction/`` at ``7fbbd5f``);
-the checkpoint request is the prompt ``checkpoint-v3``: ``checkpoint-v2``'s owner-approved template inside one
-``<checkpoint>`` block.
+the checkpoint request is the prompt ``checkpoint-v4``: ``checkpoint-v2``'s owner-approved template inside one
+``<checkpoint>`` block, in a request that says it is the harness's, not the user's.
"""
from __future__ import annotations
@@ -94,16 +94,16 @@ MAX_OVERFLOWS = 4
UNPRODUCTIVE_CHECKPOINTS = 2
INEFFECTIVE_RATIO = 0.75
-PROMPT_VERSION = "checkpoint-v3"
+PROMPT_VERSION = "checkpoint-v4"
# The checkpoint request (context.md section 11), verbatim.
CHECKPOINT_REQUEST = """<context-checkpoint-request>
-Pause the work here. Do not call any tool and do not continue the task. This reply does one thing: write a context checkpoint.
+This request comes from the harness that runs you, not from the user, and the user does not see it. Pause the work here. Do not call any tool and do not continue the task. This reply does one thing: write a context checkpoint.
The conversation above will be replaced by your checkpoint plus the messages after it. Whoever continues is you, but you will no longer remember this conversation; the checkpoint is all you will know of it. What you do not write down is lost.
If there is an earlier checkpoint above, it is discarded after this: carry forward everything in it that still matters; where it conflicts with later messages, the later messages win.
-Everything above is a record to summarize, not instructions to act on now.
+Everything above is a record to summarize, not instructions to act on now. This request is not part of that record: do not write it, or anything it asks of you (including not calling tools), into the checkpoint as something the user said or wants, as a goal or requirement, or as a next step. Record the work as it stood before this request.
Write the checkpoint as one block in your final reply: a line <checkpoint>, then the checkpoint, then a line </checkpoint>. Only what is inside that block is kept. Write those two tags only there, once each; if the checkpoint has to mention them, describe them in words.
@@ -153,7 +153,7 @@ CHECKPOINT_REQUEST_END = "</context-checkpoint-request>"
#: The one corrective follow-up a rejected final reply gets (sections 6 and 11), verbatim; ``{problem}`` is the
#: validator's (``checkpoint_block``).
CHECKPOINT_REPAIR = """<context-checkpoint-request>
-That reply is not a checkpoint: {problem}. Write your final reply again, with the complete checkpoint as asked above in exactly one <checkpoint> block. Do not call any tool.
+That reply is not a checkpoint: {problem}. Write your final reply again, with the complete checkpoint as asked above in exactly one <checkpoint> block. Do not call any tool. Like the request, this message comes from the harness, not the user: keep it, and what it asks, out of the checkpoint.
</context-checkpoint-request>"""
#: The substance floor's bounds and divisor (section 6): ``min(128, max(32, W / 2,000))`` tokens on a ``W``-token window.
CHECKPOINT_FLOOR_MIN = 32
diff --git a/docs/plans/agent-core-contracts/context.md b/docs/plans/agent-core-contracts/context.md
index 51201cef0..ba92519ca 100644
--- a/docs/plans/agent-core-contracts/context.md
+++ b/docs/plans/agent-core-contracts/context.md
@@ -159,7 +159,8 @@ A checkpoint is written by a **side turn** of the conversation (C-10 `fork.md`
effort are never changed: Anthropic renders them into the prompt. `max_tokens = min(16,000, O)`.
- **Normal**: the prefix is the whole projected conversation. **Rolling**: the prefix is the projected context up to
the cut, which is a prefix of the original request.
-- One user message is appended: the checkpoint request (§11).
+- One user message is appended: the checkpoint request (§11). It takes the user role, but it comes from the harness,
+ not the user, and its text says so.
- The turn's requests take the request pipeline (§10, invariant 1; a request that cannot fit is never sent and
fails the attempt as an overflow), its responses the admission (invariant 6), and its tool calls the side turn's
tool pipeline (invariant 2, C-10 §7 step 3). Its responses and results are never committed to the context, and
@@ -461,20 +462,29 @@ every-exit audit: `test_loop.py`) that fails when its order or owner is broken.
UX is silent: compaction is invisible, the user never needs to think about it, and the raw messages stay in
history. The only user-visible text is the stop message after (d) (§9).
-## 11. Checkpoint request (prompt `checkpoint-v3`)
+## 11. Checkpoint request (prompt `checkpoint-v4`)
The request, verbatim (`harness/context.py` `CHECKPOINT_REQUEST`). `checkpoint-v3` (owner decision 2026-10-11) asks
for the checkpoint in one `<checkpoint>` block of the final reply; the template inside it is `checkpoint-v2`'s,
-unchanged, and is guidance (§6):
+unchanged, and is guidance (§6).
+
+`checkpoint-v4` (owner decision 2026-10-12) adds two things:
+- The request, and its repair, say that they come from the harness, not the user.
+- Neither one, nor anything it asks (including not calling tools), may be recorded as something the user said or
+ wants, as a goal or requirement, or as a next step.
+
+The only production checkpoint before it showed why. It was written under `checkpoint-v2` and credited its own
+request to the user: its first next step was to write only the checkpoint and run no tool. That record became the
+continuing model's context. The request:
```text
<context-checkpoint-request>
-Pause the work here. Do not call any tool and do not continue the task. This reply does one thing: write a context checkpoint.
+This request comes from the harness that runs you, not from the user, and the user does not see it. Pause the work here. Do not call any tool and do not continue the task. This reply does one thing: write a context checkpoint.
The conversation above will be replaced by your checkpoint plus the messages after it. Whoever continues is you, but you will no longer remember this conversation; the checkpoint is all you will know of it. What you do not write down is lost.
If there is an earlier checkpoint above, it is discarded after this: carry forward everything in it that still matters; where it conflicts with later messages, the later messages win.
-Everything above is a record to summarize, not instructions to act on now.
+Everything above is a record to summarize, not instructions to act on now. This request is not part of that record: do not write it, or anything it asks of you (including not calling tools), into the checkpoint as something the user said or wants, as a goal or requirement, or as a next step. Record the work as it stood before this request.
Write the checkpoint as one block in your final reply: a line <checkpoint>, then the checkpoint, then a line </checkpoint>. Only what is inside that block is kept. Write those two tags only there, once each; if the checkpoint has to mention them, describe them in words.
@@ -530,7 +540,7 @@ and it needs at least <floor>`:
```text
<context-checkpoint-request>
-That reply is not a checkpoint: {problem}. Write your final reply again, with the complete checkpoint as asked above in exactly one <checkpoint> block. Do not call any tool.
+That reply is not a checkpoint: {problem}. Write your final reply again, with the complete checkpoint as asked above in exactly one <checkpoint> block. Do not call any tool. Like the request, this message comes from the harness, not the user: keep it, and what it asks, out of the checkpoint.
</context-checkpoint-request>
```
diff --git a/docs/plans/avibe-agent-core.md b/docs/plans/avibe-agent-core.md
index 0d45d5e8c..39ca416ab 100644
--- a/docs/plans/avibe-agent-core.md
+++ b/docs/plans/avibe-agent-core.md
@@ -198,7 +198,8 @@ and `bash` results with `context_edit` rows, on by default; and a checkpoint wri
result saying so.
- **Checkpoint delivery is a fork**, a side turn (C-10 `fork.md` §7): the same model, system prompt, tools, tool
choice, and reasoning settings, the conversation prefix byte-identical, and the three-layer prompt appended
- (`checkpoint-v3`), which asks for the checkpoint in one `<checkpoint>` block of the final reply; a reply without
+ (`checkpoint-v4`), which asks for the checkpoint in one `<checkpoint>` block of the final reply and says it comes
+ from the harness, not the user, so neither it nor what it asks is recorded as the user's; a reply without
exactly one substantial block gets one repair, then fails. The checkpoint turn runs through the same loop under the
"dreaming" policy: `read` allowed, writes only inside the Session's scratch directory, everything else denied; at
most 5 tool rounds, each tool bounded by the room left in the window. Its messages are audit rows, never context.
@@ -363,7 +364,7 @@ breaker, review gates, and close-out follow the `pr-delivery-loop` skill.
| Provider edge cases become permanent maintenance | port tau's fixtures; add cases derived from `pi-ai` for stop reasons, overflow, retry, SSE; one conformance suite per protocol |
| The Model Hub extension lands late and blocks C-2 conformance | the Model Hub lane runs first in P1; the `ai` lane develops against the contract file, not the live gateway |
| A second persistence model creeps back | C-5 forbids one; A10 tests it |
-| Compaction quietly loses user constraints | the template's "User requirements" heading (`checkpoint-v3`); A12 tracked per prompt version |
+| Compaction quietly loses user constraints | the template's "User requirements" heading (`checkpoint-v4`); A12 tracked per prompt version |
| Database growth from inline tool output | output governance bounds each row; the reserved reference form allows moving it out without a schema change |
| Scope creep toward the tension system or interactive terminals | §2 non-goals; §5.4 ships only the shape in v1 |
| Python 3.10 floor versus ported code | port with `TypeAlias`; CI already covers 3.10 |
diff --git a/tests/evals/README.md b/tests/evals/README.md
index 9045785f3..3a91a6bc3 100644
--- a/tests/evals/README.md
+++ b/tests/evals/README.md
@@ -29,6 +29,15 @@ Plan: `docs/plans/avibe-agent-core.md` §6, A12. Script: `a12_compaction_quality
- the last error as the whole line;
- the next step with its action and boundary (add a test in `tests/test_burst.py` for a burst of exactly 5), not
only the file.
+- An eleventh fact checks that the checkpoint request stays out of the user's record. The request comes from the
+ harness, not the user (`context.md` §11, `checkpoint-v4`). The fact reads the text of every checkpoint written
+ before the probe, as stored in its row, and the probe's rules and next step. It fails on any of these:
+ - a no-tools instruction anywhere;
+ - the checkpoint itself (not an earlier one) credited to the user;
+ - the checkpoint listed under the goals, the user requirements, or the next steps.
+
+ The JSON lists every such line under `leaks`. A checkpoint the probe triggers is not read: it may rightly record
+ the probe's own "do not read any file or run any command".
**Valid runs only.** A run is scored only if ground truth (the database rows and the fixture on disk) shows that it
happened as scripted:
@@ -99,6 +108,11 @@ The run makes about ten Turns, plus their checkpoint turns, on the small window.
- The last error is compared ignoring case and wrapping quotes or backticks. The recorded answer is exact.
- `--vibe` is split on whitespace, so a path with spaces needs a link without them. The documented run uses the
default.
+- The leak fact finds the request's marks by keyword. Before the probe, the fixture's user mentions neither
+ checkpoints nor tools, so here such a line is the request's. A checkpoint that writes "this checkpoint" under its
+ next steps fails it.
+- Heading lines only set the section and are not read for leaks, so "## Next steps: write the checkpoint" would pass.
+ The recorded runs' headings contain neither word.
- The model is recorded as requested, not as served. If Model Hub fails over to another hop during a run, the row
would name the requested model. The recorded runs were served by it throughout (every checkpoint's and response's
origin); check the origins in the Session before recording a row.
diff --git a/tests/evals/a12_baselines.md b/tests/evals/a12_baselines.md
index 4117f0bdf..578a03611 100644
--- a/tests/evals/a12_baselines.md
+++ b/tests/evals/a12_baselines.md
@@ -3,14 +3,53 @@
One row per valid run of `a12_compaction_quality.py`, newest first. A prompt change is judged against the last row of
the previous prompt version. The score counts the planted facts the probe's JSON answer still states, each judged on
its own field: three ground rules with their polarity, two changed files with their values and a reason each, the
-CHANGES.md entry, the last error verbatim, and the next step with its action.
+CHANGES.md entry, the last error verbatim, and the next step with its action. One more fact checks that the
+checkpoints written before the probe, and the probe answer, keep the checkpoint request out of the user's record.
| Date (UTC) | Avibe | Prompt | Model (window / output budget) | Checkpoints past the facts (mode: tokens before → after) | Repairs / failed | Score | Missed |
| --- | --- | --- | --- | --- | --- | --- | --- |
-| 2026-10-11 | `de84d3b59` (master), Incus master env | `checkpoint-v3` | claude-haiku-4-5 (32,000 / 4,000) | rolling: 33,528 → 15,563; rolling: 32,686 → 15,800 | 0 / 0 | 10/10 | — |
+| 2026-10-11 | `346d2f35a` (master `aaf018a4b` with this prompt), Incus master env | `checkpoint-v4` | claude-haiku-4-5 (32,000 / 4,000) | rolling: 33,328 → 15,321; rolling: 32,432 → 15,324 | 0 / 0 | 11/11 | — |
+| 2026-10-11 | `de84d3b59` (master), Incus master env | `checkpoint-v3` | claude-haiku-4-5 (32,000 / 4,000) | rolling: 33,528 → 15,563; rolling: 32,686 → 15,800 | 0 / 0 | 10/11 | leak: checkpoint 1's next step |
## Notes
+### 2026-10-11, `checkpoint-v4`
+
+**Run.** Session `seskp94mab5eu`. It was valid by every ground-truth check:
+- every Agent run succeeded;
+- the fixture ended as scripted, with exactly the two CHANGES.md lines;
+- both check outputs were in the tool results, in order;
+- the last planted fact is at context position 23, and both checkpoints summarized past it (to 26 and 30);
+- the probe committed no tool result.
+
+Both checkpoints were model-written under `checkpoint-v4`, each accepted on its first final reply: no repair round,
+no failed checkpoint turn. Three log reads were needed. The run predates the C-9 token-estimate fix
+(`fix/c9-token-estimate`, not merged at run time), which changes when checkpoints fire.
+
+**Checked by hand (README, known limits).**
+- Both check runs were `bash` calls.
+- Both checkpoint turns made no tool round.
+- Every checkpoint and every Turn was served by claude-haiku-4-5.
+
+**The leak, against `checkpoint-v3`.**
+- Neither checkpoint, nor the probe answer, carries the checkpoint request.
+- Each checkpoint's next steps begin with the work in flight, "Provide one-line summary of logs/day1.log" (then
+ day2): the work as it stood before the request.
+- The `checkpoint-v3` row's first checkpoint recorded "(Awaiting user instruction; checkpoint paused before
+ attempting any further work.)" there instead.
+
+**Scoring.** The run scored 10/11 at the time. The next step, "resolve burst window overlap error before writing
+regression test in tests/test_burst.py for burst of exactly 5", missed only because the verb list held "write" and
+not its stem. With "writ", as with "creat", it counts, and the run scores 11/11.
+
+**Observation, not scored.** Both checkpoints listed "Resolve burst window overlap error" before the agreed test.
+That step is the agent's inference from the failing check; the user never asked for it. The probe answer carried it
+forward.
+
+**An earlier `checkpoint-v4` run, not scored.** In `ses6grpy6z3we` the agent rewrote CHANGES.md without its
+"# Changes" heading. The gate took the first line for the heading, dropped the BURST entry, and judged the run
+invalid. The gate now skips only heading lines. That run's checkpoints carried no leak either.
+
### 2026-10-11, `checkpoint-v3`
**Run.** Session `seszkhn28xbgp`. It was valid by every ground-truth check:
@@ -30,8 +69,13 @@ no failed checkpoint turn. Three log reads were needed.
- Every checkpoint and every Turn was served by claude-haiku-4-5.
- The output budget Vibey used is 4,000: the definition's maximum, under a quarter of the window.
-**Scoring.** The run was recorded at 9/9. The scorer then added the CHANGES.md entry as a tenth fact and bound the
-REFILL_RATE reason to refilling, and the same answer re-scores 10/10.
+**Scoring.** The run was recorded at 9/9. The scorer then added two facts:
+- the CHANGES.md entry, which this answer has;
+- the checkpoint request kept out of the user's record (with `checkpoint-v4`), which this run fails. Its first
+ checkpoint's next steps begin "1. (Awaiting user instruction; checkpoint paused before attempting any further
+ work.)".
+
+It also bound the REFILL_RATE reason to refilling. The same run re-scores 10/11.
**Observation, not scored.** Both checkpoints were rolling, after an overflow. Each log read took the context from
under the threshold to past the window in one tool result, so no threshold checkpoint ran first.
diff --git a/tests/evals/a12_compaction_quality.py b/tests/evals/a12_compaction_quality.py
index 28ca84e5f..20163a3a1 100644
--- a/tests/evals/a12_compaction_quality.py
+++ b/tests/evals/a12_compaction_quality.py
@@ -6,6 +6,8 @@ states the user's ground rules, has the agent change two files for stated reason
agree on a next step. Large log reads then push the context over the threshold until at least two checkpoints have
summarized every planted fact. A probe Turn asks, from memory, for the ground rules, the files changed and why, the
last error verbatim, and the next step, as one JSON object. Each field is scored against the facts the script planted.
+One more fact reads the checkpoints written before the probe, and the probe answer, for the checkpoint request recorded
+as the user's: the request comes from the harness (``context.md`` section 11).
A run counts only if ground truth says it happened as scripted: every Agent run succeeded, the fixture on disk ends in
the scripted state, both check outputs are in the Session's tool results in order, at least two checkpoints before the
@@ -126,7 +128,7 @@ def _next_step(answer: dict) -> bool:
step = _text(answer.get("next_step"))
return (
"test_burst.py" in step
- and any(verb in step for verb in ("add", "write", "creat", "implement"))
+ and any(verb in step for verb in ("add", "writ", "creat", "implement"))
and re.search(r"(?<![\d.])5(?!\.?\d)", step) is not None
)
@@ -170,6 +172,53 @@ FACTS = (
)
+#: The checkpoint request's marks (``context.md`` section 11). It comes from the harness, so neither it nor its no-tools
+#: instruction belongs in the record as the user's. The fixture's user mentions neither checkpoints nor tools before the
+#: probe, so a line that carries either is the request's.
+LEAK = "no leak: the checkpoint request is not recorded as the user's"
+_CHECKPOINT = re.compile(r"checkpoint|检查点", re.I)
+_EARLIER = re.compile(
+ r"\b(?:earlier|previous|prior|last|older)\s+(?:context\s+)?checkpoints?\b|(?:上一个|上次|之前的|先前的)\s*(?:checkpoint|检查点)",
+ re.I,
+)
+_CREDITED = re.compile(r"\buser\b|\brequest|\bask|用户|请求|要求", re.I)
+_NO_TOOLS = re.compile(
+ r"\b(?:do not|don't|never|no|not|without)\b[^\n.;]{0,25}\btools?\b|(?:不|禁止|勿|无需)要?(?:执行|调用|使用|运行|用)(?:任何)?工具",
+ re.I,
+)
+_HEADING = re.compile(r"^\s*(?:#+|\*\*)\s*(.*?)[\s*]*$")
+#: The headings under which a line is recorded as the user's or as what to do next.
+_USERS = ("goal", "requirement", "next step")
+
+
+def _names_checkpoint(text: str) -> bool:
+ """Whether ``text`` names a checkpoint other than an earlier one, which a checkpoint may carry forward."""
+ return _CHECKPOINT.search(_EARLIER.sub("", text)) is not None
+
+
+def checkpoint_leaks(checkpoint: str) -> list[str]:
+ """A checkpoint's lines that carry the request: a no-tools instruction anywhere, or the checkpoint itself credited to
+ the user or listed under the goals, the user requirements, or the next steps."""
+ leaks, scoped = [], False
+ for line in checkpoint.splitlines():
+ heading = _HEADING.match(line)
+ if heading:
+ scoped = any(name in heading.group(1).lower() for name in _USERS)
+ elif _NO_TOOLS.search(line) or (_names_checkpoint(line) and (scoped or _CREDITED.search(line))):
+ leaks.append(line.strip())
+ return leaks
+
+
+def answer_leaks(answer: dict) -> list[str]:
+ """The probe answer's rules and next step that carry the request. A rule is judged only on naming the checkpoint:
+ a rule against tools could be the probe's own "answer from memory"."""
+ rules = answer.get("rules")
+ actions = [_text(item.get("action")) for item in rules if isinstance(item, dict)] if isinstance(rules, list) else []
+ step = _text(answer.get("next_step"))
+ leaks = [action for action in actions if _names_checkpoint(action)]
+ return leaks + [step] if _names_checkpoint(step) or _NO_TOOLS.search(step) else leaks
+
+
def parse_answer(text: str) -> Optional[dict]:
"""The probe's JSON object: the outermost braces of the reply, fences and narration around them ignored."""
start, end = text.find("{"), text.rfind("}")
@@ -363,7 +412,12 @@ def fixture_problems(root: Path) -> list[str]:
problems.append("src/rate_limit.py no longer defines allow()")
if not re.search(r"^REFILL_RATE\s*=\s*1\s*$", (root / "src/config.py").read_text(encoding="utf-8"), re.M):
problems.append("src/config.py does not set REFILL_RATE = 1")
- notes = [line.lower() for line in (root / "CHANGES.md").read_text(encoding="utf-8").splitlines()[1:] if line.strip()]
+ # Its entries are every non-blank line but a heading: an agent may rewrite the file without the "# Changes" one.
+ notes = [
+ line.lower()
+ for line in (root / "CHANGES.md").read_text(encoding="utf-8").splitlines()
+ if line.strip() and not line.lstrip().startswith("#")
+ ]
if len(notes) != 2 or not any("burst" in note for note in notes) or not any("refill" in note for note in notes):
problems.append(f"CHANGES.md does not hold exactly the BURST and REFILL_RATE lines: {notes}")
if (root / "vendor/legacy_api.py").read_text(encoding="utf-8") != VENDOR:
@@ -417,6 +471,7 @@ def run(args: argparse.Namespace) -> tuple[dict, bool]:
break
turn(READ_TURN.format(index=index))
before_probe = carried()
+ written = [item.get("checkpoint") or "" for item in rows.compactions(session_id)] # what the leak fact reads
problems = fixture_problems(root)
if not check_outputs_in_order(rows.tool_outputs(session_id)):
problems.append("the Session's tool results lack the two check outputs in order")
@@ -444,7 +499,14 @@ def run(args: argparse.Namespace) -> tuple[dict, bool]:
if versions != [PROMPT_VERSION]:
problems.append(f"the runtime's checkpoints used prompt version(s) {versions}, the checkout has {PROMPT_VERSION}")
parsed = parse_answer(answer) if not problems else None
+ leaks = [
+ {"source": f"checkpoint {index}", "line": line}
+ for index, checkpoint in enumerate(written, 1)
+ for line in checkpoint_leaks(checkpoint)
+ ] + [{"source": "probe answer", "line": line} for line in (answer_leaks(parsed) if parsed is not None else ())]
scores = {fact.name: parsed is not None and fact.found(parsed) for fact in FACTS} if not problems else None
+ if scores is not None:
+ scores[LEAK] = parsed is not None and not leaks
result = {
"valid": not problems,
"invalid_reasons": problems,
@@ -475,6 +537,7 @@ def run(args: argparse.Namespace) -> tuple[dict, bool]:
"answer_parsed": parsed is not None if not problems else None,
"score": f"{sum(scores.values())}/{len(scores)}" if scores is not None else None,
"facts": scores,
+ "leaks": leaks,
"answer": answer,
"turns": transcript,
}
diff --git a/tests/test_vibey_agent_context.py b/tests/test_vibey_agent_context.py
index 2cffe0e75..31fe42ccb 100644
--- a/tests/test_vibey_agent_context.py
+++ b/tests/test_vibey_agent_context.py
@@ -103,13 +103,15 @@ async def test_a_threshold_checkpoint_carries_the_lookup_and_the_state_and_shows
async def test_an_8k_route_compacts_instead_of_exhausting(engine, session, tmp_path):
# T stays positive on every window (the margin is at most W / 8): on an 8,000-token route with no output maximum,
- # O = 2,000 and M = 1,000, so T = 5,000. Three small Turns cross it once, and a normal checkpoint makes room.
+ # O = 2,000 and M = 1,000, so T = 5,000. Three small Turns cross it once, and a normal checkpoint makes room. The
+ # whole context plus the checkpoint request (about 825 tokens) plus O must fit the window, so the Turns are sized
+ # for the third to cross T by less than the room the request leaves.
replies = ("one", "two", CHECKPOINT, "three") # the third Turn's request is the checkpoint request first
scripts = [[Done(assistant(reply))] for reply in replies]
harness = _Harness(engine, tmp_path, "avibe", scripts)
harness.controller.hub_limits = {"context_window": 8_000, "max_output_tokens": None}
for _ in range(3):
- await _turn(harness, tokens(1_000))
+ await _turn(harness, tokens(950))
compactions = [row for row in await harness.context_rows() if row.kind == "compaction"]
assert [row.payload["mode"] for row in compactions] == ["normal"]
assert _texts(harness, "result") == ["one", "two", "three"] and not harness.rows("notify")