Repository navigation
Commit a199ec7
committed
fix(harness): close the hidden subtree to every layer, at any depth
The guard only reached the layers that excluded the root, so anything routed
above it walked in: grep, glob, ls and delete read or removed a sibling's
files through a link, a junction, an 8.3 short name or an absolute ancestor,
and one caller could unlink another namespace's link entry.
Every layer now keeps its guarded roots as a single set, spelled and resolved,
with the bound carried per root: HIDDEN loses the content, REFUSED closes the
way in from above while the layer that owns the subtree still reads inside.
A walk scope resolves its root's position once, so an entry that reaches a
guarded root only through an alias is recognised at any depth instead of by
the file name it happens to keep, and a walk that starts inside such a path
answers empty before a shelled-out search can look at it.
The overlay keeps its routing rules but gains the spellings it dropped: an
absolute path naming the workspace root or the caller's namespace root now
resolves to that root instead of falling into the project view, and an absolute
path that reaches the workspace only through a link is answered by the project
view, which hides the subtree, instead of surfacing a namespace error. A path
that lands in the caller's own namespace keeps the workspace view, so a link
into one's own files stays readable. Physical resolution moved to
FilesystemUtils so both layers share it.
Reads also had no way to see what the overlay writes: with namespaces active a
non-workspace write landed under the caller's project namespace, while every
read looked at the unnamespaced project, so exists, read, ls, grep and glob all
reported the file missing -- a success the caller could never observe. Reads now
check the workspace, then the project write layer, then the shared project, and
leave an absolute project path to the project layers: the workspace layer used
to answer for files above its own root under a "../" spelling, so the same file
came back twice under two keys.
Listing ops also disagreed with the read ops about a path a layer refuses: the
overlay let the refusal escape, so a sibling's absolute path listed as a
SecurityException while the same path read as absent, and the plain overlay did
that where the project-writable one answered empty. Enumeration now treats a
layer that refuses the path as contributing nothing, which is what read, exists
and grep already did.
Walks also disagreed with resolution about where an entry sits. A refused root
closed itself for the layer that owns it, so a caller whose namespace list is
empty -- the AGENT and GLOBAL scopes -- listed nothing while reading the same
key still worked. A directory alias that is not a symbolic link, such as a
Windows junction, passed the link check and was walked into, so a sibling's
names showed up in listings that would refuse to read them. A refused root now
closes only from above, and an entry inside the layer yet outside the caller's
namespace is skipped however the walk reached it. A refused root also stays walkable for
the layer rooted in it when the deployment spells that root through an alias, since the
refusal belongs to the layer that lives there, not to the spelling. A link to an ancestor
could also be deleted but not moved: a moving link carries nothing, and the directory flag
is now read without following it.
The classifier and the router also read spellings differently: ./MEMORY.md was
workspace metadata to one and a project key to the other, so the write landed in
the project layer while the read found it there. Keys are normalized the same
way in both. Finally, an alias may no longer carry a spelling the path policy
excludes into a place the policy allows.
Guarding is a path model, and the class doc now says where that ends: a hard link is a second
directory entry for the same file, not a pointer, so it is invisible to a resolution-based check,
and is documented as outside the boundary rather than half-detected.
A layered write could also leave the caller reading a version nobody else sees. Reads ask the
workspace layer first, so a project write under a key the workspace already holds would succeed
and leave the caller reading the other file. That write, its edit, an upload and a move are now
refused, naming the workspace copy with its stamp and size; absolute spellings are exempt,
because there the workspace layer answers only through the shared path policy. Deleting the key
removes the workspace copy first, so the refusal's recovery path converges.
Listings merged on the raw spelling, which the layers do not agree on -- a virtual layer reports
/src/ and a rooted one src/ -- so the same entry appeared twice and the upper copy never took
precedence. Merges now key on a normalized entry. Search resolves each directory once per search
instead of once per reported line.
The dev filesystem guide notes the shadowed project write and that the shell and hard links sit
outside the boundary; the 2.0 snapshot is left to the release it documents.
An alias check compared a resolved path against the path policy's configured roots. On Windows a
short-name spelling resolves to a different, longer form, so that comparison failed and the
request fell through to the unconditional policy branch, skipping the namespace check and reading
a sibling's file through the alias. The branch now checks the caller's spelling against the policy
and uses the resolved path only to decide which layer owns the destination.1 parent 21be74a commit a199ec7
12 files changed
Lines changed: 2273 additions & 119 deletions
File tree
- agentscope-harness/src
- main/java/io/agentscope/harness/agent/filesystem
- local
- spec
- util
- test/java/io/agentscope/harness/agent
- example
- filesystem
- docs/dev
- en/docs/harness
- zh/docs/harness
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
174 | 176 | | |
175 | 177 | | |
176 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
177 | 193 | | |
178 | 194 | | |
179 | 195 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
47 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
48 | 51 | | |
49 | 52 | | |
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
54 | 57 | | |
| 58 | + | |
55 | 59 | | |
56 | 60 | | |
57 | 61 | | |
| |||
140 | 144 | | |
141 | 145 | | |
142 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
143 | 186 | | |
144 | 187 | | |
145 | | - | |
146 | | - | |
| 188 | + | |
| 189 | + | |
147 | 190 | | |
148 | 191 | | |
149 | 192 | | |
150 | 193 | | |
151 | 194 | | |
| 195 | + | |
| 196 | + | |
152 | 197 | | |
153 | 198 | | |
154 | 199 | | |
155 | | - | |
| 200 | + | |
156 | 201 | | |
157 | 202 | | |
158 | 203 | | |
159 | 204 | | |
160 | | - | |
| 205 | + | |
161 | 206 | | |
162 | 207 | | |
163 | 208 | | |
| |||
200 | 245 | | |
201 | 246 | | |
202 | 247 | | |
203 | | - | |
204 | | - | |
| 248 | + | |
| 249 | + | |
205 | 250 | | |
206 | 251 | | |
207 | 252 | | |
| |||
210 | 255 | | |
211 | 256 | | |
212 | 257 | | |
213 | | - | |
| 258 | + | |
214 | 259 | | |
215 | 260 | | |
216 | 261 | | |
217 | 262 | | |
218 | | - | |
| 263 | + | |
219 | 264 | | |
220 | 265 | | |
221 | 266 | | |
222 | 267 | | |
223 | 268 | | |
224 | 269 | | |
225 | 270 | | |
226 | | - | |
227 | | - | |
| 271 | + | |
| 272 | + | |
228 | 273 | | |
229 | 274 | | |
230 | 275 | | |
| |||
233 | 278 | | |
234 | 279 | | |
235 | 280 | | |
236 | | - | |
| 281 | + | |
237 | 282 | | |
238 | 283 | | |
239 | 284 | | |
240 | 285 | | |
241 | | - | |
| 286 | + | |
242 | 287 | | |
243 | 288 | | |
244 | 289 | | |
| |||
0 commit comments