Commit e8b0b9c
committed
Fix AGENTS.md loading: workspace first, project fallback
Add Runtime abstraction support for reading AGENTS.md from workspaces,
with graceful fallback to project root when workspace file doesn't exist.
Problem:
- SSH workspaces are on remote machines, can't use local fs.readFile()
- AGENTS.md may not be cloned into SSH workspace yet
- Need to support both local worktrees and remote SSH workspaces
Solution:
- Add runtime parameter to buildSystemMessage()
- Read workspace AGENTS.md using Runtime.readFile() (works for SSH)
- Fall back to project root AGENTS.md if workspace doesn't have one
- Preserves branch-specific instructions for local workspaces
- Provides sensible defaults for SSH workspaces during clone
Changes:
- buildSystemMessage() now accepts Runtime parameter
- New readInstructionSetFromRuntime() uses runtime to read workspace files
- Instruction priority: global → workspace (if exists) → project (fallback)
- Mode section priority: workspace → project → global
- Updated docs/instruction-files.md to reflect fallback behavior
- Updated all tests to pass runtime parameter
- Updated aiService.ts to pass runtime to buildSystemMessage()
This preserves existing test behavior (workspace-specific instructions work)
while adding robustness for SSH workspaces where files may not exist yet.1 parent 09772a0 commit e8b0b9c
File tree
5 files changed
+96
-25
lines changed- docs
- src/services
- tests/ipcMain
5 files changed
+96
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | | - | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | | - | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
508 | 508 | | |
509 | 509 | | |
510 | 510 | | |
| 511 | + | |
511 | 512 | | |
512 | 513 | | |
513 | 514 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
29 | 34 | | |
30 | 35 | | |
31 | 36 | | |
| |||
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
58 | | - | |
| 63 | + | |
59 | 64 | | |
60 | 65 | | |
61 | 66 | | |
| |||
86 | 91 | | |
87 | 92 | | |
88 | 93 | | |
89 | | - | |
| 94 | + | |
90 | 95 | | |
91 | 96 | | |
92 | 97 | | |
| |||
125 | 130 | | |
126 | 131 | | |
127 | 132 | | |
128 | | - | |
| 133 | + | |
129 | 134 | | |
130 | 135 | | |
131 | 136 | | |
| |||
160 | 165 | | |
161 | 166 | | |
162 | 167 | | |
163 | | - | |
| 168 | + | |
164 | 169 | | |
165 | 170 | | |
166 | 171 | | |
| |||
181 | 186 | | |
182 | 187 | | |
183 | 188 | | |
184 | | - | |
| 189 | + | |
185 | 190 | | |
186 | 191 | | |
187 | 192 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
53 | 96 | | |
54 | 97 | | |
55 | 98 | | |
56 | 99 | | |
57 | 100 | | |
58 | | - | |
59 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
60 | 104 | | |
61 | | - | |
| 105 | + | |
62 | 106 | | |
63 | 107 | | |
64 | 108 | | |
| |||
69 | 113 | | |
70 | 114 | | |
71 | 115 | | |
| 116 | + | |
72 | 117 | | |
73 | 118 | | |
74 | 119 | | |
| |||
77 | 122 | | |
78 | 123 | | |
79 | 124 | | |
| 125 | + | |
80 | 126 | | |
81 | 127 | | |
82 | 128 | | |
| |||
92 | 138 | | |
93 | 139 | | |
94 | 140 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
101 | 158 | | |
102 | | - | |
| 159 | + | |
| 160 | + | |
103 | 161 | | |
104 | 162 | | |
105 | 163 | | |
106 | | - | |
107 | | - | |
108 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
109 | 172 | | |
110 | 173 | | |
111 | 174 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
700 | 700 | | |
701 | 701 | | |
702 | 702 | | |
703 | | - | |
| 703 | + | |
704 | 704 | | |
705 | 705 | | |
706 | | - | |
| 706 | + | |
| 707 | + | |
707 | 708 | | |
708 | 709 | | |
709 | 710 | | |
| |||
0 commit comments