terok-executor 0.3.0__tar.gz → 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. {terok_executor-0.3.0 → terok_executor-0.3.1}/PKG-INFO +2 -2
  2. {terok_executor-0.3.0 → terok_executor-0.3.1}/pyproject.toml +4 -4
  3. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/__init__.py +1 -1
  4. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/commands.py +2 -0
  5. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/container/env.py +39 -2
  6. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/init-ssh-and-repo.sh +22 -18
  7. {terok_executor-0.3.0 → terok_executor-0.3.1}/LICENSE +0 -0
  8. {terok_executor-0.3.0 → terok_executor-0.3.1}/LICENSES/Apache-2.0.txt +0 -0
  9. {terok_executor-0.3.0 → terok_executor-0.3.1}/README.md +0 -0
  10. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/_tree.py +0 -0
  11. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/_util/__init__.py +0 -0
  12. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/_util/_timezone.py +0 -0
  13. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/acp/__init__.py +0 -0
  14. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/acp/cache.py +0 -0
  15. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/acp/daemon.py +0 -0
  16. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/acp/endpoint.py +0 -0
  17. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/acp/model_options.py +0 -0
  18. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/acp/probe.py +0 -0
  19. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/acp/proxy.py +0 -0
  20. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/acp/roster.py +0 -0
  21. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/cli.py +0 -0
  22. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/config.py +0 -0
  23. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/config_schema.py +0 -0
  24. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/container/__init__.py +0 -0
  25. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/container/build.py +0 -0
  26. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/container/cache.py +0 -0
  27. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/container/inject.py +0 -0
  28. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/container/runner.py +0 -0
  29. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/credentials/__init__.py +0 -0
  30. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/credentials/auth.py +0 -0
  31. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/credentials/extractors.py +0 -0
  32. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/credentials/vault_commands.py +0 -0
  33. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/credentials/vault_config.py +0 -0
  34. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/credentials/vendor_files.py +0 -0
  35. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/doctor.py +0 -0
  36. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/integrations/__init__.py +0 -0
  37. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/integrations/sandbox.py +0 -0
  38. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/krun.py +0 -0
  39. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/paths.py +0 -0
  40. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/preflight.py +0 -0
  41. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/provider/__init__.py +0 -0
  42. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/provider/agents.py +0 -0
  43. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/provider/instructions.py +0 -0
  44. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/provider/providers.py +0 -0
  45. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/provider/wrappers.py +0 -0
  46. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/py.typed +0 -0
  47. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/__init__.py +0 -0
  48. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/agents/__init__.py +0 -0
  49. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/agents/caddy.yaml +0 -0
  50. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/agents/claude.yaml +0 -0
  51. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/agents/coderabbit.yaml +0 -0
  52. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/agents/codex.yaml +0 -0
  53. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/agents/copilot.yaml +0 -0
  54. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/agents/gh.yaml +0 -0
  55. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/agents/glab.yaml +0 -0
  56. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/agents/opencode.yaml +0 -0
  57. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/agents/pi.yaml +0 -0
  58. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/agents/sonar.yaml +0 -0
  59. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/agents/toad.yaml +0 -0
  60. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/agents/vibe.yaml +0 -0
  61. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/instructions/__init__.py +0 -0
  62. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/instructions/default.md +0 -0
  63. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/providers/anthropic.yaml +0 -0
  64. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/providers/blablador.yaml +0 -0
  65. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/providers/coderabbit.yaml +0 -0
  66. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/providers/github.yaml +0 -0
  67. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/providers/gitlab.yaml +0 -0
  68. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/providers/kisski.yaml +0 -0
  69. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/providers/mistral.yaml +0 -0
  70. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/providers/openai.yaml +0 -0
  71. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/providers/openrouter.yaml +0 -0
  72. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/providers/sonarcloud.yaml +0 -0
  73. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/Caddyfile +0 -0
  74. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/__init__.py +0 -0
  75. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/allthethings.sh +0 -0
  76. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/hilfe +0 -0
  77. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/mistral-model-sync.py +0 -0
  78. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/opencode-provider +0 -0
  79. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/opencode-provider-acp +0 -0
  80. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/opencode-session-plugin.mjs +0 -0
  81. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/opencode-toad +0 -0
  82. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/pi-env.sh +0 -0
  83. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/pi-git-identity.ts +0 -0
  84. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/pi-provider +0 -0
  85. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/pi-vault-routes.ts +0 -0
  86. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/providers +0 -0
  87. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/setup-codex-auth.sh +0 -0
  88. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/terok-acp-env.sh +0 -0
  89. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/terok-agents.py +0 -0
  90. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/terok-bash-banner.sh +0 -0
  91. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/terok-claude-acp +0 -0
  92. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/terok-codex-acp +0 -0
  93. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/terok-copilot-acp +0 -0
  94. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/terok-env-git-identity.sh +0 -0
  95. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/terok-env.sh +0 -0
  96. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/terok-native-provider +0 -0
  97. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/terok-opencode-acp +0 -0
  98. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/terok-toad-entry +0 -0
  99. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/terok-trust-workspace.py +0 -0
  100. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/terok-vibe-acp +0 -0
  101. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/toad +0 -0
  102. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/update-all-the-things +0 -0
  103. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/scripts/vibe-model-sync.sh +0 -0
  104. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/templates/__init__.py +0 -0
  105. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/templates/agent-wrappers.sh.j2 +0 -0
  106. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/templates/l0.dev.Dockerfile.template +0 -0
  107. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/templates/l1.agent-cli.Dockerfile.template +0 -0
  108. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/templates/l1.sidecar.Dockerfile.template +0 -0
  109. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/tmux/__init__.py +0 -0
  110. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/tmux/container-tmux.conf +0 -0
  111. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/toad-agents/__init__.py +0 -0
  112. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/toad-agents/blablador.helmholtz.de.toml +0 -0
  113. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/resources/toad-agents/kisski.academiccloud.de.toml +0 -0
  114. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/roster/__init__.py +0 -0
  115. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/roster/loader.py +0 -0
  116. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/roster/schema.py +0 -0
  117. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/roster/types.py +0 -0
  118. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/sandbox.py +0 -0
  119. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/storage.py +0 -0
  120. {terok_executor-0.3.0 → terok_executor-0.3.1}/src/terok_executor/vault_addr.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: terok-executor
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Single-agent task runner for hardened Podman containers
5
5
  License-Expression: Apache-2.0
6
6
  License-File: LICENSE
@@ -29,7 +29,7 @@ Requires-Dist: prompt-toolkit (>=3.0,<4.0)
29
29
  Requires-Dist: pydantic (>=2.13,<3.0)
30
30
  Requires-Dist: rich (>=15.0,<16.0)
31
31
  Requires-Dist: ruamel.yaml (==0.19.1)
32
- Requires-Dist: terok-sandbox (>=0.4.0,<0.5.0)
32
+ Requires-Dist: terok-sandbox (>=0.4.1,<0.5.0)
33
33
  Requires-Dist: terok-util (>=0.2.1,<0.3.0)
34
34
  Requires-Dist: tomli-w (>=1.2,<2.0)
35
35
  Project-URL: Changelog, https://github.com/terok-ai/terok-executor/blob/master/CHANGELOG.md
@@ -19,7 +19,7 @@ dynamic = ["classifiers"]
19
19
  # Dependency pins follow the policy in AGENTS.md ("Dependency Pinning &
20
20
  # pyproject.toml Hygiene"). Keep the dependency list comment-free.
21
21
  dependencies = [
22
- "terok-sandbox>=0.4.0,<0.5.0",
22
+ "terok-sandbox>=0.4.1,<0.5.0",
23
23
  "terok-util>=0.2.1,<0.3.0",
24
24
  "ruamel.yaml==0.19.1",
25
25
  "Jinja2~=3.1",
@@ -29,7 +29,7 @@ dependencies = [
29
29
  "rich~=15.0",
30
30
  "agent-client-protocol==0.10.1",
31
31
  ]
32
- version = "0.3.0"
32
+ version = "0.3.1"
33
33
 
34
34
  [project.urls]
35
35
  Homepage = "https://terok-ai.github.io/terok-executor/"
@@ -63,12 +63,12 @@ pre-commit = ">=4.0"
63
63
  ruff = ">=0.15.20"
64
64
  bandit = ">=1.7"
65
65
  docstr-coverage = "^2.3.2"
66
- complexipy = ">=6.0.0"
66
+ complexipy = ">=6.0.1"
67
67
  vulture = ">=2.12"
68
68
  reuse = "^6.2.0"
69
69
  tach = "^0.35.0"
70
70
  mypy = ">=2.1.0,<3.0"
71
- import-linter = ">=2.12"
71
+ import-linter = ">=2.13"
72
72
 
73
73
  [tool.poetry.group.test.dependencies]
74
74
  pytest = ">=9.1.1"
@@ -20,7 +20,7 @@ in their submodules; reach into ``terok_executor.<sub>`` when you
20
20
  need them.
21
21
  """
22
22
 
23
- __version__: str = "0.3.0" # placeholder; replaced at build time
23
+ __version__: str = "0.3.1" # placeholder; replaced at build time
24
24
 
25
25
  from importlib.metadata import PackageNotFoundError, version as _meta_version
26
26
 
@@ -505,6 +505,8 @@ def _handle_list() -> None:
505
505
 
506
506
  runtime = PodmanRuntime()
507
507
  states = runtime.container_states("terok-executor")
508
+ if states is None:
509
+ raise SystemExit("Container runtime unavailable — cannot query container states.")
508
510
  run_root = container_state_root()
509
511
  named = (p.name for p in run_root.iterdir() if p.is_dir()) if run_root.is_dir() else ()
510
512
  for name in named:
@@ -23,6 +23,8 @@ Usage::
23
23
  from __future__ import annotations
24
24
 
25
25
  import logging
26
+ import os
27
+ import stat
26
28
  from dataclasses import dataclass
27
29
  from pathlib import Path
28
30
  from typing import TYPE_CHECKING, Literal
@@ -438,6 +440,8 @@ def _shared_config_mounts(
438
440
  materialises the destination inside the container's userns as root
439
441
  with mode 0700, leaving the file unreadable to the agent (and breaking
440
442
  e.g. ``gh`` whose ``hosts.yml`` is normally absent on fresh installs).
443
+ Credential files are created — and pre-existing ones re-clamped —
444
+ owner-only, because glab aborts on a ``config.yml`` looser than 0600.
441
445
 
442
446
  Providers in *expose_credential_providers* keep the writable mount —
443
447
  used by terok's experimental ``expose_oauth_token`` mode where the
@@ -454,13 +458,18 @@ def _shared_config_mounts(
454
458
  host_dir.mkdir(parents=True, exist_ok=True)
455
459
  specs.append(VolumeSpec(host_dir, m.container_path))
456
460
 
457
- if not m.credential_file or m.writable or m.provider in expose_credential_providers:
461
+ if not m.credential_file:
458
462
  continue
459
463
 
460
464
  host_file = host_dir / m.credential_file
465
+ _clamp_credential_mode(host_file)
466
+
467
+ if m.writable or m.provider in expose_credential_providers:
468
+ continue
469
+
461
470
  host_file.parent.mkdir(parents=True, exist_ok=True)
462
471
  if not host_file.exists():
463
- host_file.touch()
472
+ host_file.touch(mode=0o600)
464
473
 
465
474
  container_file = f"{m.container_path}/{m.credential_file}"
466
475
  specs.append(VolumeSpec(host_file, container_file, read_only=True))
@@ -468,6 +477,34 @@ def _shared_config_mounts(
468
477
  return specs
469
478
 
470
479
 
480
+ def _clamp_credential_mode(host_file: Path) -> None:
481
+ """Strip group/other permission bits from an existing credential file.
482
+
483
+ Releases up to 0.2.x ``touch()``-ed credential files with the umask
484
+ default (0644), and those files persist in the shared mounts across
485
+ upgrades. glab refuses to start when its ``config.yml`` is looser
486
+ than 0600, so every launch re-clamps to owner-only — idempotent, and
487
+ never *adds* bits (a deliberately read-only 0400 file stays 0400).
488
+
489
+ Opens with ``O_NOFOLLOW`` + ``fchmod`` so a symlink planted in the
490
+ container-writable shared dir cannot redirect the chmod to an
491
+ arbitrary operator-owned file (CWE-59). The clamp is best-effort:
492
+ any open failure (missing file, planted symlink, permissions) leaves
493
+ the file as-is rather than aborting container assembly — a file we
494
+ cannot even open is not one the old ``touch()`` created loose.
495
+ """
496
+ try:
497
+ fd = os.open(host_file, os.O_RDONLY | getattr(os, "O_NOFOLLOW", 0))
498
+ except OSError:
499
+ return
500
+ try:
501
+ st = os.fstat(fd)
502
+ if stat.S_ISREG(st.st_mode) and stat.S_IMODE(st.st_mode) & 0o077:
503
+ os.fchmod(fd, stat.S_IMODE(st.st_mode) & ~0o077)
504
+ finally:
505
+ os.close(fd)
506
+
507
+
471
508
  def _set_provider_handle(
472
509
  env: dict[str, str],
473
510
  provider: str,
@@ -198,6 +198,21 @@ if [[ -n "${REPO_ROOT:-}" && -n "${CODE_REPO:-}" ]]; then
198
198
  fi
199
199
  fi
200
200
 
201
+ # Terok-managed origin must match the launch env, not whatever a previous
202
+ # container generation persisted into .git/config: gate URLs embed a
203
+ # per-task auth token, so a stale origin breaks every fetch with 403.
204
+ # In both security modes the invariant is the same — origin is CODE_REPO
205
+ # (the gate in gatekeeping mode, upstream in online mode) — and it must
206
+ # hold BEFORE the first fetch below.
207
+ if [[ -d "${REPO_ROOT}/.git" ]]; then
208
+ CURRENT_ORIGIN=$(git -C "${REPO_ROOT}" remote get-url origin 2>/dev/null || echo "")
209
+ if [[ -n "${CURRENT_ORIGIN}" && "${CURRENT_ORIGIN}" != "${CODE_REPO}" ]]; then
210
+ echo ">> fixing origin remote (was: $(redact_url "${CURRENT_ORIGIN}"))"
211
+ git -C "${REPO_ROOT}" remote set-url origin "${CODE_REPO}" || true
212
+ git -C "${REPO_ROOT}" remote set-url --push origin "${CODE_REPO}" || true
213
+ fi
214
+ fi
215
+
201
216
  if [[ ! -d "${REPO_ROOT}/.git" ]]; then
202
217
  # No .git directory - perform initial clone
203
218
  # Remove marker first so the directory is empty for git clone
@@ -245,7 +260,7 @@ if [[ -n "${REPO_ROOT:-}" && -n "${CODE_REPO:-}" ]]; then
245
260
  git -C "${REPO_ROOT}" remote set-url origin "${CODE_REPO}" || true
246
261
  git -C "${REPO_ROOT}" remote set-url --push origin "${CODE_REPO}" || true
247
262
  # Fetch latest from upstream to ensure we have all refs
248
- git -C "${REPO_ROOT}" fetch --all --prune || true
263
+ git -C "${REPO_ROOT}" fetch origin --prune || true
249
264
  # After repointing, checkout the target branch from the new origin if specified
250
265
  if [[ -n "${TARGET_BRANCH}" ]]; then
251
266
  if git -C "${REPO_ROOT}" rev-parse --verify "origin/${TARGET_BRANCH}" >/dev/null 2>&1; then
@@ -270,7 +285,10 @@ if [[ -n "${REPO_ROOT:-}" && -n "${CODE_REPO:-}" ]]; then
270
285
  # .git exists and this is a new task (marker present).
271
286
  # Normal fast path when clone cache pre-populated the workspace.
272
287
  echo ">> new task — updating cached workspace to latest HEAD"
273
- git -C "${REPO_ROOT}" fetch --all --prune
288
+ # Fetch origin only: the "external" remote is unreachable by design
289
+ # (gatekeeping blocks egress) and the "gate" remote is re-added with a
290
+ # fresh URL further down — ``--all`` would fetch both and fail.
291
+ git -C "${REPO_ROOT}" fetch origin --prune
274
292
  TARGET_BRANCH="${GIT_BRANCH:-}"
275
293
 
276
294
  # Checkout and reset to the target branch. Use checkout -B to create/reset
@@ -301,7 +319,8 @@ if [[ -n "${REPO_ROOT:-}" && -n "${CODE_REPO:-}" ]]; then
301
319
  # .git exists and no marker - this is a restarted task
302
320
  # Only fetch updates, preserve local changes
303
321
  echo ">> restarted task - fetching updates (preserving local changes)"
304
- git -C "${REPO_ROOT}" fetch --all --prune
322
+ # origin only — see the new-task fetch above for why not ``--all``.
323
+ git -C "${REPO_ROOT}" fetch origin --prune
305
324
  # Only reset if explicitly requested via GIT_RESET_MODE
306
325
  if [[ -n "${GIT_BRANCH:-}" && "${GIT_RESET_MODE}" != "none" ]]; then
307
326
  echo ">> git reset (${GIT_RESET_MODE}) to origin/${GIT_BRANCH}"
@@ -316,21 +335,6 @@ if [[ -n "${REPO_ROOT:-}" && -n "${CODE_REPO:-}" ]]; then
316
335
  fi
317
336
  fi
318
337
 
319
- # Gatekeeping mode: Ensure origin remote is set to the git-gate (CODE_REPO).
320
- # This is necessary because:
321
- # 1. Existing workspaces might have origin pointing to the real upstream
322
- # (e.g., from a previous online mode run or misconfigured setup)
323
- # 2. In gatekeeping mode, origin should ALWAYS be the local git-gate
324
- # We detect gatekeeping mode by checking if CODE_REPO is a local file path.
325
- if [[ "${CODE_REPO}" == file://* ]]; then
326
- CURRENT_ORIGIN=$(git -C "${REPO_ROOT}" remote get-url origin 2>/dev/null || echo "")
327
- if [[ "${CURRENT_ORIGIN}" != "${CODE_REPO}" ]]; then
328
- echo ">> gatekeeping mode: fixing origin remote (was: $(redact_url "${CURRENT_ORIGIN}"))"
329
- git -C "${REPO_ROOT}" remote set-url origin "${CODE_REPO}" || true
330
- git -C "${REPO_ROOT}" remote set-url --push origin "${CODE_REPO}" || true
331
- fi
332
- fi
333
-
334
338
  # In gatekeeping mode, optionally add an "external" remote pointing to the
335
339
  # real upstream. This is informational only - the container cannot actually
336
340
  # reach this URL. Useful for IDEs on the host side that want to know the
File without changes
File without changes