code-coordinator 0.5.596__py3-none-any.whl → 0.5.598__py3-none-any.whl
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.
- {code_coordinator-0.5.596.dist-info → code_coordinator-0.5.598.dist-info}/METADATA +1 -1
- {code_coordinator-0.5.596.dist-info → code_coordinator-0.5.598.dist-info}/RECORD +19 -16
- coord/app_drive.py +473 -0
- coord/app_drive_daemon.py +285 -0
- coord/bugbash.py +82 -10
- coord/cli.py +2 -0
- coord/commands/agent_ops.py +18 -1
- coord/commands/app_drive.py +258 -0
- coord/commands/bugbash.py +51 -11
- coord/commands/release.py +150 -5
- coord/gtk_native_driver.py +79 -1
- coord/mac_native_driver.py +92 -1
- coord/release_propagate.py +60 -7
- coord/tui_pty_driver.py +144 -0
- coord/win_native_driver.py +82 -1
- {code_coordinator-0.5.596.dist-info → code_coordinator-0.5.598.dist-info}/WHEEL +0 -0
- {code_coordinator-0.5.596.dist-info → code_coordinator-0.5.598.dist-info}/entry_points.txt +0 -0
- {code_coordinator-0.5.596.dist-info → code_coordinator-0.5.598.dist-info}/licenses/LICENSE +0 -0
- {code_coordinator-0.5.596.dist-info → code_coordinator-0.5.598.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
code_coordinator-0.5.
|
|
1
|
+
code_coordinator-0.5.598.dist-info/licenses/LICENSE,sha256=851BVZZwf_pEv2ydSlMmcZrwnwSS5YJ98wdLze7lyL8,4212
|
|
2
2
|
coord/__init__.py,sha256=3FN2qrrxtW87xSsSD557YcMwHLDahnFK8LvqQI7Wlf4,9783
|
|
3
3
|
coord/_board_mapping.py,sha256=U4DnAG_P8jv6IppoT-_-yJg3-0Ps0iYXYfRH7-pOg_E,12645
|
|
4
4
|
coord/acceptance.py,sha256=WspJv7soXc2cSXgn9s78BHD8y0qeGBIyaNmsAl4pYVc,119974
|
|
@@ -6,6 +6,8 @@ coord/acceptance_drivers.py,sha256=PvZHSHoWN_8SoELDBXmclYEMMslChSzHI7n7tkSMYB4,7
|
|
|
6
6
|
coord/agent.py,sha256=svpBc4PbPGyT5FdEyCYJ6HNbqeR6b5JN1FPIw1MmPek,564220
|
|
7
7
|
coord/agent_app.py,sha256=5j8yTtNN4GOtvtyqh6irIAfKajp1iTmH1H8G0VrO9ME,108807
|
|
8
8
|
coord/agent_update.py,sha256=BPMkNAFXb92LWWnlRjztPc6U2OBnuiKVLFBeLFa4E3Y,37922
|
|
9
|
+
coord/app_drive.py,sha256=NinZga_8xeLOCFXYUXa9aQy8xf3He1c88ANUFtFaDno,22060
|
|
10
|
+
coord/app_drive_daemon.py,sha256=Q-ZOCtXyGYZGX7ehhtPF8Pxw_ynuhsPlaOOdNmLi_kc,13033
|
|
9
11
|
coord/approved_work.py,sha256=wSoxJe2KeapPtDTfrM7mcCy-BrS6DhRvjnQr48Rnsh0,19207
|
|
10
12
|
coord/audit.py,sha256=8cYVK8ODjrOGqfxpabORZSvtjROZAWKhzV-Fbt4Ap64,23682
|
|
11
13
|
coord/auto_loop.py,sha256=mvrjseMvSIG__2t65AA5B3zKlRtYML0BzLwuGWQwTRE,94399
|
|
@@ -17,7 +19,7 @@ coord/board_wire.py,sha256=ytWfr50aZc4Wk8_TpZTNNO_Ug690F0-TP5_u-50IuUc,22654
|
|
|
17
19
|
coord/brain.py,sha256=E6ZXSY8Il4ffIKUhTs98jw-WunOqHqpSI-UI0L022hk,25706
|
|
18
20
|
coord/branch_model.py,sha256=ecjmzgpdbpUdGgSNABeXFUpuB9G78pDC4OBrwRqQPgA,10522
|
|
19
21
|
coord/bug_intake.py,sha256=YSjgWSrbnqQ0N4uElV5lnmygdUFkKUqIU_3RKCyhYaE,4681
|
|
20
|
-
coord/bugbash.py,sha256=
|
|
22
|
+
coord/bugbash.py,sha256=TAiOYoGQG7gdx2hN7LagRUJdJkJpZvQfcaa5mXFKxfw,105066
|
|
21
23
|
coord/cargo_cache.py,sha256=pTWcSERIMgDIi5WGPrYzVN-AfewW6k0hVgdUlpACEKU,44775
|
|
22
24
|
coord/ci_fix.py,sha256=p-VEwsX9Pkyjl_YYwSOjJT1uL9LDyfu5IdD7zeCKFoQ,23138
|
|
23
25
|
coord/ci_github.py,sha256=G_WjUTg3XKEd9SUW-tZi2xS78BtscZlti_gAor_3GF0,45623
|
|
@@ -25,7 +27,7 @@ coord/ci_gitlab.py,sha256=UKEva9ENr6cbbvRVXoig7v2BmVmVDuzFu17G350sFGU,24009
|
|
|
25
27
|
coord/ci_store.py,sha256=_MYxp4oqaPI5sJTU0AivqjzzdLSBgkGveTnxk84icwQ,40473
|
|
26
28
|
coord/claim.py,sha256=v3a4U3EEDD5flzWAAlJpp14I3flquysasbIYI5KSiw4,27380
|
|
27
29
|
coord/claude_setup_token.py,sha256=dAX5458ooaOZyn-_e_xpc1CxIDiNSuyk4EQMK8n7xGM,12673
|
|
28
|
-
coord/cli.py,sha256=
|
|
30
|
+
coord/cli.py,sha256=K4_xkWcM9S9Au83zKqT56fDiP7fXGcTaT0HsqOn3xWQ,21033
|
|
29
31
|
coord/client.py,sha256=mpygdje1Ez4-KeC-EYSmUZfcVk-jvRlvkDm-ghwSxG8,57093
|
|
30
32
|
coord/codegen.py,sha256=cB7kTCe0NHsFTlWROABWfpkAATGa2H4zJ3Y0_581WSc,94659
|
|
31
33
|
coord/comments.py,sha256=WuIrG1i05CYoKSLRq6oFjdUZD-eKabfayvKtL4QJPVc,41965
|
|
@@ -68,7 +70,7 @@ coord/github_ops.py,sha256=sRtz6H-dUkcDpm0jTaJWkT32_CuxVWan7s8Sj39USbk,183814
|
|
|
68
70
|
coord/github_throttle.py,sha256=3INPLLE5j7DeNoJ4TovHapgkC_S-_PSUzX_sqZIrkCU,27186
|
|
69
71
|
coord/goal.py,sha256=URYTwPHFU2zpCjrDYoKoItZiNCb8EMaOzMTOfY51dSs,5198
|
|
70
72
|
coord/graph_health.py,sha256=VN9Eg3uTMlcQ3Hm-tNUhW0-LjMsBp7To_jd5-avdfkI,29823
|
|
71
|
-
coord/gtk_native_driver.py,sha256=
|
|
73
|
+
coord/gtk_native_driver.py,sha256=d8re3GcYVveHdQrUucZ-dDvjMjUkHFSx96ktvQl_Fjs,40516
|
|
72
74
|
coord/hooks.py,sha256=fdEwUf1zGF7xFm9TqlTda94EmtH2Tl8NNVeD-JfpkvA,3968
|
|
73
75
|
coord/housekeeping.py,sha256=YAtC_UqhpPCxnpD7lTiJ7FnR0HY0rYpGe17d9yznNCg,18762
|
|
74
76
|
coord/interactive.py,sha256=qFu-sZTA8103L9eX26NxVikXH9dDgUhPfdn3_nNdaww,221247
|
|
@@ -76,7 +78,7 @@ coord/invariant_alarms.py,sha256=rfvoGPM0N9mH-OIGCzVQIkDv1n5CGEwDIQyu0n8L2y4,116
|
|
|
76
78
|
coord/issue_store.py,sha256=wEKGa6oKxIL_TLwE76a1eY3TIiGOOYPiwRfQo8YibQ0,74606
|
|
77
79
|
coord/issues_sync_status.py,sha256=_6ucx7oW3TUGZZvs93wRbzR_SUQcNlz-7RptOzr4alo,9262
|
|
78
80
|
coord/liveness_auditor.py,sha256=sf_xBklt37DUnrIEeD4fVp4_gWPDaXbydZgfuWAPFRE,12478
|
|
79
|
-
coord/mac_native_driver.py,sha256=
|
|
81
|
+
coord/mac_native_driver.py,sha256=AZKmB_qXkKt5ewsHoqLHDcfPhdJTi69ArFduN4X9UIs,48944
|
|
80
82
|
coord/machine_fault.py,sha256=Ii24eHpWjMEG-j65pAVYU3f2JvI_eLAd2TAh3auURgQ,16944
|
|
81
83
|
coord/machine_metrics.py,sha256=paWqBTZgeIi7w1pgH5QSJL59UxwetxE8bXblzzcspSI,16300
|
|
82
84
|
coord/machine_onboard.py,sha256=6QynWfcXkG54JIyJou-0aCfdnomzUtKD4NPLr_pz3hQ,126936
|
|
@@ -113,7 +115,7 @@ coord/reconcile_tick.py,sha256=sQWfNcxetnC1vMWK0yKaqWW0HpBbDyKV5Tdc9yuWAVY,2908
|
|
|
113
115
|
coord/refine_chat.py,sha256=u-GFMazvNDfuaSenVebmszhuRvtcuVNEgNXZz3l5pP4,18447
|
|
114
116
|
coord/release_cordon.py,sha256=iVBVsY91N91kD2fZxxrjqEk-AwFJQgqT51mKhb_77So,82766
|
|
115
117
|
coord/release_gate.py,sha256=RQr_zoKQxtLw-lh_TMGaCAbsBHXEAeNtCWMZV6TkBPo,19572
|
|
116
|
-
coord/release_propagate.py,sha256=
|
|
118
|
+
coord/release_propagate.py,sha256=ytvPyvYmmEFDP7SIm8-HtZHLkK4dogUw-OF6GjLx3kk,94051
|
|
117
119
|
coord/release_verify.py,sha256=XatRKJzNpMdoWjhjIjAtG5Xme1k5tCrKzi-jB2eUIO4,43550
|
|
118
120
|
coord/release_window.py,sha256=g2flkEKjvFM-mMhKGOConJCwpNP_vlZWo5A9fVGGmAk,22688
|
|
119
121
|
coord/repo_dormancy.py,sha256=gtMxkBfvu7Qbg45SiCOyYnz2X2stfVca3R9oXTqONXw,9147
|
|
@@ -140,14 +142,14 @@ coord/test_author.py,sha256=EITILu_eWvFXpM99caUmJOCTDW3nciQrM1BlcRM3Anw,60183
|
|
|
140
142
|
coord/test_chat.py,sha256=lz5tRbZdqgk1xvbzVvtPmwgrEfZ5FG_LdKusjtEcC9k,12644
|
|
141
143
|
coord/test_orchestrator.py,sha256=ANwHWtmQR2cOSEQ-5U1mvcfZl_PDs3xReXkMpS-S1Fs,20279
|
|
142
144
|
coord/test_report.py,sha256=Wxt85t5zd5EBIaCcGsQELCwpUhMxeZ3tle6YCXe_9i0,8547
|
|
143
|
-
coord/tui_pty_driver.py,sha256=
|
|
145
|
+
coord/tui_pty_driver.py,sha256=lsPTNkfMkla26Y3U-nj7iTuUXxwxp64GPtDnedZTOII,53443
|
|
144
146
|
coord/tui_release.py,sha256=WbQW0MmTKxvL3SJVTYZdXmQYriymZB8CpnjEG9TSQno,19768
|
|
145
147
|
coord/uat_checks.py,sha256=Izp3_dcPrWGR190kMQAKH_U1RumzmCkwgqX6aM0N_xo,12136
|
|
146
148
|
coord/usage.py,sha256=Gyl1AXSMWiR1yCs1GXuNN_jdfUIU7WZNfr4qJAFEZr8,39933
|
|
147
149
|
coord/usage_limits.py,sha256=NJHINN42s_AFzMCm58fo97t0Q5fZn3o8ozBTcXbFGJw,21884
|
|
148
150
|
coord/usage_rollup.py,sha256=8ktXVJnKqrN6lcOX2LD22STXIKSvbp7Ji1fhnT94HwQ,29549
|
|
149
151
|
coord/win_native_bridge.py,sha256=WV69h9V3-2c-ezNSAL5wmUqK9wpET8ru3CKktxPIn4o,24218
|
|
150
|
-
coord/win_native_driver.py,sha256=
|
|
152
|
+
coord/win_native_driver.py,sha256=2lRxcCpL6XxB34aVf-CYI8-CrNrCrr9rX-GNiet9uGY,64141
|
|
151
153
|
coord/worker_events.py,sha256=nsrr2rvHx69ex2vU8h6kxO33WJD6H-a4nGZ8F7GpNPg,62810
|
|
152
154
|
coord/agents/opencode/.gitignore,sha256=ILxVS75q0F95TKz1WTf-kIzd9uN3M5zoJHzQkUuwbIc,687
|
|
153
155
|
coord/agents/opencode/routing.jsonc,sha256=853ltOkE3T0wBKBNXIPiHg-hVoyeQ21QnA8S8L_yU4Q,2596
|
|
@@ -155,10 +157,11 @@ coord/agents/opencode/agents/work.md,sha256=RjxrgggIgUyWwknrwAmNwIsVL_SoExozbIi6
|
|
|
155
157
|
coord/commands/__init__.py,sha256=VqpqriVqQZMtBdFMIcsKR5Z-oDyNUONcghycTJFRSjw,53
|
|
156
158
|
coord/commands/_common.py,sha256=SU-DR5ihacNnoXxuwvSludnU-ir7HcUrIWjh-trqmec,32220
|
|
157
159
|
coord/commands/acceptance.py,sha256=Cmhpyuhkl3oN12_Z4VPUcuJN-7qQ7hu-GoKPdmxGCPE,57437
|
|
158
|
-
coord/commands/agent_ops.py,sha256=
|
|
160
|
+
coord/commands/agent_ops.py,sha256=YKDecgBd45J2e8ABEtIzSF8xvRga5FHyX-TYNiBLPUI,69167
|
|
161
|
+
coord/commands/app_drive.py,sha256=TI5ViDYzOYUvaYGjzVBsQmxeYm1MuFu1mJnV-qQZL0M,10964
|
|
159
162
|
coord/commands/audit.py,sha256=r8MzMM4XZX_upQOIOHkksjIo6bv0jT7CuTlm96ACVS0,5283
|
|
160
163
|
coord/commands/backup.py,sha256=mqQJG0IOD9ryXNdJV923H6s1KpD1eHLMdCBEoCdyP8s,3270
|
|
161
|
-
coord/commands/bugbash.py,sha256=
|
|
164
|
+
coord/commands/bugbash.py,sha256=Ebj9Pd42r8VFvlNF1WOWz3Oe7lfE8GJl2oSkhz3zN2I,44570
|
|
162
165
|
coord/commands/chat.py,sha256=iaYHebAIve4jzMzhyWSk8sFwpr2LnUc3y8onwHqns14,11080
|
|
163
166
|
coord/commands/ci.py,sha256=fgennRo4PXEJ7TTQDig7ZEPo0AmynyHB0a4tdiS1XfE,8538
|
|
164
167
|
coord/commands/codegen.py,sha256=eQitFmXbPoVY0W4OoqhLVgZPNLIzCgSP5Ktq8K09S04,1933
|
|
@@ -178,7 +181,7 @@ coord/commands/plan_followup.py,sha256=WEB_wps_F-yriFJywteTKsAZbMm2ohWb74KPBnOoE
|
|
|
178
181
|
coord/commands/plans.py,sha256=EV23euH6lVTIH6rkNr_mBPrXG__LVs8njSJgMBmd-H4,13709
|
|
179
182
|
coord/commands/portal.py,sha256=RLUD_tfJ9pH3DplHAa8n3BY58k02870Afa7ayJyNE8E,111522
|
|
180
183
|
coord/commands/pr.py,sha256=J-8wMjymkT50bQdWP6KoHcX5PdfA-ChJuvym6t1byZc,19966
|
|
181
|
-
coord/commands/release.py,sha256=
|
|
184
|
+
coord/commands/release.py,sha256=Ny2NWnt4lGArxAXMTFMOE4UYMAdKjWsZjl7NHNAGzG8,245462
|
|
182
185
|
coord/commands/repo.py,sha256=ga6nfl-STq2Bq6n9jupwuQGtjpX0gMFrBFaLYgL949o,120738
|
|
183
186
|
coord/commands/report.py,sha256=PNHNi2AJ9cDzD6y_nK7kW-6K3kbJAZZ8C1_sQ4jF4-I,23159
|
|
184
187
|
coord/commands/review.py,sha256=TRtYwCO_k9fYKOhBvhcTRf97o9bEtG6k574HnBJxQ74,68533
|
|
@@ -287,8 +290,8 @@ coord/skills/review-verdict-recovery/SKILL.md,sha256=Grg8GWkJLK20ct2YiigbTFfNOki
|
|
|
287
290
|
coord/skills/tui-quadraui-workflow/SKILL.md,sha256=4hUZza9wSSnPhf0eRAOh2r_MQZxK2pXYO5g-kxmJq-U,3832
|
|
288
291
|
coord/skills/update-issue/SKILL.md,sha256=VrPinEmLZrCSNDrnz96hQomyO403o5c4i0RdsnUnWA0,3642
|
|
289
292
|
coord/templates/deploy-cloudflare.node.yml,sha256=icsTiWn2ziQJnpZODhhFKYlnqjt2xAXsbwlQufdxhuM,2078
|
|
290
|
-
code_coordinator-0.5.
|
|
291
|
-
code_coordinator-0.5.
|
|
292
|
-
code_coordinator-0.5.
|
|
293
|
-
code_coordinator-0.5.
|
|
294
|
-
code_coordinator-0.5.
|
|
293
|
+
code_coordinator-0.5.598.dist-info/METADATA,sha256=bngUWJlx7TSAPbtwfGmxRAo0w8rOpZR7lPcd_xMLEDQ,17031
|
|
294
|
+
code_coordinator-0.5.598.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
295
|
+
code_coordinator-0.5.598.dist-info/entry_points.txt,sha256=o-Hq8pvG7ReGePvN_4iOKjLNqiq-MJ43HbPurqjNPZo,41
|
|
296
|
+
code_coordinator-0.5.598.dist-info/top_level.txt,sha256=w5sTrXesTCebhXyYv2qufOZGo0PoD1Lxgn0Q3MAXjh4,6
|
|
297
|
+
code_coordinator-0.5.598.dist-info/RECORD,,
|
coord/app_drive.py
ADDED
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
"""``coord app-drive`` (#3590): the sanctioned, runnable entry point a
|
|
2
|
+
bugbash lane worker drives the real app through — this module is the
|
|
3
|
+
shared plumbing new in this issue; the CLI surface lives in
|
|
4
|
+
:mod:`coord.commands.app_drive`.
|
|
5
|
+
|
|
6
|
+
**Why this exists.** #3566 added a HARD RULE telling a lane worker to
|
|
7
|
+
"drive the app ONLY through this lane's own driver" and never improvise an
|
|
8
|
+
input-injection helper — but named three Python *module* paths
|
|
9
|
+
(``coord.mac_native_driver`` etc.) that are not tools, not CLI commands,
|
|
10
|
+
and not reachable from a worker's Bash tool at all. Every real bugbash run
|
|
11
|
+
since then came back with zero journeys driven: workers correctly refused
|
|
12
|
+
to improvise, and correctly found nothing resembling the named modules in
|
|
13
|
+
their own tool list. This module (plus
|
|
14
|
+
:mod:`coord.tui_pty_driver`'s ``TuiPtySession``,
|
|
15
|
+
:mod:`coord.mac_native_driver`'s ``MacNativeSession``,
|
|
16
|
+
:mod:`coord.win_native_driver`'s ``WinNativeSession``,
|
|
17
|
+
:mod:`coord.gtk_native_driver`'s ``GtkNativeSession``) is that missing
|
|
18
|
+
entry point.
|
|
19
|
+
|
|
20
|
+
**Design choice: a persistent per-session daemon + a short-lived control
|
|
21
|
+
connection per verb.** A worker's Bash tool runs one command at a time —
|
|
22
|
+
there is no way to keep a single process's stdin open across separate tool
|
|
23
|
+
calls, so "keep a session alive across calls" requires the session itself
|
|
24
|
+
to live in its OWN process, outside the lifetime of any one ``coord
|
|
25
|
+
app-drive`` invocation. ``open`` spawns that process (:mod:`coord
|
|
26
|
+
.app_drive_daemon`) once; it listens on an ephemeral localhost TCP port
|
|
27
|
+
(works identically on Linux/macOS/the dell64 win-native WSL bridge — no
|
|
28
|
+
``AF_UNIX`` availability gamble on Windows) for one-shot JSON-line
|
|
29
|
+
connections, each carrying exactly one verb. ``send``/``screen``/``probe``/
|
|
30
|
+
``close`` are each a fresh, short connection; the app being driven (a real
|
|
31
|
+
pty child, or a real native GUI process) stays open underneath for the
|
|
32
|
+
WHOLE session, held by the daemon.
|
|
33
|
+
|
|
34
|
+
**Teardown is guaranteed two ways, not one:**
|
|
35
|
+
|
|
36
|
+
1. ``close`` sends the daemon a ``"close"`` op, which tears its backend
|
|
37
|
+
down (the exact same confirmed terminate-then-kill :meth:`PtyChild.close`
|
|
38
|
+
already gives every other tui-pty caller, armed with the #3583
|
|
39
|
+
kernel-level parent-death signal on Linux; a plain, confirmed
|
|
40
|
+
``kill(pid)`` for a native session) and then exits — :func:`close_session`
|
|
41
|
+
does not report success until it has OBSERVED the daemon process
|
|
42
|
+
actually gone (#2096: a sent signal is not a confirmed death).
|
|
43
|
+
2. Absent an explicit ``close`` (the worker's own session ends, a crash,
|
|
44
|
+
a network partition), the daemon self-expires after *idle_timeout*
|
|
45
|
+
seconds with no command (default 30 minutes) — see
|
|
46
|
+
:mod:`coord.app_drive_daemon`'s accept-loop — tearing its backend down
|
|
47
|
+
the same way. This is deliberately NOT process-group-based: the daemon
|
|
48
|
+
is spawned detached (:func:`open_session` passes `start_new_session=True`
|
|
49
|
+
on POSIX, `CREATE_NEW_PROCESS_GROUP` on Windows) so it survives
|
|
50
|
+
independently of whatever process group the ``coord app-drive open``
|
|
51
|
+
invocation itself ran in — exactly what "session alive across calls"
|
|
52
|
+
requires when a Bash tool reaps its own command's process group on
|
|
53
|
+
completion/timeout (a common sandbox configuration, and the reason
|
|
54
|
+
#3583 exists at all: killing that group must not take the daemon with
|
|
55
|
+
it). The idle self-expiry is what prevents that same detachment from
|
|
56
|
+
leaking a session forever if nobody ever calls ``close``.
|
|
57
|
+
3. :func:`close_session` does not stop at observing the *daemon's* own
|
|
58
|
+
pid — it also re-observes (and, if necessary, directly signals) the
|
|
59
|
+
real app/pty-child pid the daemon reported at ``open`` time
|
|
60
|
+
(``SessionHandle.app_pid``), so a daemon that had to be SIGKILLed
|
|
61
|
+
before its own ``finally: backend.close()`` ever ran does not leave
|
|
62
|
+
the driven app itself running underneath (#3590 review: "unconfirmed
|
|
63
|
+
success is a defect", epic #2096).
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
from __future__ import annotations
|
|
67
|
+
|
|
68
|
+
import json
|
|
69
|
+
import os
|
|
70
|
+
import secrets
|
|
71
|
+
import signal
|
|
72
|
+
import socket
|
|
73
|
+
import subprocess
|
|
74
|
+
import sys
|
|
75
|
+
import time
|
|
76
|
+
import uuid
|
|
77
|
+
from dataclasses import dataclass
|
|
78
|
+
from pathlib import Path
|
|
79
|
+
|
|
80
|
+
from coord.platform_paths import default_coord_dir
|
|
81
|
+
|
|
82
|
+
#: Every lane kind this module knows how to drive — kept in sync BY HAND
|
|
83
|
+
#: with :data:`coord.bugbash.LANE_DRIVER_KINDS` (this module intentionally
|
|
84
|
+
#: does not import :mod:`coord.bugbash` — the dependency runs the other way,
|
|
85
|
+
#: :mod:`coord.bugbash`/:mod:`coord.commands.bugbash` name a command this
|
|
86
|
+
#: module serves, not the reverse).
|
|
87
|
+
APP_DRIVE_KINDS: tuple[str, ...] = ("tui-pty", "win-native", "mac-native", "gtk-native")
|
|
88
|
+
|
|
89
|
+
#: Default: a session nobody ever explicitly `close`s is torn down this many
|
|
90
|
+
#: seconds after its last command — long enough for a thorough exploration
|
|
91
|
+
#: (the #3569 incident this repo already tolerates for a whole bugbash lane
|
|
92
|
+
#: is measured in tens of minutes), short enough that an abandoned session
|
|
93
|
+
#: from a crashed/killed worker doesn't orphan a real GUI process/pty child
|
|
94
|
+
#: for the life of the host.
|
|
95
|
+
DEFAULT_IDLE_TIMEOUT = 1800.0
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class AppDriveError(Exception):
|
|
99
|
+
"""Raised for any ``coord app-drive`` client-side failure: a session
|
|
100
|
+
file that doesn't exist or is stale, a daemon that refused/dropped the
|
|
101
|
+
connection, or a backend verb that itself raised."""
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class AppDriveUnavailableError(AppDriveError):
|
|
105
|
+
"""``open`` observed a locked/absent session (#3510) or a missing
|
|
106
|
+
permission grant (#3566) BEFORE launching anything — the native-lane
|
|
107
|
+
environment condition the bugbash HARD RULE tells a worker to report
|
|
108
|
+
as unavailable, never improvise past. Distinct from every other
|
|
109
|
+
:class:`AppDriveError` so a caller (``coord app-drive <kind> open``)
|
|
110
|
+
can print the exact ``reason`` text a worker folds straight into its
|
|
111
|
+
own ```` ```bugbash-unavailable ```` fence.
|
|
112
|
+
|
|
113
|
+
This is the ONE definition — :mod:`coord.app_drive_daemon` imports it
|
|
114
|
+
from here rather than keeping its own copy, so a future in-process
|
|
115
|
+
caller of :func:`coord.app_drive_daemon._build_backend` can never end
|
|
116
|
+
up catching the wrong class for what is, on the wire, the exact same
|
|
117
|
+
signal (a ready-file ``{"error": "unavailable", ...}``)."""
|
|
118
|
+
|
|
119
|
+
def __init__(self, reason: str) -> None:
|
|
120
|
+
super().__init__(reason)
|
|
121
|
+
self.reason = reason
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def _sessions_dir() -> Path:
|
|
125
|
+
d = default_coord_dir() / "app-drive"
|
|
126
|
+
d.mkdir(parents=True, exist_ok=True)
|
|
127
|
+
return d
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def _session_file(session_id: str) -> Path:
|
|
131
|
+
return _sessions_dir() / f"{session_id}.json"
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
@dataclass(frozen=True)
|
|
135
|
+
class SessionHandle:
|
|
136
|
+
"""What :func:`open_session` hands back, and what every later verb
|
|
137
|
+
(:func:`send_command`/:func:`close_session`) re-reads from disk by
|
|
138
|
+
*session_id* — never trusted as a long-lived in-memory object, since
|
|
139
|
+
each CLI invocation is a fresh process with no memory of the last one.
|
|
140
|
+
|
|
141
|
+
``app_pid`` is the backend's own best-known pid for the real app/pty
|
|
142
|
+
child it launched (``getattr(backend, "pid", None)`` in
|
|
143
|
+
:mod:`coord.app_drive_daemon`'s ready-file write) — distinct from
|
|
144
|
+
``pid``, the app-drive *daemon's* own pid. ``None`` when a backend has
|
|
145
|
+
no such pid to report. :func:`close_session` re-observes (and, if
|
|
146
|
+
necessary, directly signals) THIS pid too, not just the daemon's, so a
|
|
147
|
+
SIGKILLed daemon cannot silently leave the real app running (#3590
|
|
148
|
+
review). ``token`` authenticates every command sent to the daemon's
|
|
149
|
+
control socket (#3590 review: the socket has no other authentication,
|
|
150
|
+
and the port is already world-readable from this very session file —
|
|
151
|
+
a stolen token is no bigger a leak than a stolen port, but it does
|
|
152
|
+
stop an unrelated local process from merely *guessing* the port and
|
|
153
|
+
injecting commands)."""
|
|
154
|
+
|
|
155
|
+
session_id: str
|
|
156
|
+
kind: str
|
|
157
|
+
pid: int
|
|
158
|
+
port: int
|
|
159
|
+
token: str
|
|
160
|
+
app_pid: int | None = None
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def _write_session_file(handle: SessionHandle) -> None:
|
|
164
|
+
path = _session_file(handle.session_id)
|
|
165
|
+
# #3590 review (nit): a distinct suffix from the daemon's own
|
|
166
|
+
# `<id>.ready` -> `<id>.tmp` so the two atomic-write temp files can
|
|
167
|
+
# never collide even if their write windows ever overlapped.
|
|
168
|
+
tmp = path.with_suffix(".session.tmp")
|
|
169
|
+
tmp.write_text(json.dumps({
|
|
170
|
+
"session_id": handle.session_id, "kind": handle.kind,
|
|
171
|
+
"pid": handle.pid, "port": handle.port, "token": handle.token,
|
|
172
|
+
"app_pid": handle.app_pid,
|
|
173
|
+
}))
|
|
174
|
+
tmp.replace(path)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def load_session(session_id: str) -> SessionHandle:
|
|
178
|
+
"""Read back a previously `open`ed session's registry entry.
|
|
179
|
+
|
|
180
|
+
Raises :class:`AppDriveError` — never a bare ``FileNotFoundError``/
|
|
181
|
+
``KeyError`` — when *session_id* is unknown or its file is corrupt, so
|
|
182
|
+
every CLI verb gets one consistent "no such session" message."""
|
|
183
|
+
path = _session_file(session_id)
|
|
184
|
+
try:
|
|
185
|
+
raw = json.loads(path.read_text())
|
|
186
|
+
except (OSError, ValueError) as e:
|
|
187
|
+
raise AppDriveError(f"no such app-drive session {session_id!r}: {e}") from e
|
|
188
|
+
try:
|
|
189
|
+
return SessionHandle(
|
|
190
|
+
session_id=raw["session_id"], kind=raw["kind"],
|
|
191
|
+
pid=int(raw["pid"]), port=int(raw["port"]),
|
|
192
|
+
token=raw.get("token", ""),
|
|
193
|
+
app_pid=int(raw["app_pid"]) if raw.get("app_pid") is not None else None,
|
|
194
|
+
)
|
|
195
|
+
except (KeyError, TypeError, ValueError) as e:
|
|
196
|
+
raise AppDriveError(f"corrupt app-drive session file for {session_id!r}: {e}") from e
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def _forget_session(session_id: str) -> None:
|
|
200
|
+
try:
|
|
201
|
+
_session_file(session_id).unlink()
|
|
202
|
+
except OSError:
|
|
203
|
+
pass
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def _pid_alive(pid: int) -> bool:
|
|
207
|
+
"""Whether *pid* is still a live process right now — an OBSERVATION
|
|
208
|
+
(#2096), never inferred from "we haven't been told otherwise".
|
|
209
|
+
|
|
210
|
+
First tries a non-blocking reap (``waitpid(pid, WNOHANG)``): when
|
|
211
|
+
*pid* is a direct child of THIS process (true for a caller that opened
|
|
212
|
+
the session and is now closing it within the same long-lived process —
|
|
213
|
+
a test, or any in-process caller; NOT true for the common real case of
|
|
214
|
+
separate ``coord app-drive open``/``close`` CLI invocations, which are
|
|
215
|
+
unrelated processes to begin with) and has already exited, the kernel
|
|
216
|
+
keeps it as a zombie — still a valid ``/proc`` entry, and
|
|
217
|
+
``kill(pid, 0)`` still succeeds against it — until something calls
|
|
218
|
+
``wait()`` on it. Reaping it here first (and treating a successfully
|
|
219
|
+
reaped pid as dead) avoids exactly that false "still alive" reading
|
|
220
|
+
rather than leaking the question to whatever POSIX returns for a
|
|
221
|
+
zombie. ``ChildProcessError`` (not our child at all — the common case)
|
|
222
|
+
falls through to the real liveness probe.
|
|
223
|
+
|
|
224
|
+
POSIX's null-signal probe (``kill(pid, 0)``) is a read-only existence
|
|
225
|
+
check. Windows has no such thing: ``os.kill(pid, 0)`` there maps
|
|
226
|
+
straight to ``TerminateProcess(handle, 0)`` — a *literal* kill with
|
|
227
|
+
exit code 0, not a probe — so this branches to a real, non-destructive
|
|
228
|
+
``OpenProcess`` existence check via ``ctypes`` instead of reusing the
|
|
229
|
+
POSIX call under a different OS.
|
|
230
|
+
"""
|
|
231
|
+
if sys.platform != "win32":
|
|
232
|
+
try:
|
|
233
|
+
reaped_pid, _status = os.waitpid(pid, os.WNOHANG)
|
|
234
|
+
if reaped_pid == pid:
|
|
235
|
+
return False
|
|
236
|
+
except ChildProcessError:
|
|
237
|
+
pass # not our child — fall through to the real probe below
|
|
238
|
+
if sys.platform == "win32":
|
|
239
|
+
import ctypes # noqa: PLC0415 — Windows-only path
|
|
240
|
+
|
|
241
|
+
# PROCESS_QUERY_LIMITED_INFORMATION (0x1000) is enough to confirm
|
|
242
|
+
# the handle opens at all; it grants no control over the process,
|
|
243
|
+
# so this can never accidentally affect it.
|
|
244
|
+
handle = ctypes.windll.kernel32.OpenProcess(0x1000, False, pid)
|
|
245
|
+
if not handle:
|
|
246
|
+
return False
|
|
247
|
+
ctypes.windll.kernel32.CloseHandle(handle)
|
|
248
|
+
return True
|
|
249
|
+
try:
|
|
250
|
+
os.kill(pid, 0)
|
|
251
|
+
except ProcessLookupError:
|
|
252
|
+
return False
|
|
253
|
+
except PermissionError:
|
|
254
|
+
# Exists, owned by someone else (or a racing setuid) — still alive.
|
|
255
|
+
return True
|
|
256
|
+
except OSError:
|
|
257
|
+
return False
|
|
258
|
+
return True
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def send_command(handle: SessionHandle, command: dict, *, timeout: float = 30.0) -> dict:
|
|
262
|
+
"""Send one JSON *command* to *handle*'s daemon over a fresh TCP
|
|
263
|
+
connection and return its one JSON-line reply.
|
|
264
|
+
|
|
265
|
+
Raises :class:`AppDriveError` on a connection failure (the daemon is
|
|
266
|
+
gone/unreachable — a stale session, never silently treated as "the verb
|
|
267
|
+
succeeded") or a reply the daemon itself flagged as an error. Stamps
|
|
268
|
+
*handle*'s own ``token`` onto *command* (#3590 review: the only
|
|
269
|
+
authentication the control socket has — see :class:`SessionHandle`)."""
|
|
270
|
+
command = {**command, "token": handle.token}
|
|
271
|
+
try:
|
|
272
|
+
with socket.create_connection(("127.0.0.1", handle.port), timeout=timeout) as sock:
|
|
273
|
+
sock.sendall((json.dumps(command) + "\n").encode("utf-8"))
|
|
274
|
+
sock.settimeout(timeout)
|
|
275
|
+
chunks = []
|
|
276
|
+
while True:
|
|
277
|
+
chunk = sock.recv(65536)
|
|
278
|
+
if not chunk:
|
|
279
|
+
break
|
|
280
|
+
chunks.append(chunk)
|
|
281
|
+
if b"\n" in chunk:
|
|
282
|
+
break
|
|
283
|
+
raw = b"".join(chunks).decode("utf-8", errors="replace")
|
|
284
|
+
except OSError as e:
|
|
285
|
+
raise AppDriveError(
|
|
286
|
+
f"could not reach app-drive session {handle.session_id!r} on port "
|
|
287
|
+
f"{handle.port}: {e}"
|
|
288
|
+
) from e
|
|
289
|
+
line = raw.strip().splitlines()[0] if raw.strip() else ""
|
|
290
|
+
try:
|
|
291
|
+
reply = json.loads(line)
|
|
292
|
+
except ValueError as e:
|
|
293
|
+
raise AppDriveError(f"app-drive daemon sent an unparseable reply: {e}") from e
|
|
294
|
+
if not isinstance(reply, dict):
|
|
295
|
+
raise AppDriveError(f"app-drive daemon reply was not a JSON object: {reply!r}")
|
|
296
|
+
if reply.get("error"):
|
|
297
|
+
raise AppDriveError(str(reply["error"]))
|
|
298
|
+
return reply
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
def open_session(
|
|
302
|
+
kind: str, *, launch: str, cwd: str, cols: int = 80, rows: int = 24,
|
|
303
|
+
width: int | None = None, height: int | None = None,
|
|
304
|
+
idle_timeout: float = DEFAULT_IDLE_TIMEOUT, ready_timeout: float = 30.0,
|
|
305
|
+
python: str | None = None,
|
|
306
|
+
) -> SessionHandle:
|
|
307
|
+
"""Spawn :mod:`coord.app_drive_daemon` for *kind* and wait for it to
|
|
308
|
+
confirm it's actually listening before returning (#2096: "opened" is an
|
|
309
|
+
observation of the daemon's own ready-file, never the mere fact that
|
|
310
|
+
``Popen`` didn't raise).
|
|
311
|
+
|
|
312
|
+
The daemon is spawned genuinely DETACHED — ``start_new_session=True``
|
|
313
|
+
on POSIX (``setsid()``: a new session AND a new process group),
|
|
314
|
+
``CREATE_NEW_PROCESS_GROUP`` on Windows — so it is never a member of
|
|
315
|
+
whatever process group this ``coord app-drive open`` invocation itself
|
|
316
|
+
ran in. This is load-bearing, not cosmetic (#3590 review): an agent
|
|
317
|
+
Bash tool that reaps its own command's process group on
|
|
318
|
+
completion/timeout (a common sandbox configuration, and the reason
|
|
319
|
+
#3583 exists at all) would otherwise take the daemon down with the
|
|
320
|
+
very CLI call that started it, failing the very next ``send``. The
|
|
321
|
+
idle self-expiry (:mod:`coord.app_drive_daemon`) remains the backstop
|
|
322
|
+
for the case nobody ever calls ``close`` at all.
|
|
323
|
+
"""
|
|
324
|
+
if kind not in APP_DRIVE_KINDS:
|
|
325
|
+
raise AppDriveError(f"unknown app-drive kind {kind!r} — expected one of {APP_DRIVE_KINDS}")
|
|
326
|
+
|
|
327
|
+
session_id = uuid.uuid4().hex[:12]
|
|
328
|
+
token = secrets.token_hex(16)
|
|
329
|
+
ready_file = _sessions_dir() / f"{session_id}.ready"
|
|
330
|
+
if ready_file.exists():
|
|
331
|
+
ready_file.unlink()
|
|
332
|
+
|
|
333
|
+
argv = [
|
|
334
|
+
python or sys.executable, "-m", "coord.app_drive_daemon",
|
|
335
|
+
"--kind", kind, "--launch", launch, "--cwd", cwd,
|
|
336
|
+
"--cols", str(cols), "--rows", str(rows),
|
|
337
|
+
"--idle-timeout", str(idle_timeout), "--ready-file", str(ready_file),
|
|
338
|
+
"--token", token,
|
|
339
|
+
]
|
|
340
|
+
if width is not None:
|
|
341
|
+
argv += ["--width", str(width)]
|
|
342
|
+
if height is not None:
|
|
343
|
+
argv += ["--height", str(height)]
|
|
344
|
+
detach_kwargs: dict = (
|
|
345
|
+
{"creationflags": subprocess.CREATE_NEW_PROCESS_GROUP} if sys.platform == "win32"
|
|
346
|
+
else {"start_new_session": True}
|
|
347
|
+
)
|
|
348
|
+
proc = subprocess.Popen( # noqa: S603 — *launch* is the lane worker's own, not untrusted input
|
|
349
|
+
argv, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, text=True, **detach_kwargs,
|
|
350
|
+
)
|
|
351
|
+
|
|
352
|
+
try:
|
|
353
|
+
deadline = time.monotonic() + ready_timeout
|
|
354
|
+
while time.monotonic() < deadline:
|
|
355
|
+
if ready_file.exists():
|
|
356
|
+
try:
|
|
357
|
+
ready = json.loads(ready_file.read_text())
|
|
358
|
+
ready_file.unlink()
|
|
359
|
+
except (OSError, ValueError):
|
|
360
|
+
time.sleep(0.05)
|
|
361
|
+
continue
|
|
362
|
+
if ready.get("error") == "unavailable":
|
|
363
|
+
# #3510/#3566: the backend's own session-available/
|
|
364
|
+
# permission precheck failed BEFORE launching anything
|
|
365
|
+
# — surface this as the dedicated unavailable signal,
|
|
366
|
+
# not a generic open failure, so a worker's own
|
|
367
|
+
# open-time check can fold `reason` straight into its
|
|
368
|
+
# unavailable fence.
|
|
369
|
+
raise AppDriveUnavailableError(ready.get("reason", "lane unavailable"))
|
|
370
|
+
if ready.get("error"):
|
|
371
|
+
raise AppDriveError(
|
|
372
|
+
f"app-drive daemon for kind {kind!r} failed to open: "
|
|
373
|
+
f"{ready.get('reason', ready['error'])}"
|
|
374
|
+
)
|
|
375
|
+
handle = SessionHandle(
|
|
376
|
+
session_id=session_id, kind=kind,
|
|
377
|
+
pid=int(ready["pid"]), port=int(ready["port"]), token=token,
|
|
378
|
+
app_pid=int(ready["app_pid"]) if ready.get("app_pid") is not None else None,
|
|
379
|
+
)
|
|
380
|
+
_write_session_file(handle)
|
|
381
|
+
return handle
|
|
382
|
+
if proc.poll() is not None:
|
|
383
|
+
stderr = proc.stderr.read() if proc.stderr else ""
|
|
384
|
+
raise AppDriveError(
|
|
385
|
+
f"app-drive daemon for kind {kind!r} exited before becoming "
|
|
386
|
+
f"ready (code {proc.returncode}): {stderr.strip()}"
|
|
387
|
+
)
|
|
388
|
+
time.sleep(0.05)
|
|
389
|
+
proc.kill()
|
|
390
|
+
raise AppDriveError(
|
|
391
|
+
f"app-drive daemon for kind {kind!r} did not become ready within "
|
|
392
|
+
f"{ready_timeout:.0f}s"
|
|
393
|
+
)
|
|
394
|
+
finally:
|
|
395
|
+
# #3590 review (nit): close the stderr pipe we opened above on
|
|
396
|
+
# every exit path — the daemon keeps running past this function
|
|
397
|
+
# returning on the success path, so there is nothing to `wait()`
|
|
398
|
+
# for, but the now-unread pipe FD itself must still be closed or
|
|
399
|
+
# a long-lived in-process caller accumulates `ResourceWarning`s.
|
|
400
|
+
if proc.stderr is not None:
|
|
401
|
+
proc.stderr.close()
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
def _target_pids(handle: SessionHandle) -> tuple[int, ...]:
|
|
405
|
+
"""Every pid a confirmed teardown of *handle* must observe dead — the
|
|
406
|
+
daemon's own pid, PLUS the real app/pty-child pid it reported at open
|
|
407
|
+
time (``app_pid``), when that's known and distinct (#3590 review: a
|
|
408
|
+
``closed: true`` that only proves the daemon died is not teardown
|
|
409
|
+
confirmation for the app it was driving)."""
|
|
410
|
+
if handle.app_pid is not None and handle.app_pid != handle.pid:
|
|
411
|
+
return (handle.pid, handle.app_pid)
|
|
412
|
+
return (handle.pid,)
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
def _all_dead(pids: tuple[int, ...]) -> bool:
|
|
416
|
+
return all(not _pid_alive(pid) for pid in pids)
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
def close_session(handle: SessionHandle, *, timeout: float = 15.0) -> bool:
|
|
420
|
+
"""Tear *handle* down and confirm it (#2096) — only reports success once
|
|
421
|
+
BOTH the daemon process AND the real app/pty-child it was driving
|
|
422
|
+
(``handle.app_pid``, when known) are OBSERVED gone, escalating from
|
|
423
|
+
"ask nicely" to SIGTERM to SIGKILL against each rather than trusting
|
|
424
|
+
any one step — or the daemon's own cooperation — blindly. Removes the
|
|
425
|
+
on-disk session file only once confirmed dead (or already gone).
|
|
426
|
+
|
|
427
|
+
This closes the gap #3590's review flagged: the escalation path used
|
|
428
|
+
to SIGKILL only the daemon. If that SIGKILL fires before the daemon's
|
|
429
|
+
own ``finally: backend.close()`` ever runs, the real app survived
|
|
430
|
+
while this function still reported ``closed: true`` — now this
|
|
431
|
+
function independently re-observes, and if necessary directly
|
|
432
|
+
signals, ``app_pid`` too, so that gap cannot reopen regardless of
|
|
433
|
+
whether the daemon cooperates.
|
|
434
|
+
|
|
435
|
+
Returns ``False`` — never raises — if any target pid is still alive
|
|
436
|
+
after every escalation: a gate that reports teardown success must be
|
|
437
|
+
able to actually fail that report (epic #2096), not default to "assume
|
|
438
|
+
it worked"."""
|
|
439
|
+
targets = _target_pids(handle)
|
|
440
|
+
try:
|
|
441
|
+
send_command(handle, {"op": "close"}, timeout=min(timeout, 10.0))
|
|
442
|
+
except AppDriveError:
|
|
443
|
+
pass # already gone, or refused — the pid-based confirmation below is authoritative
|
|
444
|
+
|
|
445
|
+
deadline = time.monotonic() + timeout
|
|
446
|
+
while time.monotonic() < deadline:
|
|
447
|
+
if _all_dead(targets):
|
|
448
|
+
_forget_session(handle.session_id)
|
|
449
|
+
return True
|
|
450
|
+
time.sleep(0.1)
|
|
451
|
+
|
|
452
|
+
# `SIGKILL` doesn't exist on Windows (`signal` there defines no POSIX
|
|
453
|
+
# kill signals beyond `SIGTERM`/`SIGBREAK`) — `os.kill(pid, SIGTERM)`
|
|
454
|
+
# there already maps to a hard `TerminateProcess`, so there is no
|
|
455
|
+
# weaker-then-stronger escalation to make; just retry the one signal
|
|
456
|
+
# Windows actually has.
|
|
457
|
+
escalation = (signal.SIGTERM, signal.SIGKILL) if hasattr(signal, "SIGKILL") else (signal.SIGTERM, signal.SIGTERM)
|
|
458
|
+
for sig in escalation:
|
|
459
|
+
for pid in targets:
|
|
460
|
+
if not _pid_alive(pid):
|
|
461
|
+
continue
|
|
462
|
+
try:
|
|
463
|
+
os.kill(pid, sig)
|
|
464
|
+
except (ProcessLookupError, PermissionError, OSError):
|
|
465
|
+
pass
|
|
466
|
+
escalate_deadline = time.monotonic() + 3.0
|
|
467
|
+
while time.monotonic() < escalate_deadline:
|
|
468
|
+
if _all_dead(targets):
|
|
469
|
+
_forget_session(handle.session_id)
|
|
470
|
+
return True
|
|
471
|
+
time.sleep(0.1)
|
|
472
|
+
|
|
473
|
+
return False
|