samagotchi 0.163.0 → 0.165.0

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 (104) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +77 -1
  3. data/docs/architecture.md +7 -5
  4. data/docs/bundles.md +4 -2
  5. data/docs/cli.md +23 -11
  6. data/docs/configuration.md +5 -1
  7. data/docs/guardrails.md +13 -16
  8. data/docs/internals/block-renderers.md +3 -1
  9. data/docs/internals/bridge.md +4 -3
  10. data/docs/internals/bundles.md +4 -2
  11. data/docs/internals/inline-widgets.md +13 -3
  12. data/docs/internals/remote-sessions.md +7 -2
  13. data/docs/internals/web-frontend.md +36 -9
  14. data/docs/memory.md +12 -7
  15. data/docs/plugins.md +6 -4
  16. data/docs/releasing.md +6 -2
  17. data/docs/scheduling.md +25 -3
  18. data/docs/sessions.md +9 -6
  19. data/docs/sub-agent.md +11 -0
  20. data/docs/testing.md +28 -4
  21. data/lib/samagotchi/block_renderers.rb +14 -7
  22. data/lib/samagotchi/bridge/card_store.rb +2 -1
  23. data/lib/samagotchi/bridge/turn_accumulator.rb +7 -8
  24. data/lib/samagotchi/bridge.rb +45 -3
  25. data/lib/samagotchi/bundle_command/installed_check.rb +2 -1
  26. data/lib/samagotchi/bundles/inline-widgets/manifest.yml +2 -2
  27. data/lib/samagotchi/bundles/inline-widgets/plugin.rb +8 -4
  28. data/lib/samagotchi/bundles/system/manifest.yml +1 -1
  29. data/lib/samagotchi/chi_home.rb +44 -2
  30. data/lib/samagotchi/cli/parent_wait.rb +5 -1
  31. data/lib/samagotchi/client_id.rb +34 -3
  32. data/lib/samagotchi/compat.rb +36 -0
  33. data/lib/samagotchi/context_command.rb +3 -0
  34. data/lib/samagotchi/context_providers.rb +5 -6
  35. data/lib/samagotchi/context_sources.rb +2 -2
  36. data/lib/samagotchi/continue_intent.rb +93 -0
  37. data/lib/samagotchi/events.rb +4 -4
  38. data/lib/samagotchi/extension_load.rb +2 -1
  39. data/lib/samagotchi/guardrails/child_boundary.rb +7 -27
  40. data/lib/samagotchi/guardrails/rules.rb +11 -9
  41. data/lib/samagotchi/guardrails/targets.rb +3 -4
  42. data/lib/samagotchi/inline_widgets.rb +16 -1
  43. data/lib/samagotchi/memory_bundle/provenance.rb +46 -4
  44. data/lib/samagotchi/memory_bundle/status.rb +2 -1
  45. data/lib/samagotchi/memory_command.rb +3 -0
  46. data/lib/samagotchi/memory_orphans.rb +4 -7
  47. data/lib/samagotchi/memory_paths.rb +64 -7
  48. data/lib/samagotchi/memory_usage.rb +1 -1
  49. data/lib/samagotchi/message_parts.rb +13 -0
  50. data/lib/samagotchi/note_command.rb +3 -6
  51. data/lib/samagotchi/parent_report.rb +3 -2
  52. data/lib/samagotchi/plugin/sessions.rb +4 -2
  53. data/lib/samagotchi/project_command.rb +4 -1
  54. data/lib/samagotchi/project_id_clash.rb +37 -26
  55. data/lib/samagotchi/project_init.rb +24 -7
  56. data/lib/samagotchi/reply_wait/poll.rb +2 -1
  57. data/lib/samagotchi/schedules.rb +124 -106
  58. data/lib/samagotchi/send_command/parent_gate.rb +8 -5
  59. data/lib/samagotchi/send_command.rb +203 -45
  60. data/lib/samagotchi/session.rb +3 -2
  61. data/lib/samagotchi/session_access/local.rb +25 -2
  62. data/lib/samagotchi/session_access/remote.rb +40 -4
  63. data/lib/samagotchi/session_chain/links.rb +109 -0
  64. data/lib/samagotchi/session_chain.rb +7 -19
  65. data/lib/samagotchi/session_continue.rb +143 -57
  66. data/lib/samagotchi/session_inbox_delivery.rb +94 -28
  67. data/lib/samagotchi/session_manager/delivery.rb +106 -18
  68. data/lib/samagotchi/session_manager/removal.rb +13 -7
  69. data/lib/samagotchi/session_manager.rb +1 -0
  70. data/lib/samagotchi/session_retention.rb +20 -10
  71. data/lib/samagotchi/session_setup.rb +31 -1
  72. data/lib/samagotchi/state_format.rb +12 -8
  73. data/lib/samagotchi/terminal_ui/attach_launcher.rb +6 -7
  74. data/lib/samagotchi/terminal_ui.rb +20 -9
  75. data/lib/samagotchi/tools/delegate.rb +2 -1
  76. data/lib/samagotchi/verify_fresh.rb +4 -1
  77. data/lib/samagotchi/version.rb +1 -1
  78. data/lib/samagotchi/web/message_display.rb +1 -9
  79. data/lib/samagotchi/web/public/activity.js +2 -2
  80. data/lib/samagotchi/web/public/app.js +13 -13
  81. data/lib/samagotchi/web/public/apple-touch-icon.png +0 -0
  82. data/lib/samagotchi/web/public/bar_fold.js +293 -0
  83. data/lib/samagotchi/web/public/card.js +1 -1
  84. data/lib/samagotchi/web/public/composer_mode.js +5 -7
  85. data/lib/samagotchi/web/public/favicon.svg +1 -1
  86. data/lib/samagotchi/web/public/icons/chi-180.png +0 -0
  87. data/lib/samagotchi/web/public/icons/chi-192.png +0 -0
  88. data/lib/samagotchi/web/public/icons/chi-512.png +0 -0
  89. data/lib/samagotchi/web/public/index.html +132 -65
  90. data/lib/samagotchi/web/public/info_bar.js +28 -16
  91. data/lib/samagotchi/web/public/info_bar_model.js +70 -1
  92. data/lib/samagotchi/web/public/inline_widgets.js +4 -1
  93. data/lib/samagotchi/web/public/more_sheet.js +98 -40
  94. data/lib/samagotchi/web/public/stage_view.js +3 -1
  95. data/lib/samagotchi/web/public/stream_handlers.js +1 -1
  96. data/lib/samagotchi/web/public/turn_events.js +0 -122
  97. data/lib/samagotchi/web/public/turn_model.js +1 -1
  98. data/lib/samagotchi/web/public/widget_picks.js +18 -3
  99. data/lib/samagotchi/web/public/widget_walk.js +14 -4
  100. data/lib/samagotchi/web/session_access_routes.rb +8 -1
  101. data/lib/samagotchi/web/session_control.rb +15 -2
  102. data/lib/samagotchi/web/session_create.rb +4 -2
  103. data/lib/samagotchi/web/update_check.rb +27 -8
  104. metadata +4 -1
@@ -19,6 +19,17 @@ module Samagotchi
19
19
  # The file that makes a folder in no git repository a chi project
20
20
  # (`chi project init`). The file, not the bare .chi/ dir, is the marker.
21
21
  MARKER = File.join(".chi", "project.yml").freeze
22
+ CLAIM = ".root"
23
+
24
+ class ProjectIdConflict < ArgumentError
25
+ attr_reader :folder
26
+
27
+ def initialize(folder)
28
+ @folder = folder
29
+ super("project memory folder #{folder} is already in use; run `chi project init --new-id` " \
30
+ "to give this project its own id")
31
+ end
32
+ end
22
33
 
23
34
  # How a folder's project was found (#lookup): +kind+ is :git, :marker or
24
35
  # :none; +root+ is what memories are keyed on (#project_root: git's
@@ -80,20 +91,59 @@ module Samagotchi
80
91
 
81
92
  # One folder per project: a marked project's id (ProjectId), else its
82
93
  # root's path key (#key_for_root).
83
- def project_key(cwd = Dir.pwd)
84
- found = lookup(cwd)
85
- key_for(root: found.root, id: found.id)
94
+ def project_key(cwd = Dir.pwd, env: ENV, home: default_home)
95
+ found = lookup(cwd, home: home)
96
+ key_for(root: found.root, id: found.id, env: env, home: home)
86
97
  end
87
98
 
88
99
  # The key of a project already resolved: +id+ (a ProjectLookup's, a
89
100
  # session's project_id) when there is one, else +root+'s path key. Every
90
101
  # caller holding a root keys here, with the id that came with it.
91
- def key_for(root:, id:) = id || key_for_root(root)
102
+ def key_for(root:, id:, env: ENV, home: default_home)
103
+ return key_for_root(root) unless id
104
+
105
+ conflict = project_id_conflict(root: root, id: id, env: env, home: home)
106
+ raise conflict if conflict
107
+
108
+ id
109
+ end
110
+
111
+ # The shape of a #key_for_root name (`<basename>_<8 lowercase hex>`);
112
+ # generated ids (ProjectId.generate) are `<name>-<8 hex>`.
113
+ PATH_KEY_SHAPE = /_[0-9a-f]{8}\z/
114
+ private_constant :PATH_KEY_SHAPE
115
+
116
+ # An existing id folder is safe only when it is claimed by this root, or
117
+ # the caller or its previous claimant no longer has this id. An unclaimed
118
+ # folder is taken only when its name has the path-key shape (another
119
+ # project's path-keyed folder); one of any other name is a legacy id
120
+ # folder (an older `chi project init` or chi wrote no claim):
121
+ # ProjectIdClash.check claims it at session start.
122
+ def project_id_conflict(root:, id:, env: ENV, home: default_home)
123
+ folder = File.join(projects_dir(env: env), id)
124
+ return nil unless File.exist?(folder) || File.symlink?(folder)
125
+ return ProjectIdConflict.new(folder) unless File.directory?(folder)
126
+
127
+ claim_path = File.join(folder, CLAIM)
128
+ other = File.file?(claim_path) ? File.read(claim_path, 4096).to_s.lines.first.to_s.strip : ""
129
+ if other.empty?
130
+ return path_key_shape?(id) ? ProjectIdConflict.new(folder) : nil
131
+ end
132
+ return nil if other == root || !same_project?(root, id, home)
133
+ return ProjectIdConflict.new(folder) if same_project?(other, id, home)
134
+
135
+ nil
136
+ rescue SystemCallError
137
+ ProjectIdConflict.new(folder)
138
+ end
92
139
 
93
140
  # The path key: basename + 8 hex chars of MD5(full root path). Pure: it
94
- # reads no file (#key_for adds the id).
141
+ # reads no file.
95
142
  def key_for_root(root) = "#{File.basename(root)}_#{Digest::MD5.hexdigest(root)[0..7]}"
96
143
 
144
+ # Whether +key+ looks like a #key_for_root name.
145
+ def path_key_shape?(key) = PATH_KEY_SHAPE.match?(key)
146
+
97
147
  # The id in the marker at +root+, or nil (none, or not a valid one: one
98
148
  # debug line says why).
99
149
  def marker_id(root)
@@ -227,10 +277,17 @@ module Samagotchi
227
277
  rescue SystemCallError
228
278
  gitdir
229
279
  end
230
- private_class_method :find_dot_git, :git_root, :gitdir_from_file, :common_dir
280
+
281
+ def same_project?(other, id, home)
282
+ return false if other.empty? || !File.directory?(other)
283
+
284
+ found = lookup(other, home: home)
285
+ found.marker? && found.root == File.realpath(other) && found.id == id
286
+ end
287
+ private_class_method :find_dot_git, :git_root, :gitdir_from_file, :common_dir, :same_project?
231
288
 
232
289
  def project_dir(env: ENV, cwd: Dir.pwd)
233
- File.join(projects_dir(env: env), project_key(cwd))
290
+ File.join(projects_dir(env: env), project_key(cwd, env: env))
234
291
  end
235
292
 
236
293
  # The folder of a memory scope: "system" (or blank) or "project"; nil for
@@ -351,7 +351,7 @@ module Samagotchi
351
351
 
352
352
  def project_dir_of(session)
353
353
  root, id = session_project(session)
354
- root ? File.join(MemoryPaths.projects_dir(env: @env), MemoryPaths.key_for(root: root, id: id)) : nil
354
+ root ? File.join(MemoryPaths.projects_dir(env: @env), MemoryPaths.key_for(root: root, id: id, env: @env)) : nil
355
355
  end
356
356
 
357
357
  # A session of this folder's project (worktrees of one repository share
@@ -73,6 +73,8 @@ module Samagotchi
73
73
  # @return [Hash, nil] { thinking:, tools: [{ tool:, params:, title:,
74
74
  # output:, output_truncated:, images:, tool_id:, edit: }] } with only what it found; nil for nothing
75
75
  def for_message(message, responses, registry: Tools::Builtins.default, cwd: nil, marks: {})
76
+ return nil unless something?(message)
77
+
76
78
  content = field(message, :content).to_s
77
79
  calls = field(message, :tool_calls)
78
80
  tools = if calls.is_a?(Array) && !calls.empty?
@@ -89,6 +91,17 @@ module Samagotchi
89
91
  nil
90
92
  end
91
93
 
94
+ # Whether +message+ can have parts (.for_message gives none without):
95
+ # a native call, content (its markup calls and thinking are read from
96
+ # it) or thinking. Cheap, nothing parsed: the owner show keeps a
97
+ # text-less step by it (Web::MessageDisplay), the participant review by
98
+ # its parts, so a new kind of part goes here for both.
99
+ def something?(message)
100
+ calls = field(message, :tool_calls)
101
+ (calls.is_a?(Array) && !calls.empty?) || !field(message, :content).to_s.strip.empty? ||
102
+ !field(message, :thinking).to_s.strip.empty?
103
+ end
104
+
92
105
  def thinking_of(content)
93
106
  blocks = content.scan(QWEN_THINK).flatten
94
107
  if blocks.empty? && !content.include?("<think>") && (open = content[QWEN_OPEN_THINK, 1])
@@ -121,12 +121,9 @@ module Samagotchi
121
121
  result.delivered?
122
122
  end
123
123
 
124
- # The id, or for a session that was continued the link that took it.
125
- def where(id, result)
126
- return id[0, 8] unless result.continued?
127
-
128
- "#{id[0, 8]} → #{result.id[0, 8]} (continued)"
129
- end
124
+ # The id, or for a session that was continued the link that took it
125
+ # (chi send's wording too).
126
+ def where(id, result) = SessionInbox::Resolved.label(id, result.id)
130
127
 
131
128
  def outcome(result)
132
129
  case result.status
@@ -173,8 +173,9 @@ module Samagotchi
173
173
  # A failure before any wait (no such session, a busy one, a message
174
174
  # that didn't go in) as the JSON object.
175
175
  # @param session_id [String, nil]
176
- def error_line(detail, session_id: nil)
177
- JSON.generate({ status: "error", session_id: session_id, detail: detail.to_s })
176
+ # @param extra [Hash] more keys after session_id (chi send's asked)
177
+ def error_line(detail, session_id: nil, extra: {})
178
+ JSON.generate({ status: "error", session_id: session_id, **extra, detail: detail.to_s })
178
179
  end
179
180
 
180
181
  # A pending question (Session#pending_question, a PendingQuestion) as a
@@ -112,7 +112,8 @@ module Samagotchi
112
112
  end
113
113
 
114
114
  # Send +text+ to session +id+ as a user message (it runs as a turn;
115
- # a stopped session is woken). Waits up to 5 s for its worker, so call
115
+ # an idle session is woken, but one its owner stopped or archived is
116
+ # not: refused). Waits up to 5 s for its worker, so call
116
117
  # it from an anytime command or your own thread, never a tool or hook
117
118
  # of a running turn. A running turn takes it at its next step; with
118
119
  # +delivery: :queue+ it runs as a turn of its own after that one
@@ -121,7 +122,8 @@ module Samagotchi
121
122
  # :queue
122
123
  # @return [String] the id of the session it went to
123
124
  # @raise [Error] no such session, a one-shot owns it, it wasn't taken
124
- # (a worker older than queueing refuses a queue), or delivery is
125
+ # (a worker older than queueing refuses a queue; a stopped or
126
+ # archived session: session_stopped / session_archived), or delivery is
125
127
  # :cut or unknown
126
128
  def send(id, text, delivery: nil)
127
129
  raise Error, "nothing to send" if text.to_s.strip.empty?
@@ -86,6 +86,9 @@ module Samagotchi
86
86
  return run_merge(dir) if parsed.options[:merge_subfolders]
87
87
 
88
88
  run_init(dir)
89
+ rescue MemoryPaths::ProjectIdConflict => e
90
+ error_line("#{command_name}: #{e.message}")
91
+ CLI::Exit::FAILED
89
92
  end
90
93
 
91
94
  private
@@ -114,7 +117,7 @@ module Samagotchi
114
117
 
115
118
  # @param found [MemoryPaths::ProjectLookup] the project (its root and id key the folder)
116
119
  def memories_line(found)
117
- dir = File.join(MemoryPaths.projects_dir(env: @env), MemoryPaths.key_for(root: found.root, id: found.id))
120
+ dir = File.join(MemoryPaths.projects_dir(env: @env), MemoryPaths.key_for(root: found.root, id: found.id, env: @env))
118
121
  count = memory_count(dir)
119
122
  "#{Paths.tilde(dir)}#{" (#{count} #{count == 1 ? "memory" : "memories"})" if count.positive?}"
120
123
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "fileutils"
3
4
  require_relative "atomic_file"
4
5
  require_relative "memory_paths"
5
6
  require_relative "paths"
@@ -11,52 +12,62 @@ module Samagotchi
11
12
  # MemoryOrphans), at every session start while it lasts.
12
13
  #
13
14
  # The claim: an id-keyed memories folder's `.root` names the folder that
14
- # last started a session with it (one line; a dotfile, so no *.md glob
15
- # lists it). Written only here, at session start, never by the key
16
- # resolver: a read-only command or a memory call must not write.
17
- ProjectIdClash = Data.define(:root, :other, :id) do
15
+ # owns it (one line; a dotfile, so no *.md glob lists it). A new folder is
16
+ # claimed before use; init also claims folders it moves or copies.
17
+ ProjectIdClash = Data.define(:root, :other, :id, :folder) do
18
+ def initialize(root:, other:, id:, folder: File.join(MemoryPaths.projects_dir, id))
19
+ super
20
+ end
21
+
18
22
  # The one text for the condition.
19
23
  def message
20
- "#{Paths.tilde(root)} and #{Paths.tilde(other)} share chi project id #{id} (a copied folder?): they share " \
21
- "memories. Run `chi project init --new-id` in the copy to give it its own."
24
+ if other.empty?
25
+ "#{folder} already exists and is not claimed by #{Paths.tilde(root)}; run `chi project init --new-id` " \
26
+ "to give this project its own id"
27
+ else
28
+ "#{Paths.tilde(root)} and #{Paths.tilde(other)} share chi project id #{id} (a copied folder?): " \
29
+ "#{folder} is already in use. Run `chi project init --new-id` in the copy to give it its own."
30
+ end
22
31
  end
23
32
  end
24
33
 
25
34
  class ProjectIdClash
26
- CLAIM = ".root"
35
+ CLAIM = MemoryPaths::CLAIM
27
36
 
28
- # +cwd+'s project, when a marked one with an id: a clash when the claim
29
- # names another folder that still has a marker with this id; otherwise
30
- # the claim is set to this root (when it changes; a moved folder just
31
- # takes it over). Only once the id folder exists: nothing is made for a
32
- # project with no memories yet.
37
+ # +cwd+'s project, when a marked one with an id: a clash when the id
38
+ # folder is already taken; otherwise the folder is claimed for this root
39
+ # (a moved folder just takes it over).
33
40
  # @return [ProjectIdClash, nil]
34
41
  def self.check(env: ENV, cwd: Dir.pwd, home: MemoryPaths.default_home)
35
42
  found = MemoryPaths.lookup(cwd, home: home)
36
43
  return nil unless found.id
37
44
 
38
45
  dir = File.join(MemoryPaths.projects_dir(env: env), found.id)
39
- return nil unless File.directory?(dir)
46
+ unless File.exist?(dir) || File.symlink?(dir)
47
+ FileUtils.mkdir_p(File.dirname(dir))
48
+ created = begin
49
+ Dir.mkdir(dir)
50
+ true
51
+ rescue Errno::EEXIST
52
+ false
53
+ end
54
+ if created
55
+ AtomicFile.write(File.join(dir, CLAIM), "#{found.root}\n")
56
+ return nil
57
+ end
58
+ end
40
59
 
41
60
  claim = File.join(dir, CLAIM)
42
61
  other = File.file?(claim) ? File.read(claim, 4096).to_s.lines.first.to_s.strip : ""
43
- return nil if other == found.root
44
- return new(root: found.root, other: other, id: found.id) if same_project?(other, found.id, home)
62
+ conflict = MemoryPaths.project_id_conflict(root: found.root, id: found.id, env: env, home: home)
63
+ return new(root: found.root, other: other, id: found.id, folder: dir) if conflict
45
64
 
46
- AtomicFile.write(claim, "#{found.root}\n")
65
+ AtomicFile.write(claim, "#{found.root}\n") unless other == found.root
47
66
  nil
48
67
  rescue SystemCallError
68
+ # Session start goes on: a memories folder chi can't make or claim
69
+ # is no clash to warn about.
49
70
  nil
50
71
  end
51
-
52
- # Whether +other+ still is a marked folder with +id+ (not gone, not
53
- # given another id).
54
- def self.same_project?(other, id, home)
55
- return false if other.empty? || !File.directory?(other)
56
-
57
- found = MemoryPaths.lookup(other, home: home)
58
- found.marker? && found.root == File.realpath(other) && found.id == id
59
- end
60
- private_class_method :same_project?
61
72
  end
62
73
  end
@@ -126,16 +126,31 @@ module Samagotchi
126
126
  end
127
127
 
128
128
  root = found.root
129
- old_key = MemoryPaths.key_for(root: root, id: found.id)
129
+ conflict = nil
130
+ old_key = begin
131
+ MemoryPaths.key_for(root: root, id: found.id, env: env, home: home)
132
+ rescue MemoryPaths::ProjectIdConflict => e
133
+ conflict = e
134
+ nil
135
+ end
130
136
  id = ProjectId.generate(File.basename(root))
131
137
  lines = ["#{Paths.tilde(root)} has a chi project id of its own now: #{id} (was #{found.id || "none: keyed by its path"})"]
132
- places(env: env, state_dir: state_dir || SessionPaths.default_state_dir(env: env)).each do |place|
133
- from = place.path(old_key)
134
- next unless File.directory?(from)
138
+ if conflict
139
+ lines << "did not copy #{Paths.tilde(conflict.folder)} because it is already used by another project"
140
+ else
141
+ project_places = places(env: env, state_dir: state_dir || SessionPaths.default_state_dir(env: env))
142
+ project_places.each do |place|
143
+ from = place.path(old_key)
144
+ next unless File.directory?(from)
135
145
 
136
- to = place.path(id)
137
- copy_folder(File.realpath(from), to)
138
- lines << "copied #{Paths.tilde(from)} to #{Paths.tilde(to)}"
146
+ to = place.path(id)
147
+ copy_folder(File.realpath(from), to)
148
+ lines << "copied #{Paths.tilde(from)} to #{Paths.tilde(to)}"
149
+ end
150
+ memory_folder = project_places.first.path(id)
151
+ if File.directory?(memory_folder)
152
+ AtomicFile.write(File.join(memory_folder, MemoryPaths::CLAIM), "#{root}\n")
153
+ end
139
154
  end
140
155
  write_id(root, id)
141
156
  Outcome.new(kind: :new_id, reason: nil, root: root, top: root, nested_in: nil, message: lines.join("\n"), id: id)
@@ -181,6 +196,8 @@ module Samagotchi
181
196
  "with it when the folder moves or is renamed"]
182
197
  lines << "#{problem}: replaced" if problem
183
198
  list.each { |place| lines.concat(move_folder(place.path(path_key), place.path(id))) }
199
+ memory_folder = list.first.path(id)
200
+ AtomicFile.write(File.join(memory_folder, MemoryPaths::CLAIM), "#{root}\n") if File.directory?(memory_folder)
184
201
  write_id(root, id)
185
202
  if orphans
186
203
  keys = orphans.candidates.map { |candidate| "#{Paths.tilde(candidate)} (#{MemoryOrphans.key_note(candidate)})" }
@@ -131,7 +131,8 @@ module Samagotchi
131
131
  # (#follow_into). Without one (a 0.156 worker, a turn with no id, a
132
132
  # merge from before the update) the merge is inferred
133
133
  # (ReplyWait.merged_elsewhere?) and waited for as the next reply past
134
- # the cursor, as without turn:, never as a turn that will not come.
134
+ # the cursor, as without turn:, never as a turn that will not come
135
+ # (compat shim merge_inference: Compat::SHIMS).
135
136
  def follow_merge(session, merge)
136
137
  return unless may_follow?
137
138