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
5 changes: 5 additions & 0 deletions .claude/skills/sdk/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ In .agent_sync store the sync status:

This setup prevents duplicate syncs when they nothing changed.

The stamp says what was last sent, not where. Trust a matching stamp only when the stored config's
`sync_hash` is that hash too, so a directory synced to a local router and then pointed at a hosted
one (or another app) is synced there, not skipped. JavaScript and Go do this. Python
(`plugins/stream`), .NET, Ruby, Rust and PHP need to check theirs.

## SDK updates

Each SDK has an `.sdk_update_log` file naming the spec and this skill it was last updated against, as git blob ids:
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,9 @@ A folder whose `agent.yaml` names a `plugins` list now fails to load with `plugi

## Bug Fixes

### The Go SDK syncs an agent's directory to a router it was never synced to

`Agent.Sync` skipped a directory whose `.agent_sync` stamp matched it, whichever router the stamp came from, so a directory synced to a local router and then to the hosted one (`go run ./configure` with another `STREAM_ACCELERATION_URL`) answered the hosted router's old config and sent nothing. A matching stamp is now trusted only when the stored config's `sync_hash` is the same hash, as the JavaScript SDK does.
### JavaScript: a live UI patch is merged onto the card the router merges it onto

`Conversation` merges an OpenUI patch onto the UI of the latest earlier turn that completed and was not interrupted, whatever its format, as the router does and as Kotlin has since #2089. It used to take the latest OpenUI card it held, so with an A2UI card in between, or after an interrupted reply, the live preview showed a card Stream Chat's copy then replaced. A patch whose base is not OpenUI now shows no UI on its turn, even a preview already merged onto an older card, and Stream Chat's copy is the one that shows.
Expand Down
38 changes: 38 additions & 0 deletions sdks/go/agents/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ func newBackend(t *testing.T) *backend {
stored := acceleration.AgentConfig{
Id: "config-" + request.Name, Name: request.Name, Instructions: request.Instructions,
Subagent: request.Subagent, Llm: request.Llm, Tags: request.Tags,
SyncHash: &request.Hash,
CreatedAt: time.Now(), UpdatedAt: time.Now(),
}
if !router.ignoresUI {
Expand Down Expand Up @@ -2232,6 +2233,43 @@ func TestSyncFailsWhenConnectionsCannotBeListed(t *testing.T) {

// The router does nothing for a hash it already stored (acceleration/internal/api/sync.go:180),
// so the sync that finds the connection has to send another one.
func TestAnUnchangedDirectoryIsSyncedToARouterItWasNeverSyncedTo(t *testing.T) {
// Synced to a local router first, then pointed at the hosted one: the stamp the first
// sync left matches the directory, but the second router keeps nothing of it.
root := filepath.Join(t.TempDir(), "concierge")
write(t, root, "agent.yaml", "name: concierge\nllm: openai/gpt-5.6\n")
local, hosted := newBackend(t), newBackend(t)
if _, err := agentOn(t, local, Options{Dir: root}).Sync(t.Context()); err != nil {
t.Fatal(err)
}
hosted.mu.Lock()
hosted.configs = []acceleration.AgentConfig{{Id: "config-concierge", Name: "concierge", CreatedAt: time.Now(), UpdatedAt: time.Now()}}
hosted.mu.Unlock()

stored, err := agentOn(t, hosted, Options{Dir: root}).Sync(t.Context())
if err != nil {
t.Fatal(err)
}

hosted.mu.Lock()
synced := len(hosted.syncs)
hosted.mu.Unlock()
if synced != 1 {
t.Fatalf("the router that never had the directory got %d syncs", synced)
}
if stored.Llm == nil || *stored.Llm != "openai/gpt-5.6" {
t.Errorf("the sync answered the router's old config: %+v", stored)
}
if _, err := agentOn(t, hosted, Options{Dir: root}).Sync(t.Context()); err != nil {
t.Fatal(err)
}
hosted.mu.Lock()
defer hosted.mu.Unlock()
if len(hosted.syncs) != 1 {
t.Errorf("an unchanged directory the router has was sent again: %d syncs", len(hosted.syncs))
}
}

func TestASyncThatLeftAConnectorOutAddsItOnceTheConnectionExists(t *testing.T) {
root := filepath.Join(t.TempDir(), "concierge")
write(t, root, "agent.yaml", "name: concierge\nconnectors:\n - name: issues\n connection: company\n")
Expand Down
9 changes: 6 additions & 3 deletions sdks/go/agents/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,12 @@ func (a *Agent) syncFolder(ctx context.Context, client *acceleration.ClientWithR
if err != nil {
return nil, err
}
// A router older than ui_instructions takes the sync and drops them, which the stamp
// cannot tell, so a config missing the UI the stamp covers is synced again.
if stored != nil && (folder.UIInstructions == "" || deref(stored.UiInstructions) != "") {
// The stamp says what this directory last sent, not where: a router that never got it,
// such as a hosted one after a local sync, keeps another sync_hash and is synced. A
// router older than ui_instructions takes the sync and drops them, which the stamp
// cannot tell either, so a config missing the UI the stamp covers is synced again.
if stored != nil && deref(stored.SyncHash) == hash &&
(folder.UIInstructions == "" || deref(stored.UiInstructions) != "") {
return stored, nil
}
}
Expand Down
Loading