DEV-000069 include agent delegation response candidates
CI / test (push) Successful in 19s
CI / test (pull_request) Successful in 16s

This commit is contained in:
m
2026-08-17 20:20:32 +03:00
parent b3491520bd
commit 41b0ac196e
2 changed files with 104 additions and 2 deletions
@@ -65,6 +65,39 @@ func TestCreatorResponseEndpointRecordsAmbiguousWithoutSilentTargetMutation(t *t
}
}
func TestCreatorResponseEndpointContinuesDelegationAttentionViaNaturalMessage(t *testing.T) {
core := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
_ = json.NewEncoder(w).Encode(identity.CreatorSession{ActorID: "actor-1", PrincipalID: "principal-1"})
}))
defer core.Close()
identityClient, err := newCreatorIdentityClient(core.URL, core.Client())
if err != nil {
t.Fatal(err)
}
repository := &fakeResponseRepository{candidates: []continuitydomain.ResponseCandidate{
{Attention: continuity.AttentionItem{
ID: "work:delegation:delegation-1",
OwnerPrincipalID: "principal-1",
ScopeID: "scope-1",
SourceKind: continuity.AttentionSourceAgentDelegation,
SourceExternalRef: "work:delegation:delegation-1",
State: continuity.AttentionPending,
Summary: "Нужен твой выбор по задаче coding-agent: docs/PROJECT_STATUS.md",
Revision: 1,
}},
{Attention: continuity.AttentionItem{ID: "attention-1", SourceProspectiveID: "prospective-1", State: continuity.AttentionDelivered, Summary: "старое напоминание"}},
}}
mux := http.NewServeMux()
registerCreatorResponseRoute(mux, identityClient, repository, func() time.Time { return time.Unix(100, 0) })
request := httptest.NewRequest(http.MethodPost, "/v1/creator/responses", strings.NewReader(`{"SourceUtteranceID":"utterance-1","SourceIntentID":"intent-1","Message":"Продолжай задачу coding-agent по docs/PROJECT_STATUS.md","RequestedAtUnixMillis":100000}`))
request.Header.Set("Authorization", "Bearer ok")
recorder := httptest.NewRecorder()
mux.ServeHTTP(recorder, request)
if recorder.Code != http.StatusCreated || repository.applied.Operation != continuity.ResponseContinue || repository.applied.TargetExternalRef != "work:delegation:delegation-1" || repository.applied.Outcome != continuity.ResponseOutcomeContinued {
t.Fatalf("status=%d applied=%#v body=%s", recorder.Code, repository.applied, recorder.Body.String())
}
}
type fakeResponseRepository struct {
candidates []continuitydomain.ResponseCandidate
applied continuity.HumanResponse