refactor(acp): land PR #199 audit fixes
CI / ci (push) Canceled after 0s
CI / ci (pull_request) Canceled after 0s
CI / ci (push) Canceled after 0s
CI / ci (pull_request) Canceled after 0s
Reviewer fanout (ponytail/security/general) over #199 found no behavior defects. Apply the accepted non-behavioral findings: - requestOutcome helper dedups the two outcome tasks; the two discarded wedge tasks drop their unread do/catch scaffolding - awaitBounded doc names its real bound (window is green-world only; the RED-world watchdog is the fake's /bin/sleep 30 exit) - send() gains a ponytail ceiling comment: queued sends are unbounded and a send racing close() writes onto a closed handle (benign, probe-verified) — bounded by the model's sequential sends; guard if a looping caller appears - request() doc notes a timed-out request's bytes may still land on the wire (late replies dropped, ids never reused) Suite 697/697 green post-change; format+lint clean.
This commit is contained in:
1 parent
ce21057586
commit
9ccfe83ec0
2 files changed
+46
-41
No files matched your search
@@ -157,6 +157,10 @@ final nonisolated class ACPEngineClient: @unchecked Sendable {
|
||||
/// Send a JSON-RPC request and await its matching response result.
|
||||
/// A request that gets no answer within `timeout` fails — a hung engine
|
||||
/// must surface as an error (→ restart prompt), never an eternal await.
|
||||
/// brief-27: a timed-out request's bytes may still reach the engine once
|
||||
/// the child unblocks (the deadline fails the caller, never dequeues the
|
||||
/// write) — phantom engine work only: ids are never reused and the
|
||||
/// response path drops unknown ids, so a late reply can never misroute.
|
||||
/// (No default arguments: the only caller is EngineHost, which rides the
|
||||
/// seam — `EngineTransport.request`'s convenience owns the default shape.)
|
||||
func request(_ method: String, params: JSONValue?, timeout: TimeInterval) async throws -> JSONValue? {
|
||||
@@ -261,6 +265,13 @@ final nonisolated class ACPEngineClient: @unchecked Sendable {
|
||||
/// brief-27: the write runs on the WRITER queue, never the state queue —
|
||||
/// a blocked write here starves no deadline and no teardown.
|
||||
private func send(_ data: Data) {
|
||||
// ponytail: queued sends are unbounded, and a send racing close() writes
|
||||
// onto a closed handle (benign — write throws a catchable CocoaError 512
|
||||
// that try? swallows; probe-verified by two independent reviewers).
|
||||
// Bounded today by MentorSessionModel's sequential-send discipline (a
|
||||
// request is awaited before the next; worst case one prompt + one
|
||||
// cancel). Add a closed/depth guard here if a looping or
|
||||
// non-MainActor caller ever appears.
|
||||
writerQueue.async {
|
||||
var framed = Data(data)
|
||||
framed.append(0x0A)
|
||||
|
||||
Reference in new issue
Block a user