Skip to content

Commit f95ea30

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix/408-classic-quit-save
# Conflicts: # scripts/tui-tests/README.md
2 parents d162ca5 + 8f7f544 commit f95ea30

20 files changed

Lines changed: 2679 additions & 277 deletions

‎.github/workflows/release-version-tests.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
paths:
66
- 'scripts/check-release-version.py'
77
- 'scripts/test-release-version.py'
8+
- 'scripts/test-release-engine-pin.py'
89
- 'scripts/bump-version.py'
910
- '.github/workflows/release.yml'
1011
- '.github/workflows/auto-release.yml'
@@ -27,3 +28,5 @@ jobs:
2728
python-version: '3.12'
2829
- name: Verify release preflight and forward-only ordering
2930
run: python3 -B scripts/test-release-version.py -v
31+
- name: Verify the Coven engine pin request
32+
run: python3 -B scripts/test-release-engine-pin.py -v

‎.github/workflows/release.yml‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ on:
1212
required: false
1313
type: boolean
1414
default: false
15+
advance_coven_engine:
16+
description: 'After publishing, ask OpenCoven/coven to propose this release as its pinned engine. Needs the COVEN_ENGINE_BUMP_TOKEN secret; without it the release still succeeds and Coven finds the release on its own schedule.'
17+
required: false
18+
type: boolean
19+
default: true
1520

1621
# Serialize all release versions and asset replacement, not just one tag.
1722
# Preflight rechecks remote versions after acquiring this shared group.
@@ -253,3 +258,31 @@ jobs:
253258
--ref main \
254259
-f version="$RELEASE_VERSION"
255260
echo "Dispatched npm-publish.yml for $RELEASE_VERSION."
261+
262+
# ── Ask Coven to pin the engine just published ──────────────────────
263+
# Coven installs the engine its `crates/coven-cli/engine.lock` names, so a
264+
# release reaches Coven users only after that pin moves. Coven's
265+
# engine-bump workflow regenerates the pin from the latest release here and
266+
# opens a pull request for a person to review and merge; this job starts it
267+
# as soon as the release exists. GITHUB_TOKEN cannot reach another
268+
# repository, so the dispatch needs a token that can run workflows in
269+
# OpenCoven/coven. Without one this job warns and passes: the release is
270+
# already published and Coven's scheduled run proposes the pin later.
271+
advance-coven-engine:
272+
needs: release
273+
if: ${{ inputs.advance_coven_engine }}
274+
runs-on: ubuntu-latest
275+
name: Propose Coven engine pin
276+
permissions: {}
277+
steps:
278+
- name: Dispatch Coven's engine-bump workflow
279+
env:
280+
GH_TOKEN: ${{ secrets.COVEN_ENGINE_BUMP_TOKEN }}
281+
run: |
282+
set -euo pipefail
283+
if [[ -z "${GH_TOKEN:-}" ]]; then
284+
echo "::warning::COVEN_ENGINE_BUMP_TOKEN is not set, so OpenCoven/coven was not asked to pin $RELEASE_VERSION. Its scheduled engine-bump run will propose the pin."
285+
exit 0
286+
fi
287+
gh workflow run engine-bump.yml --repo OpenCoven/coven --ref main
288+
echo "Asked OpenCoven/coven to propose pinning $RELEASE_VERSION."

‎COVEN.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,13 @@ tag; use a new version for fixes rather than replacing published assets.
203203
`.github/workflows/release.yml` from the approved main commit with the chosen
204204
version. The workflow publishes a GitHub Release; it is not a dry run.
205205
Verify the uploaded archives, installers and checksum manifest before
206-
announcing the release or updating managed engine pins.
206+
announcing the release or merging a managed engine pin. By default the
207+
workflow's last job asks OpenCoven/coven to propose the pin: it dispatches
208+
Coven's `engine-bump.yml`, which regenerates `engine.lock` from the new
209+
release and opens a pull request there for review. The job needs the
210+
`COVEN_ENGINE_BUMP_TOKEN` secret, a token allowed to run workflows in
211+
OpenCoven/coven. Without it the job warns and Coven's scheduled run
212+
proposes the pin later. Pass `advance_coven_engine=false` to skip it.
207213
7. Keep `publish_npm` false. `@opencoven/coven-code` is deprecated; npm publication
208214
is an explicit opt-in through the release workflow, not a routine release step.
209215

‎docs/keybindings.md‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,9 @@ In vim insert mode, `Enter` also submits. Use `Shift+Enter` for newlines in vim
322322

323323
### ESC During Streaming
324324

325-
Pressing `Escape` while the model is streaming a response interrupts the stream. The partial response is preserved in the conversation history and the model stops generating. The input field regains focus and you can send a follow-up message.
325+
Pressing `Escape` while a turn is running cancels the whole turn, the same way `Ctrl+C` does, in both renderers: the model stops generating and the runtime cancels any tool call in progress. Live text stops streaming at once. Once the runtime has stopped, the partial answer it kept appears in the transcript and the saved session; it can include text that had not reached the screen yet. Nothing else the cancelled turn sends restarts it, so the next `Ctrl+C` starts the exit sequence instead of cancelling again. The input field keeps focus and you can send a follow-up message.
326326

327-
This is equivalent to pressing `Ctrl+C` during streaming, except that `Ctrl+C` also signals any tool calls in progress to abort (via `AbortController`), while `Escape` only stops the stream and allows running tools to finish.
328-
329-
In the Next renderer (`COVEN_CODE_UI=next`), `Escape` cancels the whole turn the same way `Ctrl+C` does, and the status shows `cancelling` until the runtime has actually stopped it. When the Next inspector is open, the first `Escape` closes the inspector instead of cancelling.
327+
Until the runtime has actually stopped the turn, the status says the cancel is pending: `Cancelling…` in Classic, `cancelling` in the Next renderer (`COVEN_CODE_UI=next`). Then it shows `Cancelled.`, with no turn-done notice or bell, even if the turn had already finished when the cancel reached it. A cancel from remote control follows the same steps. Auto-compaction does not stop when cancelled: the status says the cancel is pending until the compaction finishes, then shows `Cancelled.`, although the conversation was compacted. When the Next inspector is open, the first `Escape` closes the inspector instead of cancelling.
330328

331329
---
332330

‎docs/providers.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,30 @@ to the Anthropic Messages API. Without an API key, turns run through the local
3636
`claude` binary. That CLI owns its authentication; Coven Code does not import or
3737
replay Claude CLI OAuth tokens.
3838

39+
The CLI also runs its own tools under its own permission settings. Each turn's
40+
permission mode reaches it as `--permission-mode`. Started on its own, the
41+
engine otherwise leaves the CLI to whatever the user's and the workspace's
42+
Claude settings files allow. When Coven starts the engine for a headless run it
43+
sets `COVEN_CLAUDE_POLICY`, a JSON object naming Coven's settings file, the
44+
settings files the CLI may still read, extra directories and the user's MCP
45+
config. The engine adds those to every CLI launch. The object does not name a
46+
permission mode, so the turn's own stays the only one. It names two settings
47+
files: a read-only (`plan`) turn gets the one without Coven's allow rules,
48+
because the CLI applies allow rules in plan mode too. If the engine cannot
49+
apply the object in full (an unknown field counts), the turn fails with a
50+
message to update Coven and the engine together; the CLI is not started
51+
without the policy.
52+
3953
Set `ANTHROPIC_API_KEY` or configure an engine-owned key. Use `/account connect`
4054
for provider setup and `/account` for account management. The separate
4155
`coven-code auth login` flow requires a configured
4256
`COVEN_CODE_ANTHROPIC_OAUTH_CLIENT_ID`; it is not a Claude CLI token-import path.
4357

58+
A turn through the `claude` binary can be quiet for minutes while one of the
59+
CLI's own tools runs, such as a build or a test suite. The engine keeps
60+
waiting for as long as the `claude` process is running. The 45-second stall
61+
timeout, which retries a silent API stream, does not cut that wait short.
62+
4463
Model availability and defaults depend on the installed catalog and account.
4564
Inspect the engine's resolved models rather than relying on a static price or
4665
context-window table:

‎scripts/test-release-engine-pin.py‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/usr/bin/env python3
2+
"""Hold the release workflow's Coven engine pin request to its contract.
3+
4+
Runs the job's own script against a recording stand-in for `gh`; nothing is
5+
dispatched.
6+
"""
7+
import os
8+
from pathlib import Path
9+
import re
10+
import subprocess
11+
import tempfile
12+
import textwrap
13+
import unittest
14+
15+
ROOT = Path(__file__).resolve().parents[1]
16+
RELEASE = (ROOT / '.github/workflows/release.yml').read_text(encoding='utf-8')
17+
JOB = RELEASE.split('\n advance-coven-engine:\n', 1)[1]
18+
STAND_IN = '#!/bin/sh\nprintf \'%s\\n\' "$*" >> "$GH_RECORD"\nexit "${GH_EXIT:-0}"\n'
19+
20+
21+
class CovenEnginePinRequestTests(unittest.TestCase):
22+
def run_step(self, token, gh_exit=0):
23+
script = textwrap.dedent(JOB.split(' run: |\n', 1)[1])
24+
with tempfile.TemporaryDirectory() as directory:
25+
record = Path(directory) / 'gh-calls'
26+
stand_in = Path(directory) / 'gh'
27+
stand_in.write_text(STAND_IN, encoding='utf-8')
28+
stand_in.chmod(0o700)
29+
env = {'PATH': f'{directory}:/usr/bin:/bin', 'HOME': directory, 'RELEASE_VERSION': 'v1.2.3',
30+
'GH_RECORD': str(record), 'GH_EXIT': str(gh_exit)}
31+
if token is not None:
32+
env['GH_TOKEN'] = token
33+
done = subprocess.run(['bash', '-c', script], cwd=directory, env=env,
34+
capture_output=True, text=True, timeout=10)
35+
calls = record.read_text(encoding='utf-8').splitlines() if record.exists() else []
36+
return done, calls
37+
38+
def test_requests_the_pin_by_default_and_can_be_turned_off(self):
39+
declared = RELEASE.split(' advance_coven_engine:\n', 1)[1].split('\n\n', 1)[0]
40+
self.assertIn(' type: boolean\n', declared)
41+
self.assertTrue(declared.endswith(' default: true'))
42+
self.assertIn(' if: ${{ inputs.advance_coven_engine }}\n', JOB)
43+
44+
def test_runs_only_after_publication_and_holds_no_repository_token(self):
45+
self.assertIn(' needs: release\n', JOB)
46+
self.assertIn(' permissions: {}\n', JOB)
47+
self.assertEqual(re.findall(r'secrets\.(\w+)', JOB), ['COVEN_ENGINE_BUMP_TOKEN'])
48+
self.assertNotIn('actions/checkout', JOB)
49+
self.assertEqual(RELEASE.count('COVEN_ENGINE_BUMP_TOKEN }}'), 1)
50+
51+
def test_dispatches_the_engine_bump_workflow_on_coven_main(self):
52+
done, calls = self.run_step('token')
53+
self.assertEqual(done.returncode, 0, done.stdout + done.stderr)
54+
self.assertEqual(calls, ['workflow run engine-bump.yml --repo OpenCoven/coven --ref main'])
55+
self.assertIn('v1.2.3', done.stdout)
56+
57+
def test_missing_token_warns_and_does_not_fail_the_published_release(self):
58+
for token in (None, ''):
59+
with self.subTest(token=token):
60+
done, calls = self.run_step(token)
61+
self.assertEqual(done.returncode, 0, done.stdout + done.stderr)
62+
self.assertEqual(calls, [])
63+
self.assertIn('::warning::COVEN_ENGINE_BUMP_TOKEN is not set', done.stdout)
64+
self.assertIn('v1.2.3', done.stdout)
65+
66+
def test_refused_dispatch_fails_the_job(self):
67+
done, calls = self.run_step('token', gh_exit=1)
68+
self.assertNotEqual(done.returncode, 0)
69+
self.assertEqual(len(calls), 1)
70+
self.assertNotIn('Asked OpenCoven/coven', done.stdout)
71+
72+
73+
if __name__ == '__main__':
74+
unittest.main()

‎scripts/tui-tests/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ screen, and runs `run.sh`. No secrets or network access required.
7575
| `cases/22_next_resize_stream.sh` | Resize during a turn | `fake_anthropic.py` streams 150,000 lines into Next, then holds the stream open, adding a line every 0.2 s, while tmux moves through 80x24, 40x10, 200x50, 20x5, 120x40, 1x1, 2x2, 160x30, 10x3, 80x24 and 120x40; tmux must apply 200x50, 20x5, 1x1, 2x2, 10x3 and 120x40, each held past its 250 ms resize delay, and nothing saved before the release proves every size landed during the turn; the process survives, the draft stays as typed in the composer, the end of the answer is on screen, every streamed line is saved, including at least 20 sent while the stream was held, and the frame fills 40 rows at 120x40; needs `python3` |
7676
| `cases/23_classic_zero_size.sh` | Zero and tiny sizes | Classic starts at 0x0, 0x40 and 120x0 and survives 120x0 with the exit toast, 0x40, 0x0, 1x1 and 20x6, then draws a full frame at 120x40, exits 0 and restores the terminal; tmux cannot make a zero-sized window, so `zero_size_pty.py` drives a raw PTY and needs `python3` |
7777
| `cases/25_next_unicode_composer.sh` | Unicode in the Next composer | CJK, right-to-left text, a combining mark and an emoji ZWJ sequence typed through tmux stay unsent, and all but the emoji (drawn differently by tmux versions) are checked on screen; Left and Backspace act on whole CJK characters; no turn reaches the provider (`fake_anthropic.py`) before Enter, and it and the saved session get exactly the edited text. tmux sends committed characters only, so input-method preedit is not covered, and editing moves by Unicode scalar, so the ZWJ emoji and combining mark are not edited; needs `python3` |
78+
| `cases/26_classic_cancel.sh` | Cancelling a turn | In Classic (`COVEN_CODE_UI` unset) and Next, `fake_anthropic.py` drives a real turn. Escape while an approved Bash command appends a line every second: once the status no longer says cancelling, at most 3 more lines were written than at the Escape, and the file stops growing. Escape while text is still arriving (a burst of 200,000 text deltas, then a stream held open, so the turn is still running in the runtime): the status acknowledges it, the backlog still arriving does not bring the running turn back within 10 s, and the status settles to `Cancelled`; needs `python3` |
7879
| `cases/27_classic_quit_save.sh` | Quitting mid-turn | In Classic (`COVEN_CODE_UI` unset) and Next, `fake_anthropic.py` drives a real turn. Ctrl+D twice while a held stream is still sending text exits, leaves the alternate screen, restores the cursor and turns mouse reporting off, and the saved session holds the prompt and the text delivered so far. Only Next prints its report and the resume command after exiting. Ctrl+D twice while an approved `sleep 20` runs exits within 8 s and saves the prompt; needs `python3` |
7980

8081
## Configuration

0 commit comments

Comments
 (0)