optio-opencode 0.6.4__tar.gz → 0.6.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/PKG-INFO +5 -5
  2. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/pyproject.toml +5 -5
  3. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode/session.py +13 -1
  4. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode/types.py +14 -1
  5. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode.egg-info/PKG-INFO +5 -5
  6. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode.egg-info/requires.txt +4 -4
  7. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_conversation_ui_model.py +21 -0
  8. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_host_remote_resume.py +34 -0
  9. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_session_blob_hooks.py +1 -1
  10. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_session_local.py +30 -0
  11. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/README.md +0 -0
  12. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/setup.cfg +0 -0
  13. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode/__init__.py +0 -0
  14. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode/account.py +0 -0
  15. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode/conversation.py +0 -0
  16. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode/cred_watcher.py +0 -0
  17. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode/fs_allowlist.py +0 -0
  18. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode/host_actions.py +0 -0
  19. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode/info.py +0 -0
  20. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode/model_probe.py +0 -0
  21. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode/prompt.py +0 -0
  22. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode/providers/__init__.py +0 -0
  23. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode/providers/anthropic.py +0 -0
  24. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode/providers/deepseek.py +0 -0
  25. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode/providers/openai.py +0 -0
  26. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode/providers/xai.py +0 -0
  27. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode/seed_manifest.py +0 -0
  28. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode/snapshots.py +0 -0
  29. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode/todos.py +0 -0
  30. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode/verify.py +0 -0
  31. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode.egg-info/SOURCES.txt +0 -0
  32. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode.egg-info/dependency_links.txt +0 -0
  33. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/src/optio_opencode.egg-info/top_level.txt +0 -0
  34. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_account.py +0 -0
  35. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_account_xai_apikey.py +0 -0
  36. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_agent_info.py +0 -0
  37. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_agent_sender_opencode.py +0 -0
  38. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_auto_start_prompt.py +0 -0
  39. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_claustrum.py +0 -0
  40. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_config_harmonization.py +0 -0
  41. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_conversation_config.py +0 -0
  42. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_conversation_driver.py +0 -0
  43. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_conversation_session.py +0 -0
  44. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_conversation_ui_session.py +0 -0
  45. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_conversation_upload.py +0 -0
  46. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_cred_watcher.py +0 -0
  47. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_file_download.py +0 -0
  48. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_file_upload.py +0 -0
  49. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_host_actions.py +0 -0
  50. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_host_local.py +0 -0
  51. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_host_primitives_local.py +0 -0
  52. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_host_primitives_remote.py +0 -0
  53. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_host_resume.py +0 -0
  54. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_model_probe.py +0 -0
  55. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_model_probe_wiring.py +0 -0
  56. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_prompt.py +0 -0
  57. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_provider_deepseek.py +0 -0
  58. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_purge_seed.py +0 -0
  59. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_sanity.py +0 -0
  60. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_seed_config.py +0 -0
  61. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_session_hooks.py +0 -0
  62. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_session_remote.py +0 -0
  63. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_session_resume.py +0 -0
  64. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_session_seed.py +0 -0
  65. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_session_seed_saveback.py +0 -0
  66. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_smart_install.py +0 -0
  67. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_snapshots.py +0 -0
  68. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_todos.py +0 -0
  69. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_types.py +0 -0
  70. {optio_opencode-0.6.4 → optio_opencode-0.6.6}/tests/test_verify_seed.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: optio-opencode
3
- Version: 0.6.4
3
+ Version: 0.6.6
4
4
  Summary: Run opencode web as an optio task; local subprocess or remote via SSH.
5
5
  Author-email: Kristof Csillag <kristof.csillag@deai-labs.com>
6
6
  License-Expression: Apache-2.0
@@ -20,10 +20,10 @@ Classifier: Topic :: Software Development :: Code Generators
20
20
  Classifier: Framework :: AsyncIO
21
21
  Requires-Python: >=3.11
22
22
  Description-Content-Type: text/markdown
23
- Requires-Dist: optio-core<0.6,>=0.5
24
- Requires-Dist: optio-host<0.4,>=0.3
25
- Requires-Dist: optio-agents<0.7,>=0.6
26
- Requires-Dist: optio-claudecode<0.7,>=0.6
23
+ Requires-Dist: optio-core<0.7,>=0.6
24
+ Requires-Dist: optio-host<0.5,>=0.4
25
+ Requires-Dist: optio-agents<0.8,>=0.7
26
+ Requires-Dist: optio-claudecode<0.8,>=0.7
27
27
  Requires-Dist: optio-codex<0.5,>=0.4
28
28
  Requires-Dist: optio-grok<0.5,>=0.4
29
29
  Requires-Dist: asyncssh>=2.14
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "optio-opencode"
7
- version = "0.6.4"
7
+ version = "0.6.6"
8
8
  description = "Run opencode web as an optio task; local subprocess or remote via SSH."
9
9
  readme = "README.md"
10
10
  license = "Apache-2.0"
@@ -26,15 +26,15 @@ classifiers = [
26
26
  "Framework :: AsyncIO",
27
27
  ]
28
28
  dependencies = [
29
- "optio-core>=0.5,<0.6",
29
+ "optio-core>=0.6,<0.7",
30
30
  # 0.1.1 introduces the bind_addr kwarg on Host.establish_tunnel —
31
31
  # required for OPTIO_WIDGET_TUNNEL_BIND to work.
32
- "optio-host>=0.3,<0.4",
33
- "optio-agents>=0.6,<0.7",
32
+ "optio-host>=0.4,<0.5",
33
+ "optio-agents>=0.7,<0.8",
34
34
  # The account meta-analyzer's per-provider handlers reuse the extracted
35
35
  # vendor map helpers (account_from_oauth_token / account_from_openai /
36
36
  # account_from_xai) rather than reimplement each vendor's fetch+map.
37
- "optio-claudecode>=0.6,<0.7",
37
+ "optio-claudecode>=0.7,<0.8",
38
38
  "optio-codex>=0.4,<0.5",
39
39
  "optio-grok>=0.4,<0.5",
40
40
  "asyncssh>=2.14",
@@ -175,6 +175,8 @@ def conversation_widget_data(config: "OpencodeTaskConfig", *, session_id: str, d
175
175
  "directory": directory,
176
176
  "toolVerbosity": config.tool_verbosity,
177
177
  "thinkingVerbosity": config.thinking_verbosity,
178
+ # The welcome card atop the transcript (None: no card).
179
+ "welcome": config.welcome_widget_data,
178
180
  "showSessionControls": config.show_session_controls,
179
181
  # The session_controls allowlist (None: every control). opencode's
180
182
  # control snapshots are built client-side (OpencodeView, from the live
@@ -360,6 +362,8 @@ async def run_opencode_session(ctx: ProcessContext, config: OpencodeTaskConfig)
360
362
  omit_task_framing=omit_task_framing,
361
363
  fs_isolation_dirs=fs_isolation_dirs(config, host.workdir),
362
364
  file_download=config.file_download,
365
+ # Every resume sends the System: resume notice.
366
+ check_resume_log_every_message=False,
363
367
  ),
364
368
  )
365
369
  if resolved_seed_id is not None:
@@ -952,8 +956,14 @@ async def _capture_snapshot(
952
956
  session_blob_payload = encrypt(session_json)
953
957
  expected_len_payload = len(session_blob_payload)
954
958
 
959
+ # The capture-cap decision's one-line note (at most one per capture) has
960
+ # no process-log handle at the host layer, so it is forwarded here
961
+ # through ctx.report_progress, same as every other milestone line.
962
+ def _on_note(note: str, level: str) -> None:
963
+ ctx.report_progress(None, note, level=level)
964
+
955
965
  async with ctx.store_blob("workdir") as wwriter:
956
- async for chunk in host.archive_workdir(workdir_exclude):
966
+ async for chunk in host.archive_workdir(workdir_exclude, on_note=_on_note):
957
967
  await wwriter.write(chunk)
958
968
  workdir_blob_id = wwriter.file_id
959
969
 
@@ -1092,6 +1102,8 @@ async def _maybe_refresh_on_resume(
1092
1102
  omit_task_framing=omit_task_framing,
1093
1103
  fs_isolation_dirs=fs_isolation_dirs(new_config, host.workdir),
1094
1104
  file_download=new_config.file_download,
1105
+ # Every resume sends the System: resume notice.
1106
+ check_resume_log_every_message=False,
1095
1107
  )
1096
1108
  try:
1097
1109
  existing = await hook_ctx.read_text_from_host("AGENTS.md", silent=True)
@@ -21,8 +21,12 @@ from optio_agents import (
21
21
  from optio_agents.config_types import (
22
22
  BlobCryptoConfigMixin,
23
23
  ClaustrumConfigMixin,
24
+ ResumeConfigMixin,
24
25
  SessionControlsConfigMixin,
26
+ WelcomeConfigMixin,
25
27
  )
28
+ from optio_agents.custom_controls import CustomControlsConfigMixin
29
+ from optio_agents.mcp import McpConfigMixin
26
30
  from optio_agents.protocol.session import (
27
31
  CallerMessageCallback,
28
32
  DeliverableCallback,
@@ -77,7 +81,11 @@ def _identity_resume_refresh(config: "OpencodeTaskConfig") -> "OpencodeTaskConfi
77
81
 
78
82
 
79
83
  @dataclass(frozen=True, kw_only=True)
80
- class OpencodeTaskConfig(ClaustrumConfigMixin, BlobCryptoConfigMixin, SessionControlsConfigMixin):
84
+ class OpencodeTaskConfig(
85
+ ClaustrumConfigMixin, BlobCryptoConfigMixin, SessionControlsConfigMixin, McpConfigMixin,
86
+ CustomControlsConfigMixin, ResumeConfigMixin,
87
+ WelcomeConfigMixin,
88
+ ):
81
89
  """Configuration for one optio-opencode task instance.
82
90
 
83
91
  Inherits the claustrum filesystem-isolation triad (``fs_isolation`` /
@@ -243,6 +251,11 @@ class OpencodeTaskConfig(ClaustrumConfigMixin, BlobCryptoConfigMixin, SessionCon
243
251
  self._validate_claustrum()
244
252
  self._validate_blob_crypto()
245
253
  self._validate_session_controls()
254
+ self._validate_welcome()
255
+ # This engine cannot hand MCP servers to its agent yet: refuse mcp_servers.
256
+ self._validate_mcp(supported=False, agent=self.agent_type)
257
+ # Nor can it apply custom session controls: refuse a non-empty custom_controls.
258
+ self._validate_custom_controls(supported=False, agent=self.agent_type)
246
259
  if self.mode not in ("iframe", "conversation"):
247
260
  raise ValueError(
248
261
  f"OpencodeTaskConfig.mode={self.mode!r} is not one of "
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: optio-opencode
3
- Version: 0.6.4
3
+ Version: 0.6.6
4
4
  Summary: Run opencode web as an optio task; local subprocess or remote via SSH.
5
5
  Author-email: Kristof Csillag <kristof.csillag@deai-labs.com>
6
6
  License-Expression: Apache-2.0
@@ -20,10 +20,10 @@ Classifier: Topic :: Software Development :: Code Generators
20
20
  Classifier: Framework :: AsyncIO
21
21
  Requires-Python: >=3.11
22
22
  Description-Content-Type: text/markdown
23
- Requires-Dist: optio-core<0.6,>=0.5
24
- Requires-Dist: optio-host<0.4,>=0.3
25
- Requires-Dist: optio-agents<0.7,>=0.6
26
- Requires-Dist: optio-claudecode<0.7,>=0.6
23
+ Requires-Dist: optio-core<0.7,>=0.6
24
+ Requires-Dist: optio-host<0.5,>=0.4
25
+ Requires-Dist: optio-agents<0.8,>=0.7
26
+ Requires-Dist: optio-claudecode<0.8,>=0.7
27
27
  Requires-Dist: optio-codex<0.5,>=0.4
28
28
  Requires-Dist: optio-grok<0.5,>=0.4
29
29
  Requires-Dist: asyncssh>=2.14
@@ -1,7 +1,7 @@
1
- optio-core<0.6,>=0.5
2
- optio-host<0.4,>=0.3
3
- optio-agents<0.7,>=0.6
4
- optio-claudecode<0.7,>=0.6
1
+ optio-core<0.7,>=0.6
2
+ optio-host<0.5,>=0.4
3
+ optio-agents<0.8,>=0.7
4
+ optio-claudecode<0.8,>=0.7
5
5
  optio-codex<0.5,>=0.4
6
6
  optio-grok<0.5,>=0.4
7
7
  asyncssh>=2.14
@@ -1,5 +1,6 @@
1
1
  import pytest
2
2
 
3
+ from optio_agents import WelcomeCard
3
4
  from optio_opencode.session import conversation_widget_data
4
5
  from optio_opencode.types import OpencodeTaskConfig
5
6
 
@@ -73,6 +74,7 @@ def test_widget_data_carries_model_fields():
73
74
  "directory": "/wd",
74
75
  "toolVerbosity": "verbose",
75
76
  "thinkingVerbosity": "hidden",
77
+ "welcome": None,
76
78
  "showSessionControls": True,
77
79
  "sessionControls": None,
78
80
  "nativeSpinner": False,
@@ -96,6 +98,25 @@ def test_widget_data_defaults():
96
98
  # No effort configured ⇒ the widget seeds nothing (opencode's per-model
97
99
  # default stands).
98
100
  assert wd["defaultEffort"] is None
101
+ assert wd["welcome"] is None
102
+
103
+
104
+ def test_widget_data_carries_the_welcome_card():
105
+ cfg = OpencodeTaskConfig(
106
+ consumer_instructions="task", fs_isolation=False,
107
+ mode="conversation",
108
+ conversation_ui=True,
109
+ # A language-map title (published unresolved) and a minimum height.
110
+ welcome=WelcomeCard(
111
+ title={"en": "Hello", "hu": "Szia"}, description="Try **this**.",
112
+ icon="img/w.png", min_height=200,
113
+ ),
114
+ )
115
+ wd = conversation_widget_data(cfg, session_id="s1", directory="/wd")
116
+ assert wd["welcome"] == {
117
+ "title": {"en": "Hello", "hu": "Szia"}, "description": "Try **this**.",
118
+ "icon": "/img/w.png", "minHeight": 200,
119
+ }
99
120
 
100
121
 
101
122
  def test_reasoning_effort_accepted():
@@ -16,7 +16,9 @@ test cannot be wired through the SSH launch path.
16
16
 
17
17
  from __future__ import annotations
18
18
 
19
+ import io
19
20
  import json
21
+ import tarfile
20
22
 
21
23
  import pytest
22
24
  import pytest_asyncio
@@ -96,6 +98,38 @@ async def test_remote_archive_workdir_yields_chunks(remote_host: RemoteHost):
96
98
  assert len(b"".join(chunks)) > 0, "expected at least some tar bytes"
97
99
 
98
100
 
101
+ async def test_remote_archive_over_the_cap_leaves_out_the_listed_paths(
102
+ remote_host: RemoteHost, monkeypatch,
103
+ ):
104
+ """Over the capture cap, the archive succeeds on the sshd image's BusyBox
105
+ tar and leaves out exactly what regenerable.txt lists, taken literally."""
106
+ monkeypatch.setenv("OPTIO_WORKDIR_CAPTURE_MAX_MB", "1")
107
+ probe = await remote_host._conn.run("tar --version 2>&1 | head -1", check=False)
108
+ assert "busybox" in (probe.stdout or "").lower(), probe.stdout
109
+ setup = await remote_host._conn.run(
110
+ f"cd {remote_host.workdir} && mkdir -p big pkg/big 'build[1]' build1 && "
111
+ "head -c 2097152 /dev/zero > big/blob.bin && echo k > keep.txt && "
112
+ "echo p > pkg/big/p.txt && echo b > 'build[1]/b' && echo c > build1/c && "
113
+ "printf 'big\\nbuild[1]\\n' > regenerable.txt",
114
+ check=False,
115
+ )
116
+ assert setup.exit_status == 0, setup.stderr
117
+ notes: list[tuple[str, str]] = []
118
+
119
+ blob = b"".join([
120
+ chunk async for chunk in remote_host.archive_workdir(
121
+ exclude=[".git"], on_note=lambda note, level: notes.append((note, level)),
122
+ )
123
+ ])
124
+
125
+ with tarfile.open(fileobj=io.BytesIO(blob), mode="r:gz") as tf:
126
+ files = {m.name.removeprefix("./") for m in tf.getmembers() if m.isfile()}
127
+ assert files == {"keep.txt", "regenerable.txt", "pkg/big/p.txt", "build1/c"}
128
+ assert notes == [
129
+ ("workdir 2 MB (cap 1 MB): left out 2 paths listed in regenerable.txt", "info"),
130
+ ]
131
+
132
+
99
133
  async def test_remote_restore_workdir_empties_then_extracts(sshd):
100
134
  """archive from one workdir, restore into a second, verify content and staleness."""
101
135
  ssh = SSHConfig(
@@ -95,7 +95,7 @@ async def test_capture_writes_through_session_blob_encrypt(monkeypatch):
95
95
  fake_ctx.delete_blob = AsyncMock()
96
96
  fake_ctx.mark_has_saved_state = AsyncMock()
97
97
 
98
- async def _fake_archive(_excl):
98
+ async def _fake_archive(_excl, *, on_note=None):
99
99
  yield b"workdir-bytes"
100
100
  fake_host = MagicMock()
101
101
  fake_host.archive_workdir = _fake_archive
@@ -9,6 +9,7 @@ import pytest
9
9
  import pytest_asyncio
10
10
  from bson import ObjectId
11
11
 
12
+ from optio_agents import RESUME_NOTICE, SYSTEM_MESSAGE_PREFIX
12
13
  from optio_core.context import ProcessContext
13
14
  from optio_core.models import BasicAuth
14
15
  from optio_opencode.session import run_opencode_session
@@ -17,6 +18,9 @@ from optio_opencode.types import OpencodeTaskConfig
17
18
 
18
19
  FAKE_OPENCODE = os.path.join(os.path.dirname(__file__), "fake_opencode.py")
19
20
 
21
+ _POLL_RULE = "At the start of every new incoming user message"
22
+ _NOTICE_RULE = f"`{SYSTEM_MESSAGE_PREFIX}{RESUME_NOTICE}` message on your input channel"
23
+
20
24
  # Each test here spawns a real fake-opencode server subprocess and polls it for
21
25
  # streamed events; the timing is fragile under *any* concurrent machine load
22
26
  # (other xdist workers, docker builds). Marked `serial` so the harness runs
@@ -194,6 +198,26 @@ async def test_happy_path(ctx_and_captures, _supply_scenario):
194
198
  assert text == "hello 42 blue"
195
199
 
196
200
 
201
+ async def test_fresh_agents_md_waits_for_the_resume_notice(ctx_and_captures, _supply_scenario):
202
+ """Every resume is announced with the System: resume notice (both
203
+ modes), so the planted AGENTS.md tells opencode to wait for it rather
204
+ than read resume.log before each message."""
205
+ import dataclasses
206
+ ctx, cap, _ = ctx_and_captures
207
+ _supply_scenario["name"] = "happy"
208
+ observed: dict[str, str] = {}
209
+
210
+ async def capture(hook_ctx):
211
+ observed["agents_md"] = await hook_ctx.read_text_from_host("AGENTS.md", silent=True)
212
+
213
+ cfg = dataclasses.replace(_config("happy"), before_execute=capture)
214
+ await run_opencode_session(ctx, cfg)
215
+
216
+ assert "## Resumes" in observed["agents_md"]
217
+ assert _POLL_RULE not in observed["agents_md"]
218
+ assert _NOTICE_RULE in observed["agents_md"]
219
+
220
+
197
221
  async def test_status_percent_is_reported(ctx_and_captures, _supply_scenario):
198
222
  ctx, cap, _ = ctx_and_captures
199
223
  _supply_scenario["name"] = "status_percent"
@@ -518,6 +542,7 @@ async def test_maybe_refresh_on_resume_unchanged_content_skips_write(tmp_workdir
518
542
  config.consumer_instructions,
519
543
  workdir_exclude=config.workdir_exclude,
520
544
  supports_resume=config.supports_resume,
545
+ check_resume_log_every_message=False, # as the fresh start writes it
521
546
  )
522
547
  await host.write_text("AGENTS.md", expected)
523
548
  mtime_before = os.path.getmtime(os.path.join(host.workdir, "AGENTS.md"))
@@ -562,6 +587,7 @@ async def test_maybe_refresh_on_resume_conversation_defaults_match_fresh(tmp_wor
562
587
  supports_resume=config.supports_resume,
563
588
  host_protocol=config.host_protocol,
564
589
  omit_task_framing=True,
590
+ check_resume_log_every_message=False,
565
591
  )
566
592
  await host.write_text("AGENTS.md", expected)
567
593
 
@@ -619,6 +645,10 @@ async def test_maybe_refresh_on_resume_changed_content_writes(tmp_workdir):
619
645
  content = f.read()
620
646
  assert "new task" in content
621
647
  assert "old task" not in content
648
+ # Every resume sends the System: resume notice, so the refreshed file
649
+ # says to wait for it rather than read resume.log before each message.
650
+ assert _POLL_RULE not in content
651
+ assert _NOTICE_RULE in content
622
652
 
623
653
 
624
654
  async def test_maybe_refresh_on_resume_hook_raises_keeps_existing(tmp_workdir):
File without changes
File without changes