Skip to content

feat(summarizer): point summary endpoint at Studio (retire context-memory)#622

Merged
chrisli30 merged 3 commits into
stagingfrom
feat/summarizer-via-studio
Jun 23, 2026
Merged

feat(summarizer): point summary endpoint at Studio (retire context-memory)#622
chrisli30 merged 3 commits into
stagingfrom
feat/summarizer-via-studio

Conversation

@chrisli30

Copy link
Copy Markdown
Member

Summary

Repoints the workflow-summary endpoint from the deprecated context-memory service to Studio, which now hosts /api/summarize with the identical request/response contract.

  • ContextAPIURL default → https://app.avaprotocol.org (client appends /api/summarize).
  • No struct/contract changes — the existing contextMemory* request/response types deserialize Studio's response as-is.
  • Per-env override via NotificationsSummary.APIEndpoint (avs-infra) + rotated APIKey.

Companion PRs

  • Studio feat/summarizer-from-context-memory (hosts the ported summarizer) — AvaProtocol/studio#1244
  • avs-infra feat/summarizer-endpoint-studio (staging config + key rotation)

Depends on the Studio PR being deployed and SUMMARIZE_AUTH_TOKEN set before flipping prod config. The AVS deterministic fallback covers any gap.

🤖 Generated with Claude Code

…mory)

Default the workflow-summary base URL to https://app.avaprotocol.org, where Studio now
hosts /api/summarize with the identical request/response contract. The Go request/
response structs are unchanged — connecting is a config repoint
(NotificationsSummary.APIEndpoint in avs-infra) + rotated APIKey.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR repoints the task engine’s AI workflow summarization client from the deprecated context-memory service to Studio by updating the default base URL used for the /api/summarize call, while keeping the existing request/response structs and call pattern unchanged.

Changes:

  • Update ContextAPIURL default from https://context-api.avaprotocol.org to https://app.avaprotocol.org.
  • Expand the inline constant documentation to describe the Studio migration and configuration override path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +19 to +23
// ContextAPIURL is the default base URL for the workflow-summary endpoint.
// Migrated from the deprecated context-memory service to Studio, which now hosts
// /api/summarize with the identical request/response contract. The "/api/summarize"
// path is appended by the client. Override per-environment via
// NotificationsSummary.APIEndpoint (avs-infra config) and rotate APIKey.
Addresses Copilot review on #622 — document that NotificationsSummary.APIEndpoint
must be an origin only (client appends /api/summarize); a path or trailing slash would
double the URL. Note the legacy constant name.
…nfig

Remove the ContextAPIURL fallback constant so the summarizer endpoint is
never silently defaulted to a baked-in origin. NewContextMemorySummarizer-
FromAggregatorConfig now returns (Summarizer, error): (nil, nil) when
notifications.summary is disabled, but an error when it is ENABLED yet
misconfigured (unsupported provider, or empty api_endpoint/api_key). The
engine treats that error as fatal at startup, so a broken summarizer
config surfaces loudly instead of degrading to the deterministic path.

Tests use a clearly-named test-only defaultSummarizerURL fallback.
@chrisli30 chrisli30 requested a review from Copilot June 23, 2026 21:31
@chrisli30 chrisli30 merged commit 20ac6e3 into staging Jun 23, 2026
18 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

core/taskengine/summarizer_context_memory.go:36

  • NewContextMemorySummarizer's docstring says callers must pass a bare origin with no trailing slash and no /api/summarize, but the constructor does not normalize. Since the request path is built via string concatenation (c.baseURL + "/api/summarize"), a trailing slash or already-included path will produce malformed/doubled URLs. Normalizing in the constructor makes all call sites (including tests) more robust.
func NewContextMemorySummarizer(baseURL, authToken string) Summarizer {
	return &ContextMemorySummarizer{
		baseURL:    baseURL,
		authToken:  authToken,
		httpClient: &http.Client{Timeout: 30 * time.Second},
	}

Comment on lines 85 to +87
// Override context_api_endpoint to use mock server
mockConfig.MacroSecrets["context_api_endpoint"] = contextMemoryServer.URL
summarizer := NewContextMemorySummarizerFromAggregatorConfig(&mockConfig)
summarizer, err := NewContextMemorySummarizerFromAggregatorConfig(&mockConfig)
Comment on lines +127 to +130
baseURL := strings.TrimSpace(c.NotificationsSummary.APIEndpoint)
if baseURL == "" {
baseURL = ContextAPIURL
return nil, fmt.Errorf("notifications.summary.enabled is true but api_endpoint is empty (set SUMMARIZER_API_URL to the Studio origin, e.g. https://app.avaprotocol.org)")
}
Comment on lines +112 to +120
// NewContextMemorySummarizerFromAggregatorConfig builds the workflow summarizer from the
// aggregator's notifications.summary config (api_endpoint + api_key).
//
// Returns (nil, nil) when summarization is disabled — a valid "off" mode in which callers
// use the deterministic summarizer. Returns (nil, error) when summarization is ENABLED but
// misconfigured (unsupported provider, or empty endpoint/key) so the daemon fails fast at
// startup instead of silently degrading. There is no hardcoded endpoint default: the origin
// must come from config (avs-infra: ${SUMMARIZER_API_URL} / ${SUMMARIZER_API_KEY}).
func NewContextMemorySummarizerFromAggregatorConfig(c *config.Config) (Summarizer, error) {
Comment thread core/taskengine/engine.go
Comment on lines +342 to +347
contextMemorySummarizer, err := NewContextMemorySummarizerFromAggregatorConfig(config)
if err != nil {
// notifications.summary is enabled but misconfigured — refuse to boot rather than
// silently fall back, so a broken summarizer config surfaces loudly at startup.
logger.Fatal("Invalid notifications.summary configuration — refusing to start", "error", err)
}
chrisli30 pushed a commit that referenced this pull request Jun 23, 2026
…eanup, error-path tests

Follow-up to #622/#623 from the claude-review findings:

- engine.go: add os.Exit(1) after logger.Fatal on bad notifications.summary
  config. Logger.Fatal is interface-defined and not guaranteed to exit on
  every implementation (NoOpLogger.Fatal is a no-op), so force termination
  rather than risk falling through to the deterministic-fallback path.
- backup.go: remove the timestamp dir when os.Create or db.Backup fails, so a
  failed/partial backup no longer counts toward backupRetention and prunes a
  valid backup on the next success.
- summarizer.go: note in the error + a comment that the context-memory
  provider name is a legacy identifier (endpoint now points at Studio).
- add summarizer_config_test.go: table-driven unit test covering the
  construction contract (disabled, unsupported provider, empty endpoint/key,
  fully configured, case-insensitive provider).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants