Skip to content

Make the encoding refusal legible everywhere, and confine runCommand to the open workspace - #64

Merged
Seungpyo1007 merged 1 commit into
developfrom
fix/encoding-note-and-run-cwd
Aug 5, 2026
Merged

Make the encoding refusal legible everywhere, and confine runCommand to the open workspace#64
Seungpyo1007 merged 1 commit into
developfrom
fix/encoding-note-and-run-cwd

Conversation

@Seungpyo1007

Copy link
Copy Markdown
Member

Two leftovers from the encoding work in #61 / #62.

1. The refusal was only legible inside the editor

The main process throws a code — SCHUTZ_ENCODING:<kind> — because it does not know the UI language. Only MonacoPane translated it, so the same error surfaced raw everywhere else.

The agent was the worst case: read_file returned 오류: SCHUTZ_ENCODING:not-utf8, which tells the model nothing, so it re-reads the same file and burns rounds. Proposal cards showed the raw code as the failure reason too.

src/encodingNote.ts now owns the mapping and all three call sites share it.

2. runCommand never checked the workspace

Every other fs handler runs assertRoot(root). runCommand only checked existsSync, so any path the renderer passed — including the user's home directory — was a valid cwd.

The comment above the spawn also claimed cwd confines the command to the workspace. It does not: with shell: true the command can cd or use absolute paths. The real boundary is the approval gate above it. Comment corrected rather than left to mislead the next reader.

Verification

  • 9 unit tests for the shared mapping, including the IPC-wrapped Error invoking remote method ... prefix. 972 passing (was 963).
  • Real app: encoding probe 7/7 (editor message unchanged after the refactor); replace + run probe 7/7echo inside the open workspace still runs and returns hi, the same call with cwd: C:/Users/29 is refused.
  • npm run typecheck clean. main.cjs line endings unchanged (1886 CRLF / 0 LF).

둘 다 앞선 인코딩 작업에서 남은 자리다.

하나. 메인은 `SCHUTZ_ENCODING:<종류>` 라는 코드만 던지는데(전자는 언어를
모른다) 그 코드를 번역하는 자리가 편집기 안에만 있었다. 같은 오류가 다른
길로 나오면 원시 코드가 그대로 보였다. 특히 에이전트가 그랬다 — read_file
결과로 `오류: SCHUTZ_ENCODING:not-utf8` 을 받으면 무슨 일인지 알 수 없어
같은 파일을 계속 다시 읽으며 라운드를 태운다. 제안 카드의 실패 사유도
마찬가지였다. encodingNote.ts 한 군데로 모으고 세 곳이 같이 쓴다.

둘. runCommand 만 assertRoot 를 안 탔다. 존재하는 디렉터리이기만 하면 됐으니
렌더러가 넘긴 아무 경로에서나(홈 디렉터리라도) 명령이 돌 수 있었다. 다른 fs
핸들러는 전부 태운다. 함께 주석도 고쳤다 — "cwd 로 워크스페이스에 가둔다" 고
적혀 있었는데 shell:true 라 cwd 는 경계가 아니다(명령이 cd 든 절대경로든 쓸
수 있다). 진짜 경계는 그 위의 승인 게이트다.

단위 9개 추가(972개 통과). 실제 앱 검증: 인코딩 7/7, 치환·실행 7/7
(워크스페이스 안 echo 는 그대로 돌고, 밖은 거절된다).
@Seungpyo1007 Seungpyo1007 added this to the v0.3 (2026-09-30) milestone Aug 5, 2026
@Seungpyo1007 Seungpyo1007 added the bug Something isn't working label Aug 5, 2026
@Seungpyo1007 Seungpyo1007 self-assigned this Aug 5, 2026
@Seungpyo1007
Seungpyo1007 merged commit 32b4209 into develop Aug 5, 2026
1 check passed
@Seungpyo1007
Seungpyo1007 deleted the fix/encoding-note-and-run-cwd branch August 5, 2026 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant