PTY: surface errno from forkpty/write/ioctl failures (T-75)

forkpty failures throw PtyException with the captured errno
(previously a generic StateError). The spawned child's chdir/execve
failures write a diagnostic line to its slave PTY before _exit, so
the parent's reader sees "exec failed: <path>" instead of an
indistinguishable EOF.

NativePty.write and PtySession.write loop on short writes and throw
PtyException on hard errors (with errno). NativePty.resize sets
_dead on EBADF so subsequent calls short-circuit cleanly.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-05-05 15:07:25 +02:00
co-authored by Claude
parent 816e60d028
commit 0d333e8470
4 changed files with 213 additions and 122 deletions
+124 -110
View File
@@ -1,5 +1,5 @@
{
"exported_at": "2026-05-05T13:02:30Z",
"exported_at": "2026-05-05T13:07:25Z",
"decisions": [
{
"id": "D-1",
@@ -9,7 +9,7 @@
"status": "active",
"date": "2026-04-20",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-3",
@@ -19,7 +19,7 @@
"status": "active",
"date": "2026-04-20",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-4",
@@ -29,7 +29,7 @@
"status": "active",
"date": "2026-04-20",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-5",
@@ -39,7 +39,7 @@
"status": "active",
"date": "2026-04-20",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-6",
@@ -49,7 +49,7 @@
"status": "active",
"date": "2026-04-20",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-7",
@@ -59,7 +59,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-8",
@@ -69,7 +69,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-9",
@@ -79,7 +79,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-10",
@@ -89,7 +89,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-11",
@@ -99,7 +99,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-12",
@@ -109,7 +109,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-13",
@@ -119,7 +119,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-14",
@@ -129,7 +129,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-15",
@@ -139,7 +139,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/extensions.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-16",
@@ -149,7 +149,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/extensions.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-17",
@@ -159,7 +159,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/extensions.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-18",
@@ -169,7 +169,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/extensions.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-19",
@@ -179,7 +179,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/extensions.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-20",
@@ -189,7 +189,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/accessibility.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-21",
@@ -199,7 +199,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/accessibility.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-22",
@@ -209,7 +209,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/accessibility.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-23",
@@ -219,7 +219,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-24",
@@ -229,7 +229,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-25",
@@ -239,7 +239,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-26",
@@ -249,7 +249,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-27",
@@ -259,7 +259,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-28",
@@ -269,7 +269,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-29",
@@ -279,7 +279,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-30",
@@ -289,7 +289,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/testing.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-31",
@@ -299,7 +299,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-32",
@@ -309,7 +309,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-33",
@@ -319,7 +319,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-34",
@@ -329,7 +329,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/process.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-35",
@@ -339,7 +339,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/process.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-36",
@@ -349,7 +349,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/process.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-37",
@@ -359,7 +359,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/process.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-38",
@@ -369,7 +369,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/process.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-39",
@@ -379,7 +379,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/process.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-40",
@@ -389,7 +389,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/process.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-41",
@@ -399,7 +399,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-42",
@@ -409,7 +409,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-43",
@@ -419,7 +419,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-44",
@@ -429,7 +429,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-45",
@@ -439,7 +439,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-46",
@@ -449,7 +449,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/extensions.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-47",
@@ -459,7 +459,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-48",
@@ -469,7 +469,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-49",
@@ -479,7 +479,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-50",
@@ -489,7 +489,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-51",
@@ -499,7 +499,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-52",
@@ -509,7 +509,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-53",
@@ -519,7 +519,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-54",
@@ -529,7 +529,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-55",
@@ -539,7 +539,7 @@
"status": "active",
"date": "2026-04-23",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-56",
@@ -549,7 +549,7 @@
"status": "active",
"date": "2026-04-23",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-57",
@@ -559,7 +559,7 @@
"status": "active",
"date": "2026-04-23",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-58",
@@ -569,7 +569,7 @@
"status": "active",
"date": "2026-04-23",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-59",
@@ -579,7 +579,7 @@
"status": "active",
"date": "2026-04-25",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-60",
@@ -589,7 +589,7 @@
"status": "active",
"date": "2026-04-26",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-61",
@@ -599,7 +599,7 @@
"status": "active",
"date": "2026-04-26",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-62",
@@ -609,7 +609,7 @@
"status": "active",
"date": "2026-04-26",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-63",
@@ -619,7 +619,7 @@
"status": "active",
"date": "2026-04-26",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-64",
@@ -629,7 +629,7 @@
"status": "active",
"date": "2026-05-03",
"file_path": "decisions/architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "D-65",
@@ -639,7 +639,7 @@
"status": "active",
"date": "2026-04-26",
"file_path": "decisions/tooling.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-1",
@@ -648,7 +648,7 @@
"title": "Authorisation granularity on the IPC socket",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-2",
@@ -657,7 +657,7 @@
"title": "Back-pressure on event streams",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-3",
@@ -666,7 +666,7 @@
"title": "Event persistence + audit/undo",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-4",
@@ -675,7 +675,7 @@
"title": "`.canvas` schema compatibility with Obsidian",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-5",
@@ -684,7 +684,7 @@
"title": "IPC wire-format stability + `schema_version:`",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-6",
@@ -693,7 +693,7 @@
"title": "Window chrome — native frame vs frameless custom",
"status": "resolved",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-7",
@@ -702,7 +702,7 @@
"title": "macOS app bundle signing / notarisation",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-8",
@@ -711,7 +711,7 @@
"title": "Extension API shape — widgets, subcommands, both?",
"status": "open",
"file_path": "decisions/questions-extensions.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-9",
@@ -720,7 +720,7 @@
"title": "Lua runtime vendoring",
"status": "open",
"file_path": "decisions/questions-extensions.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-10",
@@ -729,7 +729,7 @@
"title": "Extension manifest `schema_version:`",
"status": "open",
"file_path": "decisions/questions-extensions.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-11",
@@ -738,7 +738,7 @@
"title": "Coverage gates — hard thresholds vs soft reporting",
"status": "open",
"file_path": "decisions/questions-testing.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-12",
@@ -747,7 +747,7 @@
"title": "Screen-reader automation (axe-core via Playwright)",
"status": "open",
"file_path": "decisions/questions-testing.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-13",
@@ -756,7 +756,7 @@
"title": "Web production-mode a11y",
"status": "open",
"file_path": "decisions/questions-accessibility.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-14",
@@ -765,7 +765,7 @@
"title": "i18n plurals / gender / date-format tooling",
"status": "open",
"file_path": "decisions/questions-accessibility.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-15",
@@ -774,7 +774,7 @@
"title": "Editor tab — full LSP vs tree-sitter-only highlight",
"status": "open",
"file_path": "decisions/questions-process.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-16",
@@ -783,7 +783,7 @@
"title": "`tree-sitter-dart` grammar maintenance",
"status": "open",
"file_path": "decisions/questions-process.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-17",
@@ -792,7 +792,7 @@
"title": "Icon set growth",
"status": "open",
"file_path": "decisions/questions-process.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-18",
@@ -801,7 +801,7 @@
"title": "Theme hot-reload in release builds",
"status": "open",
"file_path": "decisions/questions-process.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-19",
@@ -810,7 +810,7 @@
"title": "(withdrawn)",
"status": "resolved",
"file_path": "decisions/questions-process.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-20",
@@ -819,7 +819,7 @@
"title": "Kernel DB service — namespaced SQL access?",
"status": "open",
"file_path": "decisions/questions-process.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-21",
@@ -828,7 +828,7 @@
"title": "Pql absorbs planning vs keeps separate",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-22",
@@ -837,7 +837,7 @@
"title": "Ticket persistence strategy",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-23",
@@ -846,7 +846,7 @@
"title": "SSH-remote development — run clide against a remote workspace",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-25",
@@ -855,7 +855,7 @@
"title": "Body text face — mono everywhere vs Josefin Sans UI + mono code",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-26",
@@ -864,7 +864,7 @@
"title": "Small screen layout (\u003c 1000px)",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-27",
@@ -873,7 +873,7 @@
"title": "Two-editor split",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-28",
@@ -882,7 +882,7 @@
"title": "Terminal strip scope — shell only or logs/errors/tests",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-29",
@@ -891,7 +891,7 @@
"title": "Branch picker location",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-30",
@@ -900,7 +900,7 @@
"title": "Focus behavior when editor is dirty and viewer is peeked",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "Q-31",
@@ -909,7 +909,7 @@
"title": "XWayland fallback for frameless — proper Wayland protocol needed",
"status": "open",
"file_path": "decisions/questions-architecture.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "R-2",
@@ -919,7 +919,7 @@
"status": "active",
"date": "2026-04-20",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "R-3",
@@ -929,7 +929,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "R-4",
@@ -939,7 +939,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "R-5",
@@ -949,7 +949,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "R-6",
@@ -959,7 +959,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "R-7",
@@ -969,7 +969,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "R-8",
@@ -979,7 +979,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "R-9",
@@ -989,7 +989,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "R-10",
@@ -999,7 +999,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "R-11",
@@ -1009,7 +1009,7 @@
"status": "active",
"date": "2026-04-21",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
},
{
"id": "R-12",
@@ -1019,7 +1019,7 @@
"status": "active",
"date": "2026-04-22",
"file_path": "decisions/rejected.md",
"synced_at": "2026-05-03 20:40:19"
"synced_at": "2026-05-05 13:07:03"
}
],
"decision_refs": [
@@ -2606,10 +2606,10 @@
"id": "T-75",
"type": "task",
"title": "PTY: surface errno from forkpty/execve/write/ioctl failures",
"status": "backlog",
"status": "in_progress",
"priority": "high",
"created_at": "2026-05-05 12:58:59",
"updated_at": "2026-05-05 12:58:59"
"updated_at": "2026-05-05 13:02:40"
},
{
"id": "T-76",
@@ -2633,10 +2633,10 @@
"id": "T-78",
"type": "bug",
"title": "files.read path traversal — validate paths stay under workspace root",
"status": "in_progress",
"status": "done",
"priority": "high",
"created_at": "2026-05-05 12:58:59",
"updated_at": "2026-05-05 12:59:50"
"updated_at": "2026-05-05 13:02:34"
},
{
"id": "T-79",
@@ -3933,6 +3933,20 @@
"old_value": "backlog",
"new_value": "in_progress",
"changed_at": "2026-05-05 12:59:50"
},
{
"ticket_id": "T-78",
"field": "status",
"old_value": "in_progress",
"new_value": "done",
"changed_at": "2026-05-05 13:02:34"
},
{
"ticket_id": "T-75",
"field": "status",
"old_value": "backlog",
"new_value": "in_progress",
"changed_at": "2026-05-05 13:02:40"
}
]
}
+7
View File
@@ -27,6 +27,13 @@ heading, and (b) bumping `pubspec.yaml` `version:` in the same commit.
- Terminal cell grid no longer drifts on bold text — bold rendering
is suppressed at the painter level since synthetic bold (with no
Bold.ttf registered) shifts glyph advance widths.
- PTY surfaces errno on `forkpty`, `write`, and `ioctl` failures
instead of swallowing them. `execve` failures in the spawned
child now write a diagnostic line to the slave PTY before
`_exit`, so the parent's reader sees the cause instead of an
immediate EOF that looked indistinguishable from clean exit.
PTY `write` loops on short writes; both `NativePty.write` and
`PtySession.write` now throw `PtyException` on hard errors.
### Security
+63 -10
View File
@@ -17,6 +17,9 @@ import 'dart:typed_data';
import 'package:ffi/ffi.dart';
import 'errors.dart';
import 'ffi/libc.dart' as libc;
// -- structs ----------------------------------------------------------------
final class _Winsize extends ffi.Struct {
@@ -125,6 +128,17 @@ class NativePty {
final execve = _execve;
final chdir = _chdir;
final exit = _exit_;
final writeFn = _nativeWrite;
// Pre-allocate error envelopes the child will write to its stdout
// (slave PTY → parent's master fd) before _exit, so the parent's
// reader sees a real diagnostic instead of an indistinguishable EOF.
final chdirErr = 'clide: chdir failed: $workingDirectory\n'
.toNativeUtf8(allocator: malloc);
final chdirErrLen = chdirErr.length;
final execveErr = 'clide: exec failed: $executable\n'
.toNativeUtf8(allocator: malloc);
final execveErrLen = execveErr.length;
// Allocate ALL native memory before fork.
final shellN = executable.toNativeUtf8(allocator: malloc).cast<ffi.Char>();
@@ -153,20 +167,33 @@ class NativePty {
final pid = _forkpty(fdOut, ffi.nullptr, ffi.nullptr, ws);
if (pid == -1) {
// Capture errno BEFORE _freeAll — free() can clobber errno.
final err = libc.errno;
_freeAll(shellN, argvN, allArgs.length, envpN, envList.length, wdN, fdOut, ws);
throw StateError('forkpty() failed');
malloc.free(chdirErr);
malloc.free(execveErr);
throw PtyException('forkpty', 'forkpty() failed', errno: err);
}
if (pid == 0) {
// CHILD — only pre-resolved FFI calls, no Dart heap.
chdir(wdN);
// After forkpty(), fd 1 is the slave PTY connected back to the
// parent's master fd, so write(1, ...) lands as readable output.
if (chdir(wdN) != 0) {
writeFn(1, chdirErr.cast(), chdirErrLen);
exit(1);
}
execve(shellN, argvN, envpN);
// execve only returns on failure.
writeFn(1, execveErr.cast(), execveErrLen);
exit(1);
}
// PARENT
final fd = fdOut.value;
_freeAll(shellN, argvN, allArgs.length, envpN, envList.length, wdN, fdOut, ws);
malloc.free(chdirErr);
malloc.free(execveErr);
final pty = NativePty._(fd, pid);
pty._spawnReader();
@@ -240,26 +267,52 @@ class NativePty {
port.send(null);
}
/// Write bytes to the child's stdin.
/// Write bytes to the child's stdin. Loops on short writes; throws
/// [PtyException] (with errno) on failure. Returns the total bytes
/// written, which is always [bytes.length] on success.
int write(List<int> bytes) {
if (_dead || bytes.isEmpty) return 0;
final buf = malloc<ffi.Uint8>(bytes.length);
for (var i = 0; i < bytes.length; i++) buf[i] = bytes[i];
final n = _nativeWrite(_fd, buf.cast(), bytes.length);
malloc.free(buf);
return n;
try {
for (var i = 0; i < bytes.length; i++) buf[i] = bytes[i];
var written = 0;
while (written < bytes.length) {
final n = _nativeWrite(
_fd,
buf.elementAt(written).cast(),
bytes.length - written,
);
if (n < 0) {
final err = libc.errno;
if (err == 4 /* EINTR */) continue;
if (err == 9 /* EBADF */ || err == 32 /* EPIPE */) _dead = true;
throw PtyException('write', 'write to PTY failed', errno: err);
}
if (n == 0) break;
written += n;
}
return written;
} finally {
malloc.free(buf);
}
}
/// Resize the terminal.
/// Resize the terminal. Silently no-ops if the fd is already
/// closed; flips [_dead] on EBADF so subsequent calls short-circuit.
void resize({required int cols, required int rows}) {
if (_dead) return;
final ws = calloc<_Winsize>()
..ref.wsRow = rows
..ref.wsCol = cols;
_ioctl(_fd, _kTiocsWinsz, ws);
final rc = _ioctl(_fd, _kTiocsWinsz, ws);
calloc.free(ws);
if (rc < 0 && libc.errno == 9 /* EBADF */) {
_dead = true;
return;
}
// Explicitly signal the child to re-query its terminal size.
_nativeKill(pid, 28); // SIGWINCH = 28 on macOS/Linux
// SIGWINCH = 28 on both macOS and Linux.
_nativeKill(pid, 28);
}
/// Send a signal to the child.
+19 -2
View File
@@ -161,7 +161,9 @@ class PtySession {
}
}
/// Send bytes to the child's stdin.
/// Send bytes to the child's stdin. Loops on short writes; throws
/// [PtyException] (with errno) on failure. Returns total bytes
/// written, which equals [bytes.length] on success.
int write(List<int> bytes) {
if (isClosed) return 0;
final buf = pkg_ffi.calloc<ffi.Uint8>(bytes.length);
@@ -169,7 +171,22 @@ class PtySession {
for (var i = 0; i < bytes.length; i++) {
buf[i] = bytes[i];
}
return libc.write(_masterFd, buf, bytes.length);
var written = 0;
while (written < bytes.length) {
final n = libc.write(
_masterFd,
buf.elementAt(written),
bytes.length - written,
);
if (n < 0) {
final err = libc.errno;
if (err == 4 /* EINTR */) continue;
throw PtyException('write', 'write to PTY failed', errno: err);
}
if (n == 0) break;
written += n;
}
return written;
} finally {
pkg_ffi.calloc.free(buf);
}