Skip to content

[Feature] A guardian should be able to manage a whole managed profile from their own account, with no second login #1403

Open

Description

@ch3funio

Problem

Managing a managed profile (a child, a senior in someone's care) works from the guardian's own account in every section but one: after switching to the record, Documents is empty — no upload zone, just "Documents can only be added by the record owner" — and POST /api/documents/inbound returns 403 sharing.not_permitted. A scanned lab result or discharge summary therefore has nowhere to go; it lives as a file outside HealthLog and the record has no documents at all.

Checked on v1.47.6, self-hosted (Docker Compose): Settings → Shared access → managed profile → switch to the record → Documents → the note above; the POST 403s.
docs/self-hosting/account-sharing.md says the vault is writable at no level, so this is deliberate — filing it as a feature request, not a bug.

Proposed solution

The guardian manages that record's vault the way they already manage every other section of it — add, view, edit and delete — without logging in as the child/senior and without creating a login for them:

  1. Upload into the record's vault from the guardian's own session (PDF, images — the types an owner upload already takes).
  2. See the record's documents and open or download them.
  3. Rename, delete and restore an entry, so a bad scan is replaced instead of piling up.
  4. Storage and quota count against the record the request runs inside — the child's, not the guardian's.
  5. The activity log names the guardian as the actor; the document belongs to the record.
  6. Shared records (adult–adult) unchanged: "owner only" stays as it is, at every grant level.

That is the whole ask. How it is wired is yours — I do not know the internals (managed / shared / delegations) well enough to point at the code, and I would rather not prescribe it.

Alternatives considered

  • Handover to a real account. Needs a mailbox, a password and a second factor for a person who cannot look after them — the thing managed profiles exist to avoid.
  • Keeping the scans outside HealthLog. Not a record: not in the profile, not counted as its documents, not in its export.
  • Opening the vault to every MANAGE grant. "Owner only" is right for an adult–adult share; I am not asking for that.
  • A general "upload into any record" API. Larger than the problem, and a cross-record write primitive I would not want in the tree for one guardian and one profile.

Affected surface

API, Web (PWA)

Additional context

v1.47.6, single family installation, self-hosted with Docker Compose, no telemetry.

Happy to send a PR with tests — I ran the ones on this path on my clone of tag v1.47.6: src/tests/domain-write-support-guard.test.ts (the permission table is guarded by a scan of the routes: setting documents: { manage: true } with no new route fails two tests at once, e.g. "gives a manage grant every section with a delegated route, and never the vault"), src/components/tests/delegated-write-affordances.test.tsx (56 tests green locally together with the guard) and e2e/v138-managed-record-capabilities.spec.ts → "withholds the vault's upload control and says why", which would need inverting (not run here — needs a live instance and a database).

Happy to test a build too. If you prefer to split it: the managed-profile upload path is the core, the rest of the vault verbs could follow.

Pre-flight checks

  • I confirmed this is not a duplicate of an existing feature request.
  • I'm proposing a feature, not asking a usage question (those go to Discussions or the docs).

Activity

  1. added
    enhancement
    on Nov 17, 2026
  2. MBombeck commented on Nov 17, 2026

    @MBombeck
    Owner

    @ch3funio Thanks for the careful write-up. You're right about the gap: a managed profile is meant to be run entirely from the guardian's account, and the vault is the one section where that breaks, so the record ends up with no documents at all. I'd like this in, scoped the way you describe. Only managed profiles change. The guardian can upload, view, rename, delete and restore, storage counts against the record, and the activity log names the guardian as the actor. Adult shares stay owner-only at every level.

    A PR is very welcome. In review I'll look for three things. The permission should hang on the managed relationship, not on a MANAGE grant in general, so a shared adult record can't reach the vault through the same path. The guard test and the e2e spec should change with it rather than get looser. And the account sharing page in the docs needs the new row. If you'd rather I take it, say so and I'll pick it up.

  3. added
    roadmap
    on Nov 17, 2026
  4. ch3funio commented on Nov 17, 2026

    @ch3funio
    Author

    Thanks — and managed-only is exactly the line I would draw too: the permission should follow the guardian relationship, not the grant level, so an adult share cannot reach the vault through the same path.

    Please take it. And a correction to my own issue: I offered a PR there, and that was a mistake — I do not write TypeScript, and anything I sent would come from an AI assistant I could not vouch for line by line.

    To be straight about how much testing I can offer: the record is new, but the paperwork behind it is not — a shelf of physical files, most of them already scanned to PDF. So there is real volume to throw at the upload, not three test files. What I cannot do is build or run a branch; I deploy released images. On a release I can report precisely:

    • upload a scan into the managed profile's Documents; it appears in that record's list and opens;
    • rename it, delete it, restore it;
    • the storage number after the upload — on the record and on my own account;
    • the activity log entry, and who it names as the actor.

    For the shared side I would have to set up a second adult account first; if you want that path exercised before a release, say so and I will arrange it.
    One more thing, no code involved: I can read the new account-sharing row as the person who has to follow it. I run this instance and I am the one setting the managed profile up, so I am a fair reader of whether that paragraph is enough — and I will say plainly if it is not.

    Same disclosure as in the issue: this reply, and the issue itself, were put together with the help of my own AI agent. It read the code paths with me and did the drafting; the setup, the opinions and the checks on my instance are mine.

  5. MBombeck commented on Nov 17, 2026

    @MBombeck
    Owner

    @ch3funio Thanks for being straight about it, and no harm done. I'll build it. The shared side I'll cover with tests here, so you don't need to set up a second adult account. What would help most is what you offered: on the release, upload real scans into the managed profile, rename, delete and restore one, and tell me the storage numbers on the record and on your own account, and who the activity log names. And yes, please read the new account sharing paragraph as the person who has to follow it. I'll post here when it's out.

  6. MBombeck commented on Nov 18, 2026

    @MBombeck
    Owner

    @ch3funio This is in 1.48.0, out today (https://github.com/MBombeck/HealthLog/releases/tag/v1.48.0).

    From your own account, inside the managed profile, you can now upload scans, open, rename, delete and restore them, have a lab report read and confirm the values into the profile's labs, and switch on automatic reading for the profile. Storage counts against the profile, and its activity log names you. Shared adult accounts stay as they were: documents belong to their owner at every access level.

    As you offered: could you put a few real scans into the profile and tell me where it gets in the way? Upload on a phone and the lab read are the two I'm most curious about.

  7. added
    waiting-on-reporter
    on Nov 18, 2026
  8. ch3funio commented on Nov 19, 2026

    @ch3funio
    Author

    What works

    • Upload from the guardian's own account into the profile: fine. The empty state offers "upload the first
      document", the file processes, and it lands in that record — it does not appear on my own account,
      not even by name search. So the document belongs to the profile, as intended.
    • Delete, restore from Recently deleted, and the sync between phone and desktop (a phone upload shows up in
      the open desktop list without a refresh) all behave.
    • Editing the title, kind and filing date saves on commit, from the phone as well.
    • Rename/delete/restore never asked me for the child's login — which was the whole point of the request.

    What does not work

    1. A guardian's upload is written to the audit trail as the profile's action, not the guardian's.
    The release note says "its activity log names you". The row exists, but it names the child:

    GET /api/admin/audit-log?filter=all&action=documents.inbound.store
    → {"action":"documents.inbound.store", …, "user":{"username":"managed-1f4f9bc9da4280…"}}
    

    Rows from my own record name chef correctly; every row created inside the profile names the managed user.
    The details blob carries only documentId and mime, so there is no actor anywhere in the row.
    Server side, ingest.ts writes auditLog("documents.inbound.store", { userId, … }) where userId is the
    record, not the guardian — which is right for ownership and wrong for attribution.

    2. There is no screen that shows those rows to anyone. The document actions exist only in the admin audit
    log, and the "Login overview" page pins filter=auth on every request (login-overview-section.tsx), so even
    picking documents.inbound.store from its action list returns zero — the server ANDs the two filters. The
    profile's own activity feed is deliberately not delegable. Net effect: the guardian cannot see the record of
    what they did, and the operator can only reach it through the API.

    3. A new document cannot be read by AI on this instance, and the switch cannot be turned on.
    Both the document list and the profile's AI settings say: "This server has no AI provider that could read
    Bernard's documents, so the switch stays off." That is true — and it is the one case a family self-hoster
    hits immediately: my only providers are my own (a local model through a LiteLLM gateway on the LAN, plus a
    cloud one), and a managed profile is served only by the instance-wide operator key
    (providerWorkAuthority: guardian → operator-default). A BYOK-only install therefore cannot use the
    feature the release note describes ("have a lab report read and confirm the values into the profile's labs").

    What I would ask for is the first of these; the second is only about honesty, not about a workaround:

    • Let the guardian attach a chain to the profile's capability, the way [Feature] Named provider chains, attachable per capability — one default for everyone, custom where it matters #1404 lets me attach one to my own.
      The profile already has its own consent switch ("switching it on records the profile's consent"), so the
      consent half exists; only the credential source is pinned to the operator.
    • If the operator-key design stays, say so as a limitation and stop there. I would not point people at the
      instance-wide key to "fix" it: that key is the last entry of every account's chain, so setting it is not
      enabling one profile, it is giving the whole instance a default provider that the other accounts never chose
      — the opposite of what a consent-based design is for. Naming it in the docs as "managed profiles are served
      by the instance key, nothing else" is enough; a self-hoster with only BYOK has to know the feature is out of
      reach until that changes.

    4. Storage is not visible anywhere, so "counts against the profile" cannot be checked.
    The "used X of Y" line only renders when the instance has a quota set and usage is at least 80%
    (upload-zone.tsx: quotaBytes > 0 && usedFraction >= 0.8). With no quota configured there is no number at
    all — on the profile or on my own account. I confirmed the ownership the other way round (the file is in the
    profile and nowhere in my own vault), but the paragraph promises a number a person can read.

    5. The preview sheet has no Save button and no saved indicator. Title, kind and date save on commit, which
    is fine once you know it — I edited three fields, closed the sheet assuming nothing had been written, and
    found it had. A "Saved" line, or a Save button, would remove the guess.

    6. On a phone the PDF preview never shows; downloading does work. Tapping a document opens the sheet,
    the metadata is there, but the preview area shows Chrome's "This content is blocked. Contact the site owner
    to fix the issue." Downloading from the same sheet works on the phone — Chrome warns about the insecure
    origin and the download completes after confirming. On the desktop, over the same plain-http address, the
    preview renders and the download also asks for a confirmation. So the only thing that genuinely does not
    work on the phone is the in-app preview; whether that is Chrome refusing to frame a PDF or the plain-http
    origin I cannot tell from here, because this instance is LAN-only with no HTTPS host to compare against.
    Noting it as a mobile observation, not filing it as a bug.

    7. Secondary, probably unrelated to this feature: upload from Google Drive fails on a phone. Every PDF I
    tried through the Drive picker ends in "Upload failed"; the same file saved locally on the phone uploads
    fine, and the same file from the desktop uploads fine. I am not filing it separately for now — mentioned in
    case it is the same mobile upload path you are already touching.

    Small notes

    • No progress bar for small files (a spinner is enough) — not a complaint, just so you know the phone path was
      genuinely exercised.
    • The profile's documents page loses the "upload your first document" empty state after the first upload, as
      it should.

    Disclosure: this report was put together with my own local AI assistant, which also read the code paths in
    tag v1.48.1. The setup, the uploads and the observations are mine.

  9. MBombeck commented on Nov 19, 2026

    @MBombeck
    Owner

    @ch3funio Thanks for testing with a real shelf. Going through your list:

    1. Who did it. The audit row does record you as the actor, but the admin audit log doesn't return that field, so only the profile shows up. I'll fix that in the next patch.
    2. A screen for these rows is a bigger thing; I'm noting it.
    3. AI on managed profiles uses only the instance key today, so on a BYOK-only install profiles have no AI. Attaching a chain per profile is a good idea for a later release; for now I'll document the limit.
    4. Storage use only shows near a quota; I'll look at showing it always.
    5. A saved indicator in the preview sheet goes into the next patch.
    6. The blocked PDF preview over plain http on a phone I still have to look into; I'll report back here.
    7. For the Google Drive picker: could you send the error ID it shows, or the time you tried it?
  10. MBombeck commented on Nov 20, 2026

    @MBombeck
    Owner

    @ch3funio In 1.48.3, out now (https://github.com/MBombeck/HealthLog/releases/tag/v1.48.3):

    1. The admin audit log names the account that acted ("by …"), so your uploads into the profile show you. While at it: picking an action in the audit log returned nothing because a hidden default filter stayed on; that's fixed too.
    2. The document sheet says "Saving…" and then "Changes saved".
    3. Storage use is always shown now, with the warning only near the quota.
    4. The docs say that managed profiles use only the server's AI key.
    5. The PDF preview: Chrome on Android has no built-in PDF viewer, so the frame turned into a download that Chrome blocks over plain http. Where the browser has no viewer, the sheet now offers the download directly.

    Still open from your list: a screen for these audit rows, AI chains per profile, and the Google Drive picker (the error ID would help).

  11. 1 remaining item

  12. ch3funio commented on Nov 20, 2026

    @ch3funio
    Author

    Unrelated, from the same log: one page load produced POST /api/internal/web-vitals 400. The route answers 400 only for an unparseable body or a schema miss (the schema is strict with a closed metric list), and the client sends exactly the six fields the schema names, so it is worth a glance but not an issue on its own. The reporter samples one page load in ten, so this is not every load.

  13. MBombeck commented on Nov 22, 2026

    @MBombeck
    Owner

    @ch3funio Thanks for retesting all of it, and for the storage numbers.

    The last open point from your list, AI for the profile, is on the branch for 1.49.0 and ships with that release. Under Settings, AI inside the profile, a guardian picks where the profile's AI comes from: the server's key as before, none, or one of the guardian's own provider chains. A lent chain serves only its own entries, and if the guardian loses the profile or deletes the chain, the profile gets nothing instead of falling back to the server key. The managed profile card in your own account also shows the profile's activity. Once 1.49.0 is merged, the :edge image has it too. I'll leave this open until it's out.

    Google Drive: thanks for the trace. One successful request and nothing for the failed attempt means the upload never left the phone, so the browser failed to read the file the Drive picker handed over before HealthLog saw it. I don't have a fix for that part yet.

    The web-vitals 400: worth the glance. Chrome reports a page it had discarded and loaded again with the navigation type restore, and the schema doesn't list that value, so the whole report is refused. Harmless, but a bug, and it goes into a fix on main.

  14. removed
    waiting-on-reporter
    on Nov 22, 2026
  15. MBombeck commented on Nov 23, 2026

    @MBombeck
    Owner

    @ch3funio 1.49.0 is out: https://github.com/MBombeck/HealthLog/releases/tag/v1.49.0

    As promised, the last open point is in. Under Settings, AI inside the profile you pick where the profile's AI comes from: the server's key, one of your own chains, or "No AI provider". The managed profile card in your own account shows the profile's activity, and the admin audit log now picks actions by family, so your uploads into the profile are one pick away under documents. You can also make the profile's emergency card, calendar feed and scheduled report from your account.

    When you have a moment on your instance, could you attach one of your chains to the profile and tell me whether a document read goes where you expect? Thank you again for the patient testing.

  16. added
    waiting-on-reporter
    on Nov 23, 2026
  17. ch3funio commented on Nov 25, 2026

    @ch3funio
    Author

    Attached the chain and ran a read, so here is the answer you asked for — the profile's AI does go where the guardian pointed it.

    What I set, and what happened

    • Switched into the managed profile, Settings → AI → "The profile's AI uses": picked the default chain, not one of the two named chains I keep — "lokalny-dok" (only the Ollama box on my LAN) and "chmura" (the cloud model, with the local one behind it). The honest paragraph under the picker says the important part exactly: "your own keys and sign-ins serve this profile, in the order of this chain and nothing else. What the profile sends counts towards your own provider accounts." That sentence is the whole point of the change.
    • The "Read new documents automatically with AI" switch on the same page is now usable — in 1.48.x it stayed off with "this server has no AI provider that could read … documents". I left it off and will upload as I go, so the manual read is what I exercised.
    • "Read with AI" on an existing document worked. The gateway in front of my local model logged every call under my own key, served by the Ollama box on my LAN, requests arriving from the HealthLog host. Nothing went through the server's key — the instance has none, which is the BYOK-only setup from my last comment. Guardian's chain, guardian's credentials, the profile's work. Thank you — this closes the gap I reported.

    What the read left me without

    The chain is fine; these are about a read being background work whose result is not where a person looks for it. With a slow local chain every step is long enough to notice, which is why I ran into them — I make no claim about how they feel on a fast one.

    1. Nothing on the document says a read is running. I started one, read "reading in the background, you can leave this page", left, came back — every button was active again as if nothing had happened, while the run had not finished. The card in the document list says nothing either. In the code the card's chip is !hasContentIndex && uploaded < 3 minutes, i.e. it answers "a fresh upload is not indexed yet", not "a read is running on this document". With the run record you already keep server-side (the one behind the failure card from [Feature] Named provider chains, attachable per capability — one default for everyone, custom where it matters #1404), the card could show "reading…" and the sheet could re-attach to a run in flight instead of offering the action again.

    2. The result has no address. After a few minutes the toast said "AI read your document" and nothing I could see was filled in — not the summary block, not the text panel. Where the read's output went is not something the UI tells me; the only place text does appear is the button that reads the document again, which is point 3. Whatever the read produced, say in the toast where it landed.

    3. "Show extracted text" reads the document again, and closing the sheet throws the answer away. Two clicks on the same document: 196 s and 90 s, two identical prompts 111 s apart, the panel blinking while it worked. Close the sheet and the text is gone — reopen and the button offers the read again. describe.ts is explicit that this is by design ("session-only … nothing here persists"), and AiRunPhaseNote even distinguishes "saved with the document" from "shown here". But the label promises stored text, and the request I closed the sheet on kept running on the model for another minute afterwards, GPU fan and all.

    4. Two summaries, one keeps and one forgets. In the summary block, "Wygeneruj podsumowanie" stores onto the document (persist: true), and a second open shows the paragraph. In the AI action row right below, "Podsumuj" calls the same route with the same prompt but without persist, which defaults to false — so the paragraph appears once and is dropped on close. Same wait, same model, two different fates, and nothing in the two labels tells them apart. I would keep one: let "Podsumuj" store like "Wygeneruj podsumowanie", or drop it. One small inconsistency while you are there: the route header says mode=summary persists onto the row since v1.30.31, while the client sends persist=true explicitly and defaults it off.

    A model-side note, because it explains "it read it but wrote nothing": the two lab-fact reads filled the model's 8192-token context exactly — 4071 + 4121 and 4042 + 4150 — so the JSON of extracted values was cut at the limit while finish_reason still said stop. Nothing the app can do about an 8 k window, but a read that hits it could say "the model's context ended before the list did" instead of leaving the review empty.

    None of this is about the chain. It is that a "reading…" state, one summary action that keeps its result, and one line saying where the result landed would make a slow local chain usable for a guardian in exactly the setup this issue was about.

  18. MBombeck commented on Nov 26, 2026

    @MBombeck
    Owner

    @ch3funio Thank you for running a real chain on real paperwork and writing down exactly where it got in the way. A slow local chain shows things a fast one hides, and you caught all of them. Point by point:

    1. Nothing on the document says a read is running. That's true, and there is no "reading" state on the document yet. It needs the run record wired through to the card and the sheet, which is new behaviour, so it's planned for a minor release rather than a patch. Until then, a second click on the same document doesn't start a second read; it joins the one already running.
    2. The result has no address. The toast now says where the result went: once a read is done, search finds the document by its content (fix(documents): keep the summary from every summary action #1554).
    3. "Show extracted text" reading again. The text is session-only by design, so it's gone when the sheet closes, and closing the sheet doesn't stop the call on the model, which is the extra minute of GPU fan you heard. A cancel and stored extracted text are planned for a minor release.
    4. Two summaries. Both actions now store the summary on the document, so "Podsumuj" keeps its paragraph the way "Wygeneruj podsumowanie" does (fix(documents): keep the summary from every summary action #1554). The route comment now says what the code does.
    5. The lab read cut at 8k. A read that stops at the model's context limit is now recognised as cut even when the model reports stop. The rows before the cut are kept and the read is marked incomplete instead of coming back empty (fix(ocr): read a reply that ends inside its JSON as cut #1543).

    The fixes are on :edge now and ship in v1.49.1 on Saturday 28 November.

  19. MBombeck commented on Nov 26, 2026

    @MBombeck
    Owner

    @ch3funio Thank you for running a real read through the lent chain, and for checking the gateway log to make sure it went where you pointed it. Good to hear the chain holds. Your four points, plus the context note:

    1. No sign that a read is running. You're right. The chip on the card only means "uploaded in the last few minutes and not indexed yet", and the busy state in the sheet lives only in the open page. When you clicked again, HealthLog joined the read that was already running instead of starting a second one, so nothing was paid twice. Still, nothing on the card tells you that. Showing it needs a new field on the document, so it comes in a feature release.
    2. Where the result went. A read stores a searchable index of what the document says and stages any lab values for review. It doesn't write a visible summary, and the message after the read didn't say any of that. It does now: it says you can find the document by its content in search. (fix(documents): keep the summary from every summary action #1554)
    3. "Show extracted text". Not keeping that text is deliberate, but closing the sheet should stop the model, and today it doesn't. There is no way yet to cancel a read that is already running. That needs a new route and a way for the worker to stop mid-call, which is a feature-release change. I've got it on my list together with point 1.
    4. Two summaries. A real bug. "Summarise" in the action row called the same route as the summary section but without asking to keep the result, so its paragraph disappeared when you closed the sheet. Both buttons now keep the summary on the document, and the second one replaces the first. The comment in the route that claimed otherwise is fixed too. (fix(documents): keep the summary from every summary action #1554)
    5. The 8k context. Also a real bug, and your token counts made it easy to find. Only a reply that reported running out of length counted as cut off. Yours said "stop", so the cut-off JSON counted as unreadable, got a retry that stopped in the same place, and the review came back empty. A reply that ends inside its own JSON now counts as cut off whatever the model reports. The rows it finished are kept, the read is marked as stopped early, and it isn't retried for nothing. (fix(ocr): read a reply that ends inside its JSON as cut #1543)

    Points 2, 4 and 5 are on :edge now and ship in v1.49.1 on Saturday 28 November. Points 1 and 3 come with a feature release.

  20. MBombeck commented on Nov 28, 2026

    @MBombeck
    Owner

    @ch3funio 1.49.1 is out: https://github.com/MBombeck/HealthLog/releases/tag/v1.49.1

    From your chain test, it brings the parts that were fixes: a read that a model cut off keeps the values it already had and says it stopped early, a chain with no provider says so in Settings, AI, and the log lines carry the real duration. Refs #1403

  21. removed
    waiting-on-reporter
    on Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementroadmap

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions