openclaw/src/gateway/server-methods
Azade 3133c7c84e feat(sessions): expose label in sessions.list and support label lookup in sessions_send
- Add `label` field to session entries and expose it in `sessions.list`
- Display label column in the web UI sessions table
- Support `label` parameter in `sessions_send` for lookup by label instead of sessionKey

- `sessions.patch`: Accept and store `label` field
- `sessions.list`: Return `label` in session entries
- `sessions_spawn`: Pass label through to registry and announce flow
- `sessions_send`: Accept optional `label` param, lookup session by label if sessionKey not provided
- `agent` method: Accept `label` and `spawnedBy` params (stored in session entry)

- Add `label` column to sessions table in web UI

- Changed session store writes to merge with existing entry (`{ ...existing, ...new }`)
  to preserve fields like `label` that might be set separately

We attempted to implement label persistence "properly" by passing the label
through the `agent` call and storing it during session initialization. However,
the auto-reply flow has multiple write points that overwrite the session entry,
and making all of them merge-aware proved unreliable.

The working solution patches the label in the `finally` block of
`runSubagentAnnounceFlow`, after all other session writes complete.
This is a workaround but robust - the patch happens at the very end,
just before potential cleanup.

A future refactor could make session writes consistently merge-based,
which would allow the cleaner approach of setting label at spawn time.

```typescript
// Spawn with label
sessions_spawn({ task: "...", label: "my-worker" })

// Later, find by label
sessions_send({ label: "my-worker", message: "continue..." })

// Or use sessions_list to see labels
sessions_list() // includes label field in response
```
2026-01-09 15:32:49 +01:00
..
agent-job.ts refactor: align agent lifecycle 2026-01-05 05:55:02 +01:00
agent.ts feat(sessions): expose label in sessions.list and support label lookup in sessions_send 2026-01-09 15:32:49 +01:00
agents.ts feat(tui): add agent picker and agents list rpc 2026-01-09 01:05:10 +01:00
chat.ts feat: wire multi-agent config and routing 2026-01-09 12:48:42 +00:00
config.ts feat: add gateway config/update restart flow 2026-01-08 01:30:02 +01:00
connect.ts refactor: split gateway server methods 2026-01-04 04:05:18 +01:00
cron.ts fix: add gateway stop/restart commands 2026-01-06 03:25:32 +01:00
health.ts test: stabilize gateway tests 2026-01-04 04:16:38 +01:00
logs.ts fix(ci): sync logs tail protocol artifacts 2026-01-08 03:49:19 +00:00
models.ts test: stabilize gateway tests 2026-01-04 04:16:38 +01:00
nodes.ts test: stabilize gateway tests 2026-01-04 04:16:38 +01:00
providers.ts style: format 2026-01-09 00:33:09 +01:00
send.ts feat: finalize msteams polls + outbound parity 2026-01-09 11:07:32 +01:00
sessions.ts feat(sessions): expose label in sessions.list and support label lookup in sessions_send 2026-01-09 15:32:49 +01:00
skills.ts feat: wire multi-agent config and routing 2026-01-09 12:48:42 +00:00
system.ts test: stabilize gateway tests 2026-01-04 04:16:38 +01:00
talk.ts test: stabilize gateway tests 2026-01-04 04:16:38 +01:00
types.ts feat: add providers CLI and multi-account onboarding 2026-01-08 01:55:59 +01:00
update.ts feat: add gateway config/update restart flow 2026-01-08 01:30:02 +01:00
usage.ts chore: satisfy lint 2026-01-07 11:49:01 +01:00
voicewake.ts test: stabilize gateway tests 2026-01-04 04:16:38 +01:00
web.ts feat: multi-agent routing + multi-account providers 2026-01-06 18:33:37 +00:00
wizard.ts test: stabilize gateway tests 2026-01-04 04:16:38 +01:00