Repository navigation
feat: per-agent feedback, manager-only compaction control, manager transcripts, onboarding, Bob TLS, Grafana SSO - #81
Merged
Conversation
added 12 commits
August 17, 2026 10:41
…alkthrough Registration already returned the plaintext token exactly once — the Setup tab buried it in a banner above three export blocks. Now it gets its own panel: the token, a copy button, and the reason it cannot be shown again. The steps below it are numbered and follow one file. Claude Code reads `~/.claude/settings.json`, not the shell, so the block shown is the WHOLE resulting `env` block with the user's token already substituted — a beginner cannot apply a diff — plus the file's location, what to do when it does not exist, and the one line the owner's wording omits: the caller's own provider key must stay where it is, because this deployment forwards it and a request without one answers 401. The documented silent-override trap is stated where the person who hit it will be looking. Bob and the OpenAI dialect keep their export blocks, one <details> down. `cg_live_` joins the credential shapes internal/redact scrubs. Nothing on the capture or log paths is supposed to carry a token — headers are not recorded — but the shape is ours and exactly known, so it costs one alternation and closes the "a user pasted their token into a prompt" gap now that the UI renders the plaintext at all. The docs page gets the same four steps in the same order, with the depth moved into the existing details/tabs convention. Signed-off-by: Osher-Elhadad <[email protected]>
Three related boundaries, all of them enforced on the server as well as drawn
in the UI — a hidden control is not a permission.
Components tab. Marked data-manager data-local-ok, the same convention the
Benchmarks and Config tabs use. data-local-ok because a single-tenant operator
is the only user of their own box and the view is how they tune it; on a hosted
deployment the pipeline it exists to tune is no longer the tenant's.
Settings tab. A plain account no longer gets the component grid, the mode
selector, the raw YAML or Customise: it gets one line saying its manager sets
the compaction, and keeps everything that is genuinely its own. saveSettings
stops sending config_yaml for a non-manager, so a save of the fields it does
own cannot fail on a field it does not.
PUT /api/me, field by field:
- config_yaml — REFUSED for a non-manager, 403 "a manager sets the compaction
configuration". It decides what runs on the request path, what it costs and
whose cache stays warm; the manager sets it per account through
PATCH /api/tenants/{id}, which already accepted it.
- capture_content — stays the user's. It is consent to store their own
transcripts, and a manager cannot read them, so it cannot be a manager's
decision to make on their behalf.
- up_anthropic / up_openai / up_bob — stay the user's. They select among names
the operator already allow-listed, carry the user's own provider credential,
and change no compaction behaviour.
- label — stays the user's: it names their machine.
- A manager's own PUT /api/me is unaffected, config_yaml included.
Role changes already worked end to end — select, PATCH, registry, audit, and
manager scope on the promoted account's next request, since every write clears
the resolver cache. What was missing is the guard: demoting or disabling the
LAST manager was allowed, and only a manager can hand the role out, so it left
no way back into administration except editing the database. Refused now, with
a message that says to promote another one first. Disabled managers do not
count as a way back — they cannot sign in to re-enable themselves.
Two existing control tests now sign up as the fixture's manager, because
customising through PUT /api/me is a manager's action.
Signed-off-by: Osher-Elhadad <[email protected]>
The form now asks which agent it is about — Claude Code or Bob — and then asks the same seven mandatory star questions either way, so two agents' answers are comparable and the manager's aggregate can read them apart. The old per-agent "agent:<name>" keying and the retired dimensions go with it, and the optional "what would you like added" is folded into the single mandatory comment. The keys and their wording live in Go and are served to the UI, so the form, the manager's table and the manager's email ask one question one way. The 50-character rule stays server-side on the whitespace-collapsing meaningfulLen, storing stays split from mailing, and the read stays manager-only. Schema v7 migrates the control database forward in place: DROP COLUMN wanted, ADD COLUMN agent. Signed-off-by: Osher-Elhadad <[email protected]>
A colleague's Bob session died with "Request failed after 6 attempts: fetch
failed" and nothing in the proxy log. Reproduced end to end against the live
service: the connection never arrives. Node ships its own bundled CA list and
ignores the operating system trust store entirely, so our certificate — issued
by the IBM INTERNAL INTERMEDIATE CA — is untrusted by every Node agent even on
a machine where `curl https://.../healthz` returns 200. Node reports
UNABLE_TO_GET_ISSUER_CERT_LOCALLY; Bob flattens that to "fetch failed".
That made step 2 of the connect page actively misleading. It offered a single
`curl` check, declared an IBM-managed machine had "nothing to do", and claimed
every agent would "fail the same way" — all three are false for Node. So the
person who follows the page correctly still loses an afternoon to a message
that names nothing and a log with nothing in it.
Step 2 now checks once per runtime, states plainly that a passing curl does not
rule Node out, and maps the exact Bob symptom to NODE_EXTRA_CA_CERTS. Both Bob
recipes carry the variable, and the symptom table gains rows for `fetch failed`
and for the 401 a user gets before binding their agent key.
Nothing to fix on the proxy: with the CA in place, the same Bob build reaches
the service over TLS and is refused with the message that names what is missing
("this provider key is not bound to an account"), which Bob surfaces verbatim.
Both known Bob fixes hold — the `Apikey` scheme is parsed and the profile's
region fields are stripped, verified by a real Bob turn completing through a
hosted-mode proxy on a non-default port, attributed to the right account with
agent=bob.
Two pins so our half of the contract cannot regress quietly:
- The refusal body a Bob user reads is now a golden test, on the catch-all and
the model route. It was the one thing that had to stay comprehensible and
nothing asserted on it.
- TestBobCatchAllDoesNotShadowManagementRoutes covers what its comment always
claimed. It tested /healthz and /stats and neither /api/* nor /dashboard/,
and it asserted on status, which cannot tell "the dashboard refused you" from
"the catch-all ate it". It now asserts the pattern ServeMux resolves, over
the dashboard fixture, and checks the catch-all is mounted at all so the test
cannot pass vacuously.
Signed-off-by: Osher-Elhadad <[email protected]>
The manager asked to see the diffs and full sessions in the UI, so the
?tenant= selector now widens content as well as metrics: /api/requests/{id},
/api/sessions/{session}/transcript and /api/archive/{session} serve the
before/after text to a manager for any account, through the same drawer and
diff viewer a tenant gets for their own. No second viewer.
This WIDENS who can read captured request content — agent output, tool
results, source code — from "only the account that produced it" to "that
account and the service manager". It reverses the promise several surfaces
used to make, and it is an explicit owner decision rather than a side effect:
the owner is the service manager and asked for it directly. Every place that
promised the opposite is corrected here, because a privacy promise that is no
longer true is worse than none — the settings consent screen now says in one
line that the manager can read what is stored, and the tenant editor,
transcript panel, Tenants tab, hosted and dashboard docs, the route
reference, the connect guide and the shipped unit file all state the new
rule.
Content capture itself is unchanged: still per-tenant opt-in, still needing
the operator's service-wide switch as well.
Scoping is unchanged for everyone else. A non-manager's tenant is still
OVERWRITTEN from their principal rather than merged, so a crafted ?tenant=
still gets them nothing, and no principal still gets no rows. Only the
manager branch widened, and the tests assert the refusal is a refusal rather
than an accidentally empty result.
The two content-stripping blocks are deleted rather than inverted: each sat
behind an ownership 404 that already admits only the row's owner or the
manager, so after the widening they were unreachable, and dead policy code
reads as policy.
Signed-off-by: Osher-Elhadad <[email protected]>
Signed-off-by: Osher-Elhadad <[email protected]> # Conflicts: # docs/get-started/connect-ibm-service.md
…zed them
The Grafana admin password existed only as a hash in grafana.db and nobody had
it, so /grafana/ was reachable but unusable. Rather than mint a second account
with a second password, make the manager gate the authentication.
GET /api/authz/grafana now answers its 204 with X-Cg-Grafana-User set to the
address of the manager whose cg_dash session satisfied it. nginx captures that
with auth_request_set and sets it on the proxied request; Grafana's auth-proxy
creates the account on first visit and signs the manager in as an Admin. One
login, one notion of who an administrator is, and no password to lose. The
alternative -- a provisioned account each -- ages independently of the
context-guru account beside it, so disabling a manager would leave their Grafana
login working.
That header is a complete authentication, so three controls hold it:
- nginx DEFINES it from the subrequest's answer on every request it proxies,
which replaces whatever the client sent (with the empty string when the gate
named nobody, which Grafana reads as not signed in);
- the endpoint names only the owner of the validated session and ignores any
such header on the request;
- auth_proxy_whitelist is 127.0.0.1,::1, so only this nginx can present it.
TestGrafanaAuthzNamesTheSessionOwnerNotTheRequestsHeader covers the second
across anonymous, plain-user and manager sessions, with and without a forged
header, and asserts a refusal carries no identity at all.
The built-in admin account becomes break-glass: a first install seeds it with a
random value that is neither printed nor saved, because Grafana's default when
GF_SECURITY_ADMIN_PASSWORD is unset is admin/admin. The reset one-liner in the
README now uses --password-from-stdin, so the value reaches neither argv nor
shell history.
Signed-off-by: Osher-Elhadad <[email protected]>
deploy/service/tls-smoke.sh gains the outside half as four checks: /grafana/
answers 401 both bare and with a forged X-Cg-Grafana-User, and the refusal body
carries zero Grafana content either way — a 401 rendered BY Grafana would mean
the request reached it.
Signed-off-by: Osher-Elhadad <[email protected]>
Signed-off-by: Osher-Elhadad <[email protected]> # Conflicts: # docs/reference/routes.md # proxy/manager_test.go
The onboarding rewrite renamed "3. Point your agent at it" to "3. Point Claude Code at it"; the Bob row of the troubleshooting table still linked to the old anchor, which mkdocs --strict rejects. Signed-off-by: Osher-Elhadad <[email protected]>
added 2 commits
August 17, 2026 11:40
…bypass TestSignInAttemptsAreRateLimited failed in CI with '8+ password attempts went unlimited in 2.86s', and the existing guard did not catch it because it checks the wrong failure mode. The limiter's window is a FIXED calendar minute, not a sliding one: tenantLimiter.windowStart is now.Truncate(time.Minute) and the count resets when the minute rolls over. A probe of eight rapid attempts placed across a boundary therefore spends them out of two consecutive budgets, four and four, and neither half reaches the bound of five. The probe observes 'unlimited' from a limiter behaving exactly as designed. The loop runs about three seconds, so that is a one-in-twenty flake, which is what CI hit; the old guard only skipped when the loop outlasted a WHOLE minute, a different and much rarer case. Both probes now detect the crossing and retry on a fresh limiter, and fail only when the attempts went unlimited inside one window — which would be the real bypass each test exists to catch. Verified by repetition: the retry path fired once in 25 runs and the tests passed regardless. Also documented, on spendSignInBudget, what this makes true of the limiter itself, because the assertion could be read as something stronger: a fixed window permits up to twice the nominal rate in a burst straddling a boundary — ten sign-in attempts, not five. Where every attempt already pays a 64 MiB argon2 and the mailed code dies after five wrong guesses, that factor of two is not what decides whether brute force is viable, so it is written down rather than designed out. Signed-off-by: Osher-Elhadad <[email protected]>
…ariable
Bob could not be connected by following our own instructions. Three separate
reasons, each of which looked like the others:
- The bind step needed the cg_dash cookie in a curl line. That cookie is not
displayed anywhere, so it meant a devtools detour, and the natural guess —
pasting the cg_live_ token into it — fails. Settings now has a field: paste
the key, press Bind. The browser already holds the cookie, which was the
only part the person could not do themselves.
- The refusal from those routes read "no context-guru token; send it in
x-context-guru-token", naming a header the control plane never reads. It
sent people to add a header that changes nothing, then to conclude their
token was bad. webPrincipal now answers errNoSession, which names the
dashboard session and says a token is not a cookie.
- The documented base-URL variable does not exist in current Bob. The 2.0.1
bundle reads BOB_GATEWAY_URL and BOB_API_KEY; CUSTOM_BASE_URL and
BOBSHELL_DEFAULT_AUTH_TYPE do not appear in it at all. Getting this wrong is
silent: Bob talks to its default gateway and nothing reaches us. Both names
are documented, keyed on bob --version.
Also recorded, from reading that bundle: an SSO login cannot be bound, because
the digest of a credential is the identity and an SSO bearer is reissued every
login. And NODE_EXTRA_CA_CERTS is no longer unconditional — 2.0.1 merges the
system store via tls.getCACertificates, which needs Node v22.15.
The new test pins the equality the two halves depend on and neither could see:
a key bound from "Bearer <key>", as the field and the curl line send it, must
resolve from "Apikey <key>", as Bob's own auth strategy sends it.
Signed-off-by: Osher-Elhadad <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Six pieces of work the owner asked for, merged and verified together. Everything below
is live on the hosted box already; the databases were wiped as part of the cutover, so
there is no migration concern for existing rows.
Feedback: new questions, one form per agent
The form now asks which agent it is about — Claude Code or Bob — and shows the same
seven star questions either way, followed by one mandatory comment of at least 50
characters of real text. New keys:
overall,performance,compaction,latency,dashboard,ease,recommend.The old dimension set, the
agent:<name>free-text keying and the separate optional"what would you like added" field are deleted rather than deprecated — the databases
are being wiped, so carrying two shapes would buy nothing. Control-DB migration v7
drops
wantedand addsagentin place; the control database is never renamed aside, sothat had to be a real migration.
Summarizepartitions by agent and reuses its own body per group intoby_agent, givingper-question means, the NPS split and the daily trend for each agent as well as overall.
That asymmetry is the point of the selector: it is what distinguishes "Context Guru is
slow" from "one agent's integration is slow".
The question wording lives in Go only and is served to the browser —
/api/mecarries itfor the form, because a plain account gets 403 from the manager's
GET /api/feedbackanda second copy in JavaScript would drift from the one the email uses.
Only the manager configures compaction
The Components tab and the Settings tab's component grid, mode select and raw-YAML editor
are manager-only, using the existing
data-manager/data-local-okconvention ratherthan a second mechanism. A single-tenant local operator keeps them; a non-manager tenant
on the hosted box does not.
Hiding a control is not a permission, so
PUT /api/menow refusesconfig_yamlfrom anon-manager with 403. The split is deliberate, field by field:
config_yamlcapture_contentup_anthropic/up_openai/up_boblabelA lockout bug, fixed: the last remaining manager could be demoted or disabled. Only
a manager can hand the role out, and the dashboard is the only place it happens, so either
action permanently ended administration of the deployment with no way back. Disabling
counts because a disabled manager cannot sign in to re-enable themselves. Now
ErrLastManager, with a test.The manager can read diffs and full sessions
At the owner's explicit request,
GET /api/requests/{id},GET /api/sessions/{session}/transcriptandGET /api/archive/{session}now servebefore/after text to a manager for any account, through the same drawer and diff viewer a
tenant gets for their own. No second viewer.
This widens who can read captured request content — agent output, tool results, source
code — from "only the account that produced it" to "that account and the service manager".
It reverses a promise several surfaces used to make, and every one of them is corrected
here: the consent screen now states in a visible line that the manager can read what is
stored, along with the tenant editor, the transcript panel, the Tenants tab,
hosted.md,dashboard.md, the route reference, the connect guide and the shipped unit file. A privacypromise that is no longer true is worse than none.
Scoping is unchanged for everyone else: a non-manager's tenant is still overwritten
from their principal rather than merged, so a crafted
?tenant=gets them nothing, and noprincipal still gets no rows. Three tests that asserted the old policy were rewritten
rather than deleted, each one's comment stating the new rule and that it replaces the old.
Content capture itself is untouched: still per-tenant opt-in, still needing the operator's
service-wide switch.
Onboarding: the token, once, then four steps
POST /api/verifyalready returned the plaintext token once; what was missing was the UItreating it as the one-time event it is. The Setup tab now opens with the token in large
monospace, a copy button, and "Shown once. We store only its hash, so nobody — including
us — can show it again", with the steps below pre-filled with that token.
The steps show the whole resulting
envblock rather than a diff, because a beginnercannot apply a diff, and they name the trap the runbook already documented: an
envblockin
~/.claude/settings.jsonsilently overrides an exportedANTHROPIC_BASE_URL, which iswhy someone can export the variable and watch an empty dashboard.
They also carry one line the owner's own wording omitted, without which every request 401s:
keep your own provider key where it is. This deployment is caller-pays —
proxy/tenancy.gorefuses when the upstream has nokey_envand the caller sent no key —so the context-guru token in
x-context-guru-tokenidentifies the account and the user'skey pays. Verified against the live front end: with the token header, "unknown or revoked
context-guru token"; without it, a different error naming the header.
A credential leak fixed on the way through:
cg_live_was not in the log-scrubbingdenylist, so a failed sign-in wrote
presented=cg_live_…in full to stderr and Loki — atthe DEBUG level this deployment runs. One alternation in
internal/redact/redact.gocoversboth the capture path and log records, since they read the same vocabulary. Confirmed by
stashing the fix and watching the new test fail.
Bob: it was never reaching us
Reproduced from scratch. Real Bob straight to its own endpoint completes a turn; through
our host it dies with
Request failed after 6 attempts: fetch failedand nothing appearsin the proxy log or the nginx access log — the connection never leaves the client.
Node ships its own bundled CA list and ignores the OS trust store, and our certificate
chains through
IBM INTERNAL INTERMEDIATE CA:Not our bug — nginx serves the chain correctly, verified with
s_client— but our docsmade it undiagnosable: they offered a single
curlcheck, told IBM-managed machines theyhad nothing to do, and claimed every agent on a machine fails alike. All three are false
for Node, and a passing
curlis exactly what sends someone looking in the wrong place.Step 2 now checks per runtime and maps the literal
fetch failedstring to thevariable.
The wall behind it is the pre-bind 401, which every Bob user meets because Bob can send no
header of ours and is identified by the sha256 of its key. The message already names the
missing credential and Bob surfaces it verbatim; it is now pinned by a golden test in
Bob's real
Authorization: Apikeydialect.The existing "catch-all does not shadow the dashboard" test was passing while testing only
/healthzand/stats— neither of the paths named in its own comment — and asserting onstatus, which cannot distinguish "the dashboard refused you" from "the catch-all ate it".
It now asserts the pattern
ServeMuxresolves across nine routes, with a check that thecatch-all is mounted so it cannot pass vacuously.
Grafana: the manager gate is the sign-in
Grafana's auth proxy, so the gate that already authenticated the manager one request
earlier is also the sign-in — no second password, and an account auto-created with the
manager's email as Admin. A provisioned account per manager lost on lifecycle, not effort:
it is a second credential store that ages independently, so disabling a manager here would
leave their Grafana admin login working.
An auth-proxy header is a complete authentication, so three controls hold it:
auth_request_set+ unconditionalproxy_set_header X-Cg-Grafana-User $cg_grafana_userctlAuthzGrafananames only the owner of the validatedcg_dashsessionGF_AUTH_PROXY_WHITELIST=127.0.0.1,::1, Grafana on loopbackTestGrafanaAuthzNamesTheSessionOwnerNotTheRequestsHeadercovers anonymous / plain user /manager × forged and clean: a refusal carries no identity, and a forged header never becomes
one. The "401 with zero Grafana content" property had only ever been prose in three files;
it now has four executable checks in
tls-smoke.sh, passing 17/0 against the live host.The disclosed
adminpassword — it sat ondocker runargv, world-readable in/proc, onevery past install — is rotated, and
install.shno longer generates or prints one.Verification
gofmt -l .empty ·go vet ./...clean ·CGO_ENABLED=1 go test -race ./...green acrossall 25 packages ·
mkdocs build --strictclean · live:/healthz200,/grafana/401 withzero Grafana content, a forged
X-Cg-Grafana-Userstill 401, the token header still parsed.