5.0 KiB
5.0 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec |
|---|---|---|---|---|---|---|
| 01-propagate-instance-git-environment | Propagate the instance Git environment | done | 1 | plan.md | ../../specs/platform/requirements/workspace-git-status.md |
Task 01: Propagate the instance Git environment
Make every workspace tracker use the instance's effective Git environment. Enforce non-interactive prompt controls without removing managed credentials or explicit SSH configuration.
Red tests first
Add focused tests that prove these behaviors:
- a tracker Git shim receives managed
GIT_CONFIG_COUNT,GIT_CONFIG_KEY_*, andGIT_CONFIG_VALUE_*entries fromInstanceConfig.AgentEnv - the shim receives
GIT_TERMINAL_PROMPT=0,GCM_INTERACTIVE=Never,GIT_ASKPASS=echo, andSSH_ASKPASS=/bin/false - a direct OpenSSH
GIT_SSH_COMMANDkeeps its command and options while forcingBatchMode=yes; unsupported prefixes and wrappers use the safe non-interactive default ssh -oBatchMode=yesis present when the instance does not supply an SSH command- an ambient credential value does not replace the instance value
- root, repository, submodule, rescan, and lazy trackers receive detached environment copies
- later mutation of the source slice or another tracker does not change a tracker's environment
Record the focused red command before production changes.
Implementation
- Store a detached Git environment on
WorkspaceTracker. - Build the environment from
InstanceConfig.AgentEnv, notos.Environ(). - Add established prompt controls with last-value precedence.
- Preserve direct OpenSSH
GIT_SSH_COMMANDoptions while placingBatchMode=yesbefore any inherited batch-mode option. Use the safe default for unsupported shell prefixes or wrappers, and add it when the variable is absent. - Route
runGitOutputandrunPollingGitOutputthrough the same environment builder. - Apply the environment in the process manager's central tracker configuration path.
- Cover trackers that the manager creates during rescan, reconciliation, submodule discovery, and lazy lookup.
- Keep direct test constructors compatible with an isolated default environment.
Acceptance
- Comparison-target commands can use managed HTTPS credentials from the instance environment.
- Git, Git Credential Manager, and SSH cannot request terminal input.
- All manager-owned trackers use equivalent detached environments.
- Existing command timeout and throttle tests remain green.
Likely files
apps/backend/internal/agentctl/server/process/workspace_tracker.goapps/backend/internal/agentctl/server/process/workspace_git_cmd.goapps/backend/internal/agentctl/server/process/workspace_git_cmd_test.goapps/backend/internal/agentctl/server/process/manager.goapps/backend/internal/agentctl/server/process/manager_rescan.goapps/backend/internal/agentctl/server/process/manager_submodules.goapps/backend/internal/agentctl/server/process/manager_rescan_test.goapps/backend/internal/agentctl/server/process/manager_submodule_test.go
Verification
cd apps/backend && go test ./internal/agentctl/server/process -run 'TestWorkspaceGitEnvironment|TestManagerTrackerGitEnvironment|TestRunGitOutput' -count=1
cd apps/backend && go test ./internal/agentctl/server/process
Parallelism
sequential. Task 02 consumes the tracker environment contract.
Output contract
Record the red and green commands. Record the final environment precedence and proof for each tracker creation path.
Implementation record
- Red:
cd apps/backend && go test ./internal/agentctl/server/process -run 'TestWorkspaceGitEnvironment|TestManagerTrackerGitEnvironment|TestRunGitOutput' -count=1failed because tracker commands used ambient credentials and prompt settings. - Green: the same focused command passed 5 tests after the change; the full process package passed 752 tests before Task 02 and 787 tests across process and instance after the complete package change.
- Precedence: the manager snapshots
InstanceConfig.AgentEnv; each tracker receives a detached copy; lockless and per-observationGIT_INDEX_FILEoverlays are applied; non-interactive controls override inherited values; a direct OpenSSH command keeps its options withBatchMode=yesplaced first, while unsupported command shapes and missing commands use the safe default. - Coverage: root, repository, submodule, rescan, reconciliation, and lazy tracker construction all pass through
configureTrackerornewTrackerForRepo, which applies the manager snapshot before Git work starts.
PR fixup record
- Review fix: direct OpenSSH commands now receive
-oBatchMode=yesimmediately after the command word, so a later inheritedBatchMode=nocannot re-enable terminal prompting; unsupported prefixes and wrappers fall back to the safe non-interactive command. - Test fix: the Git-status freshness fixture now installs its command gate before manager construction and passes an explicit environment snapshot, so tracker commands use the same gate variables as the test without relying on ambient environment reads.