ac4af582301a4e8a29245dbba767eba31334ddf9
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
9916a94608 |
gateway, usage, plugins: OTel export is the first plugin on the gateway's observer point (P3)
P3 of docs/subsystems/plugin-runtime.md opens the gateway to plugins. The
observer point is first: it only reads, so it carries the least risk.
With plugins/otel off, the gateway exports nothing and does no observing
work. It keeps no reply whole and adds no request context.
- usage.Observer:
- Methods: Serve, Bodies, Begin(Request) Watch and Ledger(Record). Watch
has Attempt and End.
- Observe(o) registers an observer until its remove is called.
- ServeObservers is counted, and only Server.ListenAndServe calls it.
- ObservedBodies takes the most any observer wants.
- Record.SkipOTel becomes Watched, set by appendUsage for a request an
observer watched.
- The gateway's otel.go becomes observe.go:
- observeRequest asks each observer through Begin.
- attempt and end call each Watch. Bodies are added only when an
observer asks for them, and the whole reply only for WholeBodies.
- internal/otlp: the exporter (otel*.go) moves out of internal/usage, and
the gateway's per-request span state moves into request.go. otlp.New()
is an Exporter, a usage.Observer. What it sends is unchanged.
- plugins/otel:
- Apply registers otlp.New() and disposes of it when turned off.
- InUse is 1 while settings.OTelExport says to send. A user who exports
only through MAGPIE_OTEL_* keeps the plugin on under Essentials.
- pluginrt.KeepFresh: the process serving the gateway refreshes every 2s
when plugins.yml or settings.json changes. A switch made in the window or
the CLI reaches a running gateway, or a headless serve, without a restart.
- docs: plugin-runtime.md gets a P3 section, a gateway runtime path and an
updated failure section; reference.md says the export is the otel plugin.
Run at this tree on origin/main
|
||
|
|
595b9a25bc |
gateway: WorkBuddy's own X-Conversation-ID names its session, so Routing groups its requests by conversation, not under No session ID (#2236, EdwinDigital)
WorkBuddy and CodeBuddy name their conversation in X-Conversation-ID, which sessionHeaders didn't list, so every WorkBuddy request had no session: Routing put them all under "No session ID", and affinity, usage, transcripts, OTel and a remote magpie lost the conversation too. The header is appended last, so the aliases already read keep precedence, and the vendor is never sent it. Moved users are covered by the same line: the gateway gives a plugin the session as ConversationHeader from conversationID(), plugins.go passes it as FetchRequest.Session, and the WorkBuddy plugin derives its own X-Conversation-ID from that. No plugin change is needed. EdwinDigital's record (Windows ARM64, Go 1.26.8, temporary HOME): - Removing only the alias makes TestWorkBuddySessionHeader, TestWorkBuddySessionThroughGateway and TestRemoteMagpieKeepsTheSession fail. They pass with -count=20. - gofmt and git diff --check are clean. Windows go vet ./... and Linux ARM64 go vet -tags nogui ./... pass. - Installed WorkBuddy 5.8.2 (engine 2.161.0) ran against the patched gateway and a loopback streaming mock. Two native sessions grouped 2+1, with both titles resolved. Review and run at this head (macOS, Go private cache, sandbox HOME): - I read the patch line by line. - The three tests pass. Commenting out the alias by hand makes all three fail. - gofmt -l is clean. go vet passes on darwin, linux -tags nogui and windows. - go test -tags nogui -count=1 -timeout 40m ./internal/gateway/: ok (811s). Not tried by me: a real WorkBuddy or CodeBuddy client, and real vendor calls. EdwinDigital ran WorkBuddy against a mock. |