Skip to content

ao gap: backend/internal/cli spawn tests fail under ambient AO_SESSION_ID/AO_PROJECT_ID (no env isolation) #31

Description

@polymath-orchestrator

Finding (documented per the vanilla rule — no ao change made)

Found while running the local CI gate for #21 on an ao-hosted worker session. Pre-existing on unmodified main (0405424).

go test ./backend/internal/cli/ fails on any host where the ambient environment carries AO_SESSION_ID / AO_PROJECT_ID — which is every ao-spawned worker session, since ao injects them:

--- FAIL: TestSpawnCommand_MissingProjectContext   spawn_test.go:43: error = daemon returned HTTP 404, want project add hint
--- FAIL: TestSpawnResolvesProjectFromAOSessionID  spawn_test.go:239: spawn failed: daemon returned HTTP 404
--- FAIL: TestSpawnAOSessionIDFailureRequiresProject
--- FAIL: TestSpawnResolvesProjectFromCWD

Repro/proof: env -u AO_SESSION_ID -u AO_PROJECT_ID go test ./internal/cli/ok. The tests build their own httptest daemons but the spawn command's project/session resolution reads the real env first, so the inherited IDs steer it into requests the fakes don't stub (hence the 404s).

Upstream-shaped fix: the cli test setup (e.g. setConfigEnv) should neutralize ao's own session env (t.Setenv("AO_SESSION_ID","") or explicit unset of AO_SESSION_ID/AO_PROJECT_ID) so the suite is deterministic regardless of where it runs. Ironic edge: ao's tests fail inside ao-run workers — "the thing builds the thing" makes this bite every fleet worker running the local gate.

Labelled agent:noauto: upstream-shaped backend change, issue-first per the vanilla rule; remove the label to schedule it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingno-aoOpt OUT of ao auto-pickup entirely — ao never works this

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions