Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions go/e2e/agent_ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,12 @@ func (f *Fixture) Provision(ctx context.Context, accountID, clientRequestID stri
}

// StartSession brings the agent in a provisioned container online over
// CompassService with an initial prompt and returns the server-side session id.
func (f *Fixture) StartSession(ctx context.Context, containerName, initialPrompt string) (sessionID string, err error) {
// CompassService and returns the server-side session id.
func (f *Fixture) StartSession(ctx context.Context, containerName string) (sessionID string, err error) {
rctx, cancel := context.WithTimeout(ctx, rpcTimeout)
defer cancel()
resp, err := f.Compass().StartAgentSession(rctx, connect.NewRequest(&compassv1.StartAgentSessionRequest{
ContainerName: containerName,
InitialPrompt: initialPrompt,
}))
if err != nil {
return "", fmt.Errorf("StartAgentSession RPC: %w", err)
Expand All @@ -69,12 +68,11 @@ func (f *Fixture) StartSession(ctx context.Context, containerName, initialPrompt
// for the resumed lifetime (a NEW id — the durable transcript stays keyed under
// resumeSessionID). Returns an error rather than panicking so the caller decides
// fatality; the per-call deadline is threaded from ctx.
func (f *Fixture) Resume(ctx context.Context, containerName, resumeSessionID, initialPrompt string) (sessionID string, err error) {
func (f *Fixture) Resume(ctx context.Context, containerName, resumeSessionID string) (sessionID string, err error) {
rctx, cancel := context.WithTimeout(ctx, rpcTimeout)
defer cancel()
resp, err := f.Compass().StartAgentSession(rctx, connect.NewRequest(&compassv1.StartAgentSessionRequest{
ContainerName: containerName,
InitialPrompt: initialPrompt,
ResumeSessionId: resumeSessionID,
}))
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions go/e2e/legfive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func TestLegFivePersistAndResume(t *testing.T) {
_ = f.RemoveWorkspace(ctx, container1, "leg5-teardown-1")
})

originalSessionID, err := f.StartSession(ctx, container1, "say the pre-teardown reply and stop")
originalSessionID, err := f.StartSession(ctx, container1)
if err != nil {
t.Fatalf("StartSession (container1): %v", err)
}
Expand Down Expand Up @@ -105,7 +105,7 @@ func TestLegFivePersistAndResume(t *testing.T) {
// Resume the ORIGINAL logical session into the fresh container. Resume MINTS
// a NEW live session id for this lifetime (the durable transcript stays keyed
// under originalSessionID); resumedSessionID is that minted id.
resumedSessionID, err := f.Resume(ctx, container2, originalSessionID, "say the resumed reply and stop")
resumedSessionID, err := f.Resume(ctx, container2, originalSessionID)
if err != nil {
t.Fatalf("Resume (container2): %v", err)
}
Expand Down
15 changes: 7 additions & 8 deletions go/e2e/legthreefour_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,18 @@ func TestLegThreeFourSpawnAndMessaging(t *testing.T) {
ctx := context.Background() // test root, threaded into NewFixture + every primitive

// The peer the scripted spawn mints: a unique handle the leg-3 assertions
// resolve the fresh account and its container by. The initial prompt keeps
// the peer idle (no live-model egress: the peer has no canned backend of its
// own; it simply provisions and idles, like the leg-2 primitives path).
// resolve the fresh account and its container by. The peer provisions and
// idles (no live-model egress: the peer has no canned backend of its own,
// like the leg-2 primitives path).
const peerHandle = "leg34-peer"
const peerDisplayName = "Leg Three-Four Peer"
// The spawn tool's arguments, serialized JSON (the OpenAI tool-call
// contract). Built from the consts above so the minted handle/display name
// cannot drift from what the leg-3 assertions resolve. Field names are the
// spawnParameters wire schema (lifecycle.ts:79-93): handle, display_name,
// initial_prompt.
// spawnParameters wire schema (lifecycle.ts): handle, display_name.
spawnArgsJSON := fmt.Sprintf(
`{"handle":%q,"display_name":%q,"initial_prompt":%q}`,
peerHandle, peerDisplayName, "idle, await instructions",
`{"handle":%q,"display_name":%q}`,
peerHandle, peerDisplayName,
)
// The assistant text the closing turn settles on, asserted present in the
// spawner's transcript (the same transcript-contains-canned-reply proof as
Expand Down Expand Up @@ -111,7 +110,7 @@ func TestLegThreeFourSpawnAndMessaging(t *testing.T) {
_ = f.RemoveWorkspace(ctx, runner.AgentContainerNamePrefix+string(peer.ID), "leg34-peer-teardown")
})

sessionID, err := f.StartSession(ctx, spawnerContainer, "spawn a peer and stand by")
sessionID, err := f.StartSession(ctx, spawnerContainer)
if err != nil {
t.Fatalf("StartSession (spawner): %v", err)
}
Expand Down
6 changes: 3 additions & 3 deletions go/e2e/legtwo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestLegTwoPrimitives(t *testing.T) {
_ = f.RemoveWorkspace(ctx, containerName, "leg2-primitives-teardown")
})

sessionID, err := f.StartSession(ctx, containerName, "hello from leg-2 primitives")
sessionID, err := f.StartSession(ctx, containerName)
if err != nil {
t.Fatalf("StartSession: %v", err)
}
Expand All @@ -63,7 +63,7 @@ func TestLegTwoPrimitives(t *testing.T) {
}

// TestLegTwoRealTurn is the full leg-2 scenario: CreateAgent -> Provision ->
// StartSession(initial_prompt) -> AwaitSessionSettled -> assert the session's
// StartSession -> AwaitSessionSettled -> assert the session's
// transcript is non-empty. On H2 it was PRESENT-BUT-SKIPPED: the leg-2 turn
// cannot complete without a deterministic model backend, so on the bare stack
// AwaitSessionSettled would hang and the transcript stay empty. H3 (SEA-1787)
Expand Down Expand Up @@ -105,7 +105,7 @@ func TestLegTwoRealTurn(t *testing.T) {
_ = f.RemoveWorkspace(ctx, containerName, "leg2-realturn-teardown")
})

sessionID, err := f.StartSession(ctx, containerName, "say hello and stop")
sessionID, err := f.StartSession(ctx, containerName)
if err != nil {
t.Fatalf("StartSession: %v", err)
}
Expand Down
34 changes: 6 additions & 28 deletions go/gen/compass/v1/compass.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 3 additions & 12 deletions go/internal/gen/compass/v1/agent_gateway.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions go/internal/runner/gateway/lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ func spawnCall() *compassv1internal.LifecycleCallRequest {
return &compassv1internal.LifecycleCallRequest{
CallId: testCallID,
Call: &compassv1internal.LifecycleCallRequest_Spawn{Spawn: &compassv1internal.SpawnPeerRequest{
Handle: "peer-1",
InitialPrompt: "go",
Handle: "peer-1",
}},
}
}
Expand Down
1 change: 0 additions & 1 deletion go/server/lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ func (l *lifecycleService) provisionAndStart(

startResp, err := l.hub.Start(ctx, "", &compassv1.StartAgentSessionRequest{
ContainerName: container,
InitialPrompt: req.GetInitialPrompt(),
})
if err != nil {
l.rollbackSpawn(ctx, container, "")
Expand Down
2 changes: 0 additions & 2 deletions go/server/lifecycle_e2e_pgtest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ func e2eSpawnHappyPath(t *testing.T, w *e2eWire) (peerID store.AccountID, peerCo
Call: &compassv1internal.LifecycleCallRequest_Spawn{Spawn: &compassv1internal.SpawnPeerRequest{
Handle: "peer-1",
DisplayName: "Peer One",
InitialPrompt: "go",
ClientRequestId: "spawn-req-1",
}},
}))
Expand Down Expand Up @@ -371,7 +370,6 @@ func TestForeignOwnerDespawnOverTheWireIsIndistinguishableNoOp(t *testing.T) {
peerBResp, err := w.lc.SpawnAsAccount(ctx, agentB.ID, &compassv1internal.SpawnPeerRequest{
Handle: "peer-b",
DisplayName: "Peer B",
InitialPrompt: "go",
ClientRequestId: "spawn-b-1",
})
if err != nil {
Expand Down
2 changes: 0 additions & 2 deletions go/server/lifecycle_pgtest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ func TestSpawnInheritsCallerOwner(t *testing.T) {
resp, err := f.lc.SpawnAsAccount(ctx, f.agentID, &compassv1internal.SpawnPeerRequest{
Handle: "peer-1",
DisplayName: "Peer One",
InitialPrompt: "go",
ClientRequestId: "spawn-1",
})
if err != nil {
Expand Down Expand Up @@ -128,7 +127,6 @@ func TestSpawnSetsParentToCaller(t *testing.T) {
resp, err := f.lc.SpawnAsAccount(ctx, f.agentID, &compassv1internal.SpawnPeerRequest{
Handle: "peer-parent",
DisplayName: "Peer Parent",
InitialPrompt: "go",
ClientRequestId: "spawn-parent",
})
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion go/server/service_spawn_pgtest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func TestSpawnAgentRunsProvisionThenStart(t *testing.T) {

resp, err := f.client.SpawnAgent(ctx, connect.NewRequest(&compassv1.SpawnAgentRequest{
AgentAccountId: string(f.agentID),
InitialPrompt: "go",
ClientRequestId: "spawn-happy",
}))
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion go/server/spawn.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ func (s *service) runSpawn(ctx context.Context, msg *compassv1.SpawnAgentRequest

startResp, err := s.StartAgentSession(ctx, connect.NewRequest(&compassv1.StartAgentSessionRequest{
ContainerName: container,
InitialPrompt: msg.GetInitialPrompt(),
}))
if err != nil {
return nil, err
Expand Down
Loading
Loading