cuboid 0.5.1 → 0.5.3
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.
- checksums.yaml +4 -4
- data/cuboid.gemspec +7 -0
- data/lib/cuboid/rpc/server/scheduler.rb +34 -4
- data/lib/version +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7e228403b3674734d40d364f2bc87e3e8efe86bda1a4f754c5e543b69401a8d2
|
|
4
|
+
data.tar.gz: 75b93efe42509e457f94d7c85757e51eba295829a9ac7992226ef3f1f3848cd6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c84ac945c7cb02ef348b4ac2bf5fd17985d89a92b64d879b55350a3e296ae5ae5925c97677633272d7b598cd300e0e9090743eb07171ff022a8ea94650c2de83
|
|
7
|
+
data.tar.gz: f2d529e89a10b4bc17f9be774da64a1160676cc58b7d0a328bfad3009df59fba2cc3581a2adbec862f79ece2b5058531d7107a6649ddcac1e12b0de3a1c47177
|
data/cuboid.gemspec
CHANGED
|
@@ -56,6 +56,13 @@ Gem::Specification.new do |s|
|
|
|
56
56
|
# mounts MCP::Server::Transports::StreamableHTTPTransport as a Rack app.
|
|
57
57
|
s.add_dependency 'mcp', '>= 0.15'
|
|
58
58
|
|
|
59
|
+
# MCP::Tool input/output schema validation. We `require 'json-schema'`
|
|
60
|
+
# directly (Cuboid::MCP::Server, and downstream Apex/Spectre application
|
|
61
|
+
# gems do too) — it used to ride in transitively via `mcp`, but newer mcp
|
|
62
|
+
# releases dropped it, so declare it explicitly here. Cuboid is a pinned
|
|
63
|
+
# dependency of those app gems, so declaring it once here covers them too.
|
|
64
|
+
s.add_dependency 'json-schema'
|
|
65
|
+
|
|
59
66
|
# RPC client/server implementation.
|
|
60
67
|
s.add_dependency 'toq'
|
|
61
68
|
|
|
@@ -45,6 +45,13 @@ class Scheduler
|
|
|
45
45
|
|
|
46
46
|
TICK_CONSUME = 0.1
|
|
47
47
|
|
|
48
|
+
# Number of CONSECUTIVE RPC errors a running Instance is allowed to
|
|
49
|
+
# accumulate before it's given up on and marked {#failed}. A single
|
|
50
|
+
# transient blip (the Instance momentarily unreachable on one ping, an
|
|
51
|
+
# engine reconnect, etc.) shouldn't fail an otherwise-healthy scan; any
|
|
52
|
+
# clean response in between resets the count.
|
|
53
|
+
RPC_ERROR_TOLERANCE = 5
|
|
54
|
+
|
|
48
55
|
def initialize
|
|
49
56
|
@options = Options.instance
|
|
50
57
|
|
|
@@ -62,9 +69,11 @@ class Scheduler
|
|
|
62
69
|
@id_to_priority = {}
|
|
63
70
|
@by_priority = {}
|
|
64
71
|
|
|
65
|
-
@running
|
|
66
|
-
@completed
|
|
67
|
-
@failed
|
|
72
|
+
@running = {}
|
|
73
|
+
@completed = {}
|
|
74
|
+
@failed = {}
|
|
75
|
+
# Per-Instance consecutive RPC-error counters (see RPC_ERROR_TOLERANCE).
|
|
76
|
+
@rpc_error_counts = Hash.new( 0 )
|
|
68
77
|
|
|
69
78
|
set_handlers( @server )
|
|
70
79
|
trap_interrupts { Thread.new { shutdown } }
|
|
@@ -335,17 +344,37 @@ class Scheduler
|
|
|
335
344
|
handle_rpc_error( id, busy )
|
|
336
345
|
block.call
|
|
337
346
|
elsif busy
|
|
347
|
+
# Clean response — the Instance is reachable and working, so
|
|
348
|
+
# reset its consecutive-error tolerance.
|
|
349
|
+
@rpc_error_counts.delete( id )
|
|
338
350
|
print_debug "[#{id}] Busy."
|
|
339
351
|
block.call
|
|
340
352
|
else
|
|
353
|
+
# Don't reset here: this leads to the report grab, whose own
|
|
354
|
+
# transient errors must be allowed to accumulate toward the
|
|
355
|
+
# tolerance rather than being cleared every ping.
|
|
341
356
|
get_report_and_shutdown( id, client, &block )
|
|
342
357
|
end
|
|
343
358
|
end
|
|
344
359
|
end
|
|
345
360
|
|
|
346
361
|
def handle_rpc_error( id, error )
|
|
347
|
-
|
|
362
|
+
@rpc_error_counts[id] += 1
|
|
363
|
+
count = @rpc_error_counts[id]
|
|
364
|
+
|
|
365
|
+
# Tolerate transient errors — only give up after RPC_ERROR_TOLERANCE
|
|
366
|
+
# of them in a row. The Instance stays in @running and gets re-checked
|
|
367
|
+
# on the next ping; a clean response resets the count.
|
|
368
|
+
if count < RPC_ERROR_TOLERANCE
|
|
369
|
+
print_error "[#{id}] RPC error #{count}/#{RPC_ERROR_TOLERANCE} " \
|
|
370
|
+
"(tolerating): [#{error.class}] #{error}"
|
|
371
|
+
return
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
print_error "[#{id}] Failed after #{count} consecutive RPC errors: " \
|
|
375
|
+
"[#{error.class}] #{error}"
|
|
348
376
|
|
|
377
|
+
@rpc_error_counts.delete( id )
|
|
349
378
|
@failed[id] = {
|
|
350
379
|
error: error.class.to_s,
|
|
351
380
|
description: error.to_s
|
|
@@ -371,6 +400,7 @@ class Scheduler
|
|
|
371
400
|
client.shutdown do
|
|
372
401
|
print_status "[#{id}] Completed."
|
|
373
402
|
|
|
403
|
+
@rpc_error_counts.delete( id )
|
|
374
404
|
@running.delete( id ).close
|
|
375
405
|
@completed[id] = path
|
|
376
406
|
|
data/lib/version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.5.
|
|
1
|
+
0.5.3
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cuboid
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tasos Laskos
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-06-
|
|
11
|
+
date: 2026-06-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: awesome_print
|
|
@@ -192,6 +192,20 @@ dependencies:
|
|
|
192
192
|
- - ">="
|
|
193
193
|
- !ruby/object:Gem::Version
|
|
194
194
|
version: '0.15'
|
|
195
|
+
- !ruby/object:Gem::Dependency
|
|
196
|
+
name: json-schema
|
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
|
198
|
+
requirements:
|
|
199
|
+
- - ">="
|
|
200
|
+
- !ruby/object:Gem::Version
|
|
201
|
+
version: '0'
|
|
202
|
+
type: :runtime
|
|
203
|
+
prerelease: false
|
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
205
|
+
requirements:
|
|
206
|
+
- - ">="
|
|
207
|
+
- !ruby/object:Gem::Version
|
|
208
|
+
version: '0'
|
|
195
209
|
- !ruby/object:Gem::Dependency
|
|
196
210
|
name: toq
|
|
197
211
|
requirement: !ruby/object:Gem::Requirement
|