fix(settings): make WSL skill commands pasteable (#7795) (#7881)

* fix(settings): make WSL skill commands pasteable (#7795)

* Fix WSL skill commands so PowerShell 7 pastes match PowerShell 5.1 argv

- Encode the WSL login-shell script as base64 and decode/eval it inside
  the sh -c invocation, avoiding raw nested quotes at the paste boundary
- Scope $PSNativeCommandArgumentPassing = 'Legacy' to the invocation so
  PS 5.1 and PS 7 both hand wsl.exe the same escaped argv
- Extract powershell-native-argument.ts as the shared quoting module and
  reuse it from ssh-remote-powershell.ts

* test(runtime): stub getRepo in mobile-tab startup cwd test

Main's #7892 made listMobileSessionTabs validate selectors via
this.store?.getRepo; the mock store here only defined
getWorkspaceSession, so the merged CI build threw 'getRepo is not a
function'. Return null (wt-1 is a worktree id, not a repo).

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Rod Boev
2026-07-12 01:33:08 -07:00
committed by GitHub
co-authored by Orca Jinjing
parent 1d1ec02b14
commit 34f74129d6
9 changed files with 160 additions and 49 deletions
+3 -3
View File
@@ -171,9 +171,9 @@ function mergeSystemCodexConfigIntoRuntime(runtimeConfig: string, systemConfig:
.filter((section) => isRuntimeProjectTomlSection(section.header))
.map((section) => getTomlSectionHeaderKey(section.header))
)
const systemProjectSections = deduplicateProjectTomlSections(getTomlSections(systemConfig)).filter(
(section) => isRuntimeProjectTomlSection(section.header)
)
const systemProjectSections = deduplicateProjectTomlSections(
getTomlSections(systemConfig)
).filter((section) => isRuntimeProjectTomlSection(section.header))
const systemUntrustedProjectHeaders = new Set(
systemProjectSections
.filter((section) => getProjectTrustLevel(section.block) === 'untrusted')
+1 -4
View File
@@ -90,10 +90,7 @@ function linkSystemCodexResource(
removeCopiedResourceIfOwned(targetPath, managedHomePath, entryName, sourcePath)
return
}
if (
entryName === CODEX_GLOBAL_INSTRUCTIONS_ENTRY &&
!systemResourceIsRegularFile(sourcePath)
) {
if (entryName === CODEX_GLOBAL_INSTRUCTIONS_ENTRY && !systemResourceIsRegularFile(sourcePath)) {
removeCopiedResourceIfOwned(targetPath, managedHomePath, entryName, sourcePath)
console.warn('[codex-home] Ignoring non-file system Codex resource:', entryName)
return
+7 -11
View File
@@ -1153,11 +1153,7 @@ describe('upsertProjectTrustLevel', () => {
// Linux path underneath is not — .../Repo and .../repo are two projects.
const existingPath = '\\\\wsl$\\Ubuntu\\home\\u\\Repo'
const incomingPath = '\\\\wsl$\\Ubuntu\\home\\u\\repo'
const original = [
`[projects.'${existingPath}']`,
'trust_level = "untrusted"',
''
].join('\n')
const original = [`[projects.'${existingPath}']`, 'trust_level = "untrusted"', ''].join('\n')
const updated = upsertProjectTrustLevelInContent(original, incomingPath, 'trusted', {
alreadyCanonical: true
@@ -1253,9 +1249,9 @@ describe('normalizeCodexProjectPathForLookup', () => {
})
it('treats wsl.localhost like the wsl$ share for the case-sensitive tail', () => {
expect(
normalizeCodexProjectPathForLookup('\\\\wsl.localhost\\Ubuntu\\home\\u\\Repo')
).not.toBe(normalizeCodexProjectPathForLookup('\\\\wsl.localhost\\Ubuntu\\home\\u\\repo'))
expect(normalizeCodexProjectPathForLookup('\\\\wsl.localhost\\Ubuntu\\home\\u\\Repo')).not.toBe(
normalizeCodexProjectPathForLookup('\\\\wsl.localhost\\Ubuntu\\home\\u\\repo')
)
expect(normalizeCodexProjectPathForLookup('\\\\WSL.LOCALHOST\\Ubuntu\\home\\u\\proj')).toBe(
normalizeCodexProjectPathForLookup('//wsl.localhost/ubuntu/home/u/proj')
)
@@ -1291,9 +1287,9 @@ describe('normalizeCodexProjectPathForLookup', () => {
describe('normalizeCodexProjectPathForRevocationLookup', () => {
it('folds WSL tails fully so drifted-case legacy revocations still match', () => {
expect(
normalizeCodexProjectPathForRevocationLookup('\\\\wsl$\\Ubuntu\\home\\u\\Repo')
).toBe(normalizeCodexProjectPathForRevocationLookup('//wsl.localhost/ubuntu/home/u/repo'))
expect(normalizeCodexProjectPathForRevocationLookup('\\\\wsl$\\Ubuntu\\home\\u\\Repo')).toBe(
normalizeCodexProjectPathForRevocationLookup('//wsl.localhost/ubuntu/home/u/repo')
)
})
it('keeps POSIX paths case-sensitive', () => {