Follow-up to #78. readFileWithCap in structure/tokens.go truncates to maxTokenizedFileBytes (8 MiB) only after util.SafeReadFile has read the entire file into memory, so a pathological multi-GB file in a skill package still gets fully loaded before the cap applies.
To deliver the intended bound, read with os.Open + io.LimitedReader (or add a SafeReadFileN(path, n) helper in util that combines the Lstat regular-file check with a limited read).
Follow-up to #78.
readFileWithCapinstructure/tokens.gotruncates tomaxTokenizedFileBytes(8 MiB) only afterutil.SafeReadFilehas read the entire file into memory, so a pathological multi-GB file in a skill package still gets fully loaded before the cap applies.To deliver the intended bound, read with
os.Open+io.LimitedReader(or add aSafeReadFileN(path, n)helper inutilthat combines the Lstat regular-file check with a limited read).