From 344cd953ce39a384ea2f0fa1b11b7887a35e6c98 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sun, 5 Jul 2026 13:04:00 -0400 Subject: [PATCH] fixes to autonomous tier 2 workspace setup --- scripts/tier2/setup_tier2_clone.ps1 | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/scripts/tier2/setup_tier2_clone.ps1 b/scripts/tier2/setup_tier2_clone.ps1 index f1b242cf..67bec84f 100644 --- a/scripts/tier2/setup_tier2_clone.ps1 +++ b/scripts/tier2/setup_tier2_clone.ps1 @@ -68,16 +68,20 @@ if ($PSCmdlet.ShouldProcess("Bootstrap Tier 2 clone at $Tier2ClonePath")) { # (deny-all + allowlist for the sandbox dirs + the tier2-autonomous # agent's permission block). The agent's `permission` overrides the # top-level for that agent's tool calls. + # NOTE: parse with -AsHashtable because the fragment contains + # case-variant duplicate keys at the same level (e.g. "*C:/tmp*" + # and "*c:/tmp*") inside the bash permission block. The default + # ConvertFrom-Json builds a case-insensitive PSCustomObject and + # errors on those duplicates; -AsHashtable is case-sensitive. $cloneConfig = "$Tier2ClonePath\opencode.json" - $fragment = Get-Content "$MainRepoPath\conductor\tier2\opencode.json.fragment" -Raw | ConvertFrom-Json + $fragment = Get-Content "$MainRepoPath\conductor\tier2\opencode.json.fragment" -Raw | ConvertFrom-Json -AsHashtable if (Test-Path $cloneConfig) { - $existing = Get-Content $cloneConfig -Raw | ConvertFrom-Json - if (-not $existing.agent) { $existing | Add-Member -MemberType NoteProperty -Name agent -Value ([PSCustomObject]@{}) } - $existing.agent | Add-Member -MemberType NoteProperty -Name "tier2-autonomous" -Value $fragment.agent."tier2-autonomous" -Force - if (-not $existing.permission) { $existing | Add-Member -MemberType NoteProperty -Name permission -Value ([PSCustomObject]@{}) } - $existing.permission = $fragment.permission - $existing | Add-Member -MemberType NoteProperty -Name default_agent -Value "tier2-autonomous" -Force - $existing | Add-Member -MemberType NoteProperty -Name model -Value $fragment.model -Force + $existing = Get-Content $cloneConfig -Raw | ConvertFrom-Json -AsHashtable + if (-not $existing.ContainsKey('agent')) { $existing['agent'] = @{} } + $existing['agent']['tier2-autonomous'] = $fragment['agent']['tier2-autonomous'] + $existing['permission'] = $fragment['permission'] + $existing['default_agent'] = 'tier2-autonomous' + $existing['model'] = $fragment['model'] $existing | ConvertTo-Json -Depth 10 | Set-Content $cloneConfig } else { Copy-Item -Force "$MainRepoPath\conductor\tier2\opencode.json.fragment" $cloneConfig @@ -94,14 +98,14 @@ if ($PSCmdlet.ShouldProcess("Bootstrap Tier 2 clone at $Tier2ClonePath")) { # The fix: launch the MCP server from the clone's path with the # clone's PYTHONPATH, and replace the clone's mcp_paths.toml with # an empty one so the clone's MCP server has no extra_dirs. - if ($existing.mcp -and $existing.mcp.'manual-slop') { - $existing.mcp.'manual-slop'.command = @( + if ($existing.ContainsKey('mcp') -and $existing['mcp'].ContainsKey('manual-slop')) { + $existing['mcp']['manual-slop']['command'] = @( "$env:USERPROFILE\scoop\apps\uv\current\uv.exe", "run", "python", "$Tier2ClonePath\scripts\mcp_server.py" ) - $existing.mcp.'manual-slop'.environment.PYTHONPATH = "$Tier2ClonePath\src" + $existing['mcp']['manual-slop']['environment']['PYTHONPATH'] = "$Tier2ClonePath\src" $existing | ConvertTo-Json -Depth 10 | Set-Content $cloneConfig } $cloneMcpPaths = "$Tier2ClonePath\mcp_paths.toml"