fix(local-system): restore loc param when calling readLocalFile IPC (#13748)

🐛 fix(local-system): restore loc param when calling readLocalFile IPC

The `denormalizeParams` method in `LocalSystemExecutionRuntime` was
missing a case for `readLocalFile`. It fell through to `default`, which
passed `{startLine, endLine, path}` as-is to the IPC layer. However,
the IPC handler (`LocalFileCtr.readFile`) expects `LocalReadFileParams`
with `loc?: [number, number]`, not `startLine`/`endLine`. As a result,
`loc` was always `undefined` on the IPC side, causing `readLocalFile`
to default to `[0, 200]` and always return content from line 0.

Fix: add an explicit `readLocalFile` case that reconstructs the `loc`
tuple from `startLine` and `endLine` before forwarding to the IPC layer.

Fixes #13735

Co-authored-by: octo-patch <octo-patch@github.com>
This commit is contained in:
Octopus 2026-04-12 14:34:42 +08:00 committed by GitHub
parent e0f97c4920
commit 37bf1bd191
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -120,6 +120,14 @@ export class LocalSystemExecutionRuntime extends ComputerRuntime {
return { shell_id: params.commandId };
}
case 'readLocalFile': {
const loc: [number, number] | undefined =
params.startLine !== undefined || params.endLine !== undefined
? [params.startLine ?? 0, params.endLine ?? 200]
: undefined;
return { fullContent: params.fullContent, loc, path: params.path };
}
default: {
return params;
}