Skip to content

Commit 91d30f7

Browse files
committed
fix: remaining ENTIRE->TRACE env vars and investigation paths
- Fix entire-investigations -> trace-investigations in all investigate files - Fix ENTIRE_INVESTIGATE -> TRACE_INVESTIGATE env vars - Fix ENTIRE_REVIEW -> TRACE_REVIEW env vars - Fix ENTIRE_TEST -> TRACE_TEST env vars - Fix ENTIRE-MANAGED -> TRACE-MANAGED marker string - Fix remaining ENTIRE references in comments and test fixtures
1 parent a237efc commit 91d30f7

19 files changed

Lines changed: 152 additions & 152 deletions

cmd/trace/cli/agent/codex/spawner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
// Less aggressive options (-s workspace-write, --add-dir) are NOT
1919
// sufficient for `trace investigate`: codex's workspace-write policy
2020
// excludes `.git/` regardless of --add-dir, so the agent could not
21-
// write to <git-common-dir>/entire-investigations/<run-id>/
21+
// write to <git-common-dir>/trace-investigations/<run-id>/
2222
// (findings.md / state.json) even when that path was added. The user
2323
// explicitly invoked the agent; the prompt forbids destructive commands.
2424
type codexSpawner struct{}

cmd/trace/cli/agent/codex/spawner_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func TestCodexSpawner_Name(t *testing.T) {
2424
// (-s workspace-write, --add-dir) are not sufficient because codex's
2525
// workspace-write policy excludes anything under `.git/` regardless of
2626
// --add-dir, which blocks investigate's per-run dir at
27-
// <git-common-dir>/entire-investigations/<run-id>/.
27+
// <git-common-dir>/trace-investigations/<run-id>/.
2828
func TestCodexSpawner_Argv(t *testing.T) {
2929
t.Parallel()
3030
env := []string{"FOO=bar", "BAZ=qux"}
@@ -58,14 +58,14 @@ func TestCodexSpawner_Argv(t *testing.T) {
5858

5959
// TestCodexSpawner_Argv_StableUnderInvestigateEnv pins the contract
6060
// that the argv does NOT change based on env vars. (A previous
61-
// implementation appended --add-dir from ENTIRE_INVESTIGATE_FINDINGS_DOC;
61+
// implementation appended --add-dir from TRACE_INVESTIGATE_FINDINGS_DOC;
6262
// that approach didn't actually unblock writes under .git/, so we
6363
// dropped it. This test pins the regression.)
6464
func TestCodexSpawner_Argv_StableUnderInvestigateEnv(t *testing.T) {
6565
t.Parallel()
6666
env := []string{
6767
"FOO=bar",
68-
"ENTIRE_INVESTIGATE_FINDINGS_DOC=/repo/.git/entire-investigations/abcdef012345/findings.md",
68+
"TRACE_INVESTIGATE_FINDINGS_DOC=/repo/.git/trace-investigations/abcdef012345/findings.md",
6969
}
7070
cmd := NewSpawner().BuildCmd(context.Background(), env, "prompt")
7171

cmd/trace/cli/agent/spawn/spawn.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// and `trace investigate` to start an agent process non-interactively.
33
//
44
// The interface is intentionally env-contract-agnostic: callers compose
5-
// their own ENTIRE_REVIEW_* or ENTIRE_INVESTIGATE_* env via
5+
// their own TRACE_REVIEW_* or TRACE_INVESTIGATE_* env via
66
// review.AppendReviewEnv or investigate.AppendInvestigateEnv before calling
77
// BuildCmd. Spawners only own the agent-specific argv shape and stdin
88
// wiring; they do not append review/investigate env.
@@ -22,7 +22,7 @@ type Spawner interface {
2222

2323
// BuildCmd constructs the *exec.Cmd to spawn the agent.
2424
// - env: the full process environment to set on cmd.Env (the caller has
25-
// already appended ENTIRE_REVIEW_* or ENTIRE_INVESTIGATE_* values
25+
// already appended TRACE_REVIEW_* or TRACE_INVESTIGATE_* values
2626
// and stripped any stale entries before calling).
2727
// - prompt: the composed prompt string. The spawner decides whether
2828
// this goes via argv or stdin per the agent's CLI shape.

cmd/trace/cli/agentlaunch/launch.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
)
2323

2424
// LaunchFixAgent starts a normal coding agent session with the given
25-
// prompt. ENTIRE_REVIEW_* and ENTIRE_INVESTIGATE_* env entries are stripped
25+
// prompt. TRACE_REVIEW_* and TRACE_INVESTIGATE_* env entries are stripped
2626
// from the child process so the fix session is not tagged as a review or
2727
// investigate.
2828
//
@@ -61,7 +61,7 @@ func LaunchFixAgent(ctx context.Context, agentName string, prompt string) error
6161
}
6262

6363
// withoutReviewOrInvestigateEnv returns a copy of base with all
64-
// ENTIRE_REVIEW_* and ENTIRE_INVESTIGATE_* entries removed. The returned
64+
// TRACE_REVIEW_* and TRACE_INVESTIGATE_* entries removed. The returned
6565
// slice is fresh — base is never mutated.
6666
func withoutReviewOrInvestigateEnv(base []string) []string {
6767
out := make([]string, 0, len(base))

cmd/trace/cli/agentlaunch/launch_test.go

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
)
99

1010
// TestWithoutReviewOrInvestigateEnv pins the contract that the helper
11-
// strips both ENTIRE_REVIEW_* and ENTIRE_INVESTIGATE_* entries from the
11+
// strips both TRACE_REVIEW_* and TRACE_INVESTIGATE_* entries from the
1212
// supplied env slice while leaving unrelated entries untouched. This is
1313
// the leak-prevention guarantee for fix-agent launches: a parent shell
1414
// may have inherited stale provenance vars, and the fix session must not
@@ -34,36 +34,36 @@ func TestWithoutReviewOrInvestigateEnv(t *testing.T) {
3434
input: []string{
3535
"PATH=/usr/bin",
3636
"HOME=/home/u",
37-
"ENTIRE_REVIEW_SESSION=1",
38-
"ENTIRE_REVIEW_AGENT=claude-code",
39-
"ENTIRE_REVIEW_SKILLS=[\"/x\"]",
40-
"ENTIRE_REVIEW_PROMPT=stale review prompt",
41-
"ENTIRE_REVIEW_STARTING_SHA=stale1",
42-
"ENTIRE_INVESTIGATE_SESSION=1",
43-
"ENTIRE_INVESTIGATE_AGENT=claude-code",
44-
"ENTIRE_INVESTIGATE_RUN_ID=abcdef012345",
45-
"ENTIRE_INVESTIGATE_TOPIC=topic",
46-
"ENTIRE_INVESTIGATE_FINDINGS_DOC=/tmp/f.md",
47-
"ENTIRE_INVESTIGATE_STATE_DOC=/tmp/state.json",
48-
"ENTIRE_INVESTIGATE_STARTING_SHA=stale2",
37+
"TRACE_REVIEW_SESSION=1",
38+
"TRACE_REVIEW_AGENT=claude-code",
39+
"TRACE_REVIEW_SKILLS=[\"/x\"]",
40+
"TRACE_REVIEW_PROMPT=stale review prompt",
41+
"TRACE_REVIEW_STARTING_SHA=stale1",
42+
"TRACE_INVESTIGATE_SESSION=1",
43+
"TRACE_INVESTIGATE_AGENT=claude-code",
44+
"TRACE_INVESTIGATE_RUN_ID=abcdef012345",
45+
"TRACE_INVESTIGATE_TOPIC=topic",
46+
"TRACE_INVESTIGATE_FINDINGS_DOC=/tmp/f.md",
47+
"TRACE_INVESTIGATE_STATE_DOC=/tmp/state.json",
48+
"TRACE_INVESTIGATE_STARTING_SHA=stale2",
4949
},
5050
want: []string{
5151
"PATH=/usr/bin",
5252
"HOME=/home/u",
5353
},
5454
notWant: []string{
55-
"ENTIRE_REVIEW_SESSION=1",
56-
"ENTIRE_REVIEW_AGENT=claude-code",
57-
"ENTIRE_REVIEW_SKILLS=[\"/x\"]",
58-
"ENTIRE_REVIEW_PROMPT=stale review prompt",
59-
"ENTIRE_REVIEW_STARTING_SHA=stale1",
60-
"ENTIRE_INVESTIGATE_SESSION=1",
61-
"ENTIRE_INVESTIGATE_AGENT=claude-code",
62-
"ENTIRE_INVESTIGATE_RUN_ID=abcdef012345",
63-
"ENTIRE_INVESTIGATE_TOPIC=topic",
64-
"ENTIRE_INVESTIGATE_FINDINGS_DOC=/tmp/f.md",
65-
"ENTIRE_INVESTIGATE_STATE_DOC=/tmp/state.json",
66-
"ENTIRE_INVESTIGATE_STARTING_SHA=stale2",
55+
"TRACE_REVIEW_SESSION=1",
56+
"TRACE_REVIEW_AGENT=claude-code",
57+
"TRACE_REVIEW_SKILLS=[\"/x\"]",
58+
"TRACE_REVIEW_PROMPT=stale review prompt",
59+
"TRACE_REVIEW_STARTING_SHA=stale1",
60+
"TRACE_INVESTIGATE_SESSION=1",
61+
"TRACE_INVESTIGATE_AGENT=claude-code",
62+
"TRACE_INVESTIGATE_RUN_ID=abcdef012345",
63+
"TRACE_INVESTIGATE_TOPIC=topic",
64+
"TRACE_INVESTIGATE_FINDINGS_DOC=/tmp/f.md",
65+
"TRACE_INVESTIGATE_STATE_DOC=/tmp/state.json",
66+
"TRACE_INVESTIGATE_STARTING_SHA=stale2",
6767
},
6868
wantSize: 2,
6969
},
@@ -87,26 +87,26 @@ func TestWithoutReviewOrInvestigateEnv(t *testing.T) {
8787
{
8888
name: "only provenance entries: empty output",
8989
input: []string{
90-
"ENTIRE_REVIEW_SESSION=1",
91-
"ENTIRE_INVESTIGATE_SESSION=1",
90+
"TRACE_REVIEW_SESSION=1",
91+
"TRACE_INVESTIGATE_SESSION=1",
9292
},
9393
notWant: []string{
94-
"ENTIRE_REVIEW_SESSION=1",
95-
"ENTIRE_INVESTIGATE_SESSION=1",
94+
"TRACE_REVIEW_SESSION=1",
95+
"TRACE_INVESTIGATE_SESSION=1",
9696
},
9797
wantSize: 0,
9898
},
9999
{
100100
name: "look-alike non-provenance keys survive",
101101
input: []string{
102-
"NOT_ENTIRE_REVIEW_SESSION=1",
103-
"ENTIRE_REVIEW_OTHER=keep", // not a known prefix
104-
"ENTIRE_INVESTIGATE_OTHER=keep", // not a known prefix
102+
"NOT_TRACE_REVIEW_SESSION=1",
103+
"TRACE_REVIEW_OTHER=keep", // not a known prefix
104+
"TRACE_INVESTIGATE_OTHER=keep", // not a known prefix
105105
},
106106
want: []string{
107-
"NOT_ENTIRE_REVIEW_SESSION=1",
108-
"ENTIRE_REVIEW_OTHER=keep",
109-
"ENTIRE_INVESTIGATE_OTHER=keep",
107+
"NOT_TRACE_REVIEW_SESSION=1",
108+
"TRACE_REVIEW_OTHER=keep",
109+
"TRACE_INVESTIGATE_OTHER=keep",
110110
},
111111
wantSize: 3,
112112
},
@@ -142,8 +142,8 @@ func TestWithoutReviewOrInvestigateEnv_DoesNotMutateInput(t *testing.T) {
142142

143143
input := []string{
144144
"PATH=/usr/bin",
145-
"ENTIRE_REVIEW_SESSION=1",
146-
"ENTIRE_INVESTIGATE_SESSION=1",
145+
"TRACE_REVIEW_SESSION=1",
146+
"TRACE_INVESTIGATE_SESSION=1",
147147
"HOME=/home/u",
148148
}
149149
original := slices.Clone(input)
@@ -166,11 +166,11 @@ func TestWithoutReviewOrInvestigateEnv_DoesNotMutateInput(t *testing.T) {
166166
// os.Environ() path, assert no provenance entries survive.
167167
func TestLaunchFixAgent_EmptyEnvFallback_StripsHostProvenance(t *testing.T) {
168168
// t.Setenv mutates process global state; cannot run with t.Parallel().
169-
t.Setenv("ENTIRE_REVIEW_SESSION", "1")
170-
t.Setenv("ENTIRE_REVIEW_AGENT", "claude-code")
171-
t.Setenv("ENTIRE_REVIEW_STARTING_SHA", "deadbeefcafe")
172-
t.Setenv("ENTIRE_INVESTIGATE_SESSION", "1")
173-
t.Setenv("ENTIRE_INVESTIGATE_RUN_ID", "abcdef012345")
169+
t.Setenv("TRACE_REVIEW_SESSION", "1")
170+
t.Setenv("TRACE_REVIEW_AGENT", "claude-code")
171+
t.Setenv("TRACE_REVIEW_STARTING_SHA", "deadbeefcafe")
172+
t.Setenv("TRACE_INVESTIGATE_SESSION", "1")
173+
t.Setenv("TRACE_INVESTIGATE_RUN_ID", "abcdef012345")
174174

175175
// Drive the exact branch LaunchFixAgent takes when cmd.Env is empty:
176176
// withoutReviewOrInvestigateEnv(os.Environ()).
@@ -201,18 +201,18 @@ func osEnvironForTest() []string {
201201
// here — the test file lives in the same package as the implementation).
202202
func hasReviewOrInvestigatePrefix(kv string) bool {
203203
prefixes := []string{
204-
"ENTIRE_REVIEW_SESSION=",
205-
"ENTIRE_REVIEW_AGENT=",
206-
"ENTIRE_REVIEW_SKILLS=",
207-
"ENTIRE_REVIEW_PROMPT=",
208-
"ENTIRE_REVIEW_STARTING_SHA=",
209-
"ENTIRE_INVESTIGATE_SESSION=",
210-
"ENTIRE_INVESTIGATE_AGENT=",
211-
"ENTIRE_INVESTIGATE_RUN_ID=",
212-
"ENTIRE_INVESTIGATE_TOPIC=",
213-
"ENTIRE_INVESTIGATE_FINDINGS_DOC=",
214-
"ENTIRE_INVESTIGATE_STATE_DOC=",
215-
"ENTIRE_INVESTIGATE_STARTING_SHA=",
204+
"TRACE_REVIEW_SESSION=",
205+
"TRACE_REVIEW_AGENT=",
206+
"TRACE_REVIEW_SKILLS=",
207+
"TRACE_REVIEW_PROMPT=",
208+
"TRACE_REVIEW_STARTING_SHA=",
209+
"TRACE_INVESTIGATE_SESSION=",
210+
"TRACE_INVESTIGATE_AGENT=",
211+
"TRACE_INVESTIGATE_RUN_ID=",
212+
"TRACE_INVESTIGATE_TOPIC=",
213+
"TRACE_INVESTIGATE_FINDINGS_DOC=",
214+
"TRACE_INVESTIGATE_STATE_DOC=",
215+
"TRACE_INVESTIGATE_STARTING_SHA=",
216216
}
217217
for _, p := range prefixes {
218218
if strings.HasPrefix(kv, p) {

cmd/trace/cli/integration_test/investigate_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
)
2222

2323
// TestInvestigate_EnvVarAdoptionCondensesMetadataOnNextCommit pins the full
24-
// investigate adoption pipeline: ENTIRE_INVESTIGATE_* env vars are set on the
24+
// investigate adoption pipeline: TRACE_INVESTIGATE_* env vars are set on the
2525
// UserPromptSubmit hook subprocess (as `trace investigate` would do when
2626
// spawning each per-turn agent), the lifecycle handler tags the session as
2727
// agent_investigate, and the metadata is condensed into the checkpoint on the
@@ -122,13 +122,13 @@ func TestInvestigate_EnvVarAdoptionCondensesMetadataOnNextCommit(t *testing.T) {
122122
// investigate.RunInvestigateLoop directly with a fake spawner rather than
123123
// running the full `trace investigate` cobra command. The spawner uses
124124
// /bin/sh to:
125-
// - Append a stance block to ENTIRE_INVESTIGATE_TIMELINE_DOC.
125+
// - Append a stance block to TRACE_INVESTIGATE_TIMELINE_DOC.
126126
// - Invoke `trace hooks claude-code user-prompt-submit` with the same
127-
// ENTIRE_INVESTIGATE_* env it inherited, exercising the lifecycle
127+
// TRACE_INVESTIGATE_* env it inherited, exercising the lifecycle
128128
// adoption path end-to-end.
129129
//
130130
// What this covers:
131-
// - The loop populates ENTIRE_INVESTIGATE_* on the spawned process.
131+
// - The loop populates TRACE_INVESTIGATE_* on the spawned process.
132132
// - The hook child inherits those vars and tags the session.
133133
// - LoopResult/Outcome reflects the recorded stance.
134134
//
@@ -178,22 +178,22 @@ func TestInvestigate_FakeAgentLoop_TagsSessionViaLifecycleHook(t *testing.T) {
178178
fakeAgentScript := fmt.Sprintf(`set -eu
179179
python3 -c '
180180
import json, os, sys
181-
p = os.environ["ENTIRE_INVESTIGATE_STATE_DOC"]
181+
p = os.environ["TRACE_INVESTIGATE_STATE_DOC"]
182182
with open(p, "r") as f:
183183
state = json.load(f)
184184
state["pending_turn"] = {"stance": "approve"}
185185
with open(p, "w") as f:
186186
json.dump(state, f, indent=2)
187187
'
188-
printf '%%s\n' '{"session_id":"%s","transcript_path":"","prompt":"%s"}' | "$ENTIRE_TEST_BINARY" hooks claude-code user-prompt-submit
188+
printf '%%s\n' '{"session_id":"%s","transcript_path":"","prompt":"%s"}' | "$TRACE_TEST_BINARY" hooks claude-code user-prompt-submit
189189
`, sessionID, userText)
190190

191191
spawner := &investigateFakeSpawner{
192192
name: "claude-code",
193193
script: fakeAgentScript,
194194
extraEnv: []string{
195-
"ENTIRE_TEST_BINARY=" + getTestBinary(),
196-
"ENTIRE_TEST_CLAUDE_PROJECT_DIR=" + env.ClaudeProjectDir,
195+
"TRACE_TEST_BINARY=" + getTestBinary(),
196+
"TRACE_TEST_CLAUDE_PROJECT_DIR=" + env.ClaudeProjectDir,
197197
// Force the hook child to operate inside env.RepoDir so it
198198
// resolves the same git repo the test set up.
199199
"PWD=" + env.RepoDir,
@@ -327,7 +327,7 @@ func TestInvestigate_Continue_ResumesAtRecordedAgentIdx(t *testing.T) {
327327
script: `set -eu
328328
python3 -c '
329329
import json, os
330-
p = os.environ["ENTIRE_INVESTIGATE_STATE_DOC"]
330+
p = os.environ["TRACE_INVESTIGATE_STATE_DOC"]
331331
with open(p, "r") as f:
332332
state = json.load(f)
333333
state["pending_turn"] = {"stance": "approve"}
@@ -455,7 +455,7 @@ func TestInvestigate_IssueLink_ResolvesViaFakeGh(t *testing.T) {
455455
cmd.Env = envWithOverrides(
456456
env.cliEnv(),
457457
"PATH="+fakeBinDir+string(os.PathListSeparator)+os.Getenv("PATH"),
458-
"ENTIRE_TEST_BINARY="+getTestBinary(),
458+
"TRACE_TEST_BINARY="+getTestBinary(),
459459
)
460460
output, err := cmd.CombinedOutput()
461461
if err != nil {
@@ -516,21 +516,21 @@ func enableInvestigateAgent(t *testing.T, env *TestEnv, name string) {
516516
}
517517

518518
// SimulateUserPromptSubmitWithInvestigateEnvVars fires UserPromptSubmit with
519-
// the given prompt and a set of ENTIRE_INVESTIGATE_* env vars on the hook
519+
// the given prompt and a set of TRACE_INVESTIGATE_* env vars on the hook
520520
// child process. Mirrors SimulateUserPromptSubmitWithReviewEnvVars.
521521
func (env *TestEnv) SimulateUserPromptSubmitWithInvestigateEnvVars(sessionID, prompt string, extraEnv []string) error {
522522
env.T.Helper()
523523
runner := NewHookRunner(env.RepoDir, env.ClaudeProjectDir, env.T)
524524
// Reuse the runner's review-env helper: it just appends extraEnv
525525
// verbatim on top of the hook subprocess env, so it works for any
526-
// ENTIRE_*_* vars regardless of name.
526+
// TRACE_*_* vars regardless of name.
527527
return runner.SimulateUserPromptSubmitWithReviewEnvVars(sessionID, prompt, extraEnv)
528528
}
529529

530530
// investigateFakeSpawner is a spawn.Spawner whose BuildCmd returns a
531-
// /bin/sh process running a canned script with ENTIRE_INVESTIGATE_* +
531+
// /bin/sh process running a canned script with TRACE_INVESTIGATE_* +
532532
// extra env. The script may also write a stance to the timeline file
533-
// (resolved via $ENTIRE_INVESTIGATE_TIMELINE_DOC) and call back into the
533+
// (resolved via $TRACE_INVESTIGATE_TIMELINE_DOC) and call back into the
534534
// real trace test binary to drive lifecycle hooks.
535535
type investigateFakeSpawner struct {
536536
name string

cmd/trace/cli/integration_test/setup_claude_hooks_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func TestSetupClaudeHooks_AddsAllRequiredHooks(t *testing.T) {
8282
t.Fatalf("failed to read generated Claude search subagent: %v", err)
8383
}
8484
content := string(data)
85-
if !strings.Contains(content, "ENTIRE-MANAGED SEARCH SUBAGENT") {
85+
if !strings.Contains(content, "TRACE-MANAGED SEARCH SUBAGENT") {
8686
t.Error("Claude search subagent should be marked as Trace-managed")
8787
}
8888
if !strings.Contains(content, "trace search --json") {

cmd/trace/cli/integration_test/setup_codex_hooks_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func TestSetupCodexHooks_AddsAllRequiredHooks(t *testing.T) {
5151
t.Fatalf("failed to read generated Codex search subagent: %v", err)
5252
}
5353
searchContent := string(searchData)
54-
if !strings.Contains(searchContent, "ENTIRE-MANAGED SEARCH SUBAGENT") {
54+
if !strings.Contains(searchContent, "TRACE-MANAGED SEARCH SUBAGENT") {
5555
t.Error("Codex search subagent should be marked as Trace-managed")
5656
}
5757
if !strings.Contains(searchContent, "trace search --json") {

cmd/trace/cli/integration_test/setup_gemini_hooks_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func TestSetupGeminiHooks_AddsAllRequiredHooks(t *testing.T) {
8383
t.Fatalf("failed to read generated Gemini search subagent: %v", err)
8484
}
8585
content := string(data)
86-
if !strings.Contains(content, "ENTIRE-MANAGED SEARCH SUBAGENT") {
86+
if !strings.Contains(content, "TRACE-MANAGED SEARCH SUBAGENT") {
8787
t.Error("Gemini search subagent should be marked as Trace-managed")
8888
}
8989
if !strings.Contains(content, "trace search --json") {

0 commit comments

Comments
 (0)