Repository navigation
feat(dashboard): dashboard_save stages a composed page an agent builds - #18851
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS
Watch
Suggestions
[DESIGN-REVIEWED] 2877b4d Description read[DESCRIPTION-READ] 4b69d6cc7877b967a5f0bd57b1db3930d80241ebecf9c3c6e2e2d6c024fdf720 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The staged package is a write nothing can use: preview and apply both refuse it, and it overwrites any template page already staged. Not justified as shipped
What this change shipsInventory (6 items) — 3 justifiedIntent: let an agent submit a composed dashboard page and get it checked for errors; this is an ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 2877b4d Description read[DESCRIPTION-READ] 669322122fd71dad408042e4f7506d42ce8dea3824fc90178fafc5aaeaafeba3 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
d19dd67 to
b94193d
Compare
|
Disposition on the findings against GPT F1 (blocking, fenced) -- lone surrogate escapes as a 500. Real, and the fix is ordering rather than a wider Reproduced before fixing, and the reason it was missed is worth recording: the route test's store stand-in called the dashboard gate directly, so it answered 400 either way and the gap was invisible to it. GPT F2 (blocking, rule-held) -- no feature-map update. Fixed. The dynamic-dashboard row now carries the composed-package save, the artifact store's ownership of the package ( First Principles item 3 (CONCERNS) -- the briefing went past what the base RFC records. Taken, as its own subtraction suggested. Item 7's added text is now one clause -- " First Principles item 8 (CONCERNS) -- zero consumers. Taken. The Opus (advisory) -- the reply pointed at tools that cannot see the saved page. Real and fixed, because it is in text this PR adds. Local run on |
b94193d to
f26a329
Compare
|
Round 2 on Opus, and Design Review's first watch item -- the tool's two texts disagreed. Fixed, and the half-fix was mine: the previous push corrected Design Review's second watch item -- the person agrees to a save and sees nothing change. Taken by the clearance path the finding itself offers ("the reply and description tell the person nothing visible changes yet"), because the other one, gating the tool behind a renderer, is the scope question below. The description now says the Dashboard tab keeps drawing the template page and the person will see no change, and says to tell them that before they agree rather than after. The reply says it too. The frozen Goal line is the part of this I have deliberately not touched. Design Review is correct that "the Dashboard tab renders the layout the agent chose" describes an outcome this PR does not reach on its own, and the template's first three sections are frozen to agents. A maintainer who wants that line narrowed to "stores the layout the agent chose" should say so and I will make exactly that edit. First Principles item 1 -- hold the grant until a reader lands. Not actioned, and not rebutted either: it is a scope decision above my authority. The brief I am working to specifies the grant and the registration pin in this commit, which is also what Its factual claim checks out: outside this route there is no reader of a Local run on |
f26a329 to
4b8c443
Compare
014b357 to
5c8b966
Compare
|
The blocking finding — the staged-package write using a by-name path ( The staging write now goes through the pinned-descriptor helper The branch was rebased onto current |
|
Re: GPT 6.1 F1 — duplicate dashboard binding when The write path already refuses to create a second binding when absence cannot be established, which is the guard the finding asks for.
So the exact sequence in the finding — a malformed Tests covering this (red if the resolver returned
|
|
Re: First Principles Review — head is now Both "not justified" items turn on the same premise — that Item 3 — Item 4 — the effect that after an apply The shipped surface is unchanged — this is a documentation/premise amendment plus the stacked-PR link, not a code change to the apply path. The code reply to the GPT finding is above and the head carries the pinned-descriptor write fix from the prior round. |
|
Re: GPT 6.1 F1 — keep staging-claim failures inside the apply error boundary ( Correct and fixed. Fix: an Regression test: |
|
Re: your re-review — taken your option 1 (the fail-safe one). New head Blocker 1 — applying a package freezes the crewmate's dashboard with no way back. Blocker 2 — the person is asked to approve a page the preview cannot show. Taken together this is your "I would not offer preview-then-apply for packages until something can draw them": on this base neither preview nor apply binds or draws a package; both wait for #19335. Non-blocking follow-ups — thank you, these are real:
The grant stays unconditional, which is now safe: the tool only saves and stages, and the one escalation (apply binding a package) is refused for every crewmate until #19335. |
|
Re: the review findings — new head The apply-refuses-a-package design (buluoray's option 1) is unchanged; this head only removes the leftovers that design made dead and corrects the text that still described the old commit-on-apply path. First Principles — both blockers.
GPT 6.1 — Comment History Gate. Reworded the five added comment/docstring lines that carried an issue number or a date to present tense; the issue reference now lives only in the PR description, not in code comments. buluoray. Both blockers from your review stay addressed on this head: applying a package is refused ( |
|
Re: First Principles and Design — new head Both reviews read the diff correctly: on this base a composed First Principles — "stages bytes nothing reads / defer Items 1–4 to #19335". This is a scope call between shipping the save with the renderer in one PR versus landing the validated save first and the renderer in a stacked follow-up. #19335 ("host an agent-written dashboard page") is that renderer; it is stacked on this PR and parked until it merges, and it is what lifts both refusals and makes apply the package's one writer. The save is the write half of a two-PR split, not a verb meant to stand alone — splitting the write path from the renderer keeps each PR reviewable, and the write path is independently exercised (validation, binding-from-caller, the credential-name refusal) and tested here. The symptom-level Framing contradicted by the diff. Fixed on this head: the PR title and body are rewritten to describe exactly what the code does — a validated STAGING save, with preview and apply refusing Design — "narrow it to validate-only, or land with #19335". The code already is validate-and-stage-only: the save runs the store's The staged-scope decision is a reviewer's to make; the implementation and its text now match it exactly on this head. |
buluoray
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES at head d170224efd
MERGE-ORDER: none. This PR is self-contained on main and does not depend on #19335. #19335 is based on main, does not contain this head, and does not touch package_display_pending. Whichever lands second must resolve conflicts in docs/feature-map/README.md, test/test_dashboard_server_composition_contract.py and test/test_member_dashboard_routes.py, and must keep the apply/preview refusals described below. Lifting the refusal is a third change that neither PR contains. The PR description's statement that #19335 is "stacked on this PR" and "lifts this refusal" does not match GitHub; please correct it.
What it fixes
A crewmate can now stage a composed dashboard package (model, view and theme) through dashboard_save. Before this, it had no verb that could stage one.
What I verified
- Blocker 1 (apply freezes the page): fixed.
_apply_staged_package(agent_panel.py:2467-2519) answers 409package_display_pendingand binds nothing.api_dashboard_applychecks it first (:2545). Because nothing is bound, thefrom_packageguard ondashboard_write(:1917) never trips. Mutation: making the function returnNonereddenstest_the_apply_of_a_package_is_refused_until_a_renderer_lands,test_a_refused_package_apply_leaves_template_writes_working,test_a_second_apply_…andtest_a_staged_page_bound_elsewhere_…. - iamwhatever's dismissed points are all met. The PR targets main,
_package_names_unsafeis gone,resolve_bound_slugis no longer called, and no agent-facing string says "draws this page now". - 293 tests pass across the five touched backend test files. CI: 89 pass, 14 skipped.
Blocking
Blocker 2 is only half fixed. The person is still sent to a link that shows an error. The preview read now answers 409 for a staged package (member_dashboard.py:298-309). But the save still tells the agent to show that link:
nextsays "show this preview_url to the person, ask whether to keep it, and call dashboard_apply … once they say yes" (agent_panel.py:2193).- The tool description says "Show that link to the person so they can see what you composed" (
mcp_panel.py:233). _render_stagedsays the link "answers the declarations" (mcp_panel.py:680), which is false.
The frontend turns that 409 into "This dashboard could not be loaded." with a Retry button (CrewDynamicDashboard.tsx:474-485), and its retry predicate (:208) keeps retrying the 409.
Fix: either drop preview_url from the save reply, or have next, _render_staged and the description say plainly that the link and apply are refused on this build and the agent should describe the page instead. Then add a test asserting the 409 on ?preview=1 for a staged package. Removing that refusal leaves all 70 tests green.
Non-blocking follow-ups
- Stale prose: the
api_dashboard_applydocstring says a package "is committed" (agent_panel.py:2531). The route comment says the save "MINTS AN ARTIFACT" (:2634). The tool description opens with "stores all three at once" (mcp_panel.py:214). TheTestTheStagedComposedPagedocstring says the preview "reads back the declarations" (test_member_dashboard_routes.py:1010). - The requested regression test asserts
read_package_model().from_packagerather than callingdashboard_write. That is acceptable because it is the value the guard reads. - Earlier follow-ups (crew-less slug,
BindingLookupIncompletecode, lock wording) were not re-checked.
Not verified
|
Re: GPT 6.1 F1 -- the package precheck bypassed the apply's store-error boundary. Fixed on head The finding is real and I walked it rather than taking the pre-drafted override. "Hard to reach" is not why I would skip it. The adjudicator marked this FLAG on reachability -- a link has to be planted at the session dashboard directory, which only an agent's own sandbox writes -- and that is a statement about how often, not about whether the hole is there. A documented-residual or extreme-combination verdict is a note that somebody knew, not a licence to ship it, so the fix went in. The fix. The precheck moved INSIDE the existing boundary rather than getting a boundary of its own, so the two halves of the route cannot drift apart again: try:
packaged = await _apply_staged_package(request, slug, crew_name, slot)
if packaged is not None:
return packaged
record = await asyncio.to_thread(_apply)
except Exception as exc:
return _instance_refusal(exc)The same class at my other new call site. Tests, both mutation-verified.
Each test's docstring names the one-line change that breaks it, so the proof is reproducible rather than asserted. Suites run on this head: 26 save-tool, 47 member-dashboard-routes, 133 agent-panel-routes, plus the dashboard, session, structure-lock, operator-pages, panel-fold, context-composition, agent-refactor, server-composition, mcp-panel-registration and windows-read-retry suites. black, isort, flake8 and mypy clean on the touched files. |
iamwhatever
left a comment
There was a problem hiding this comment.
This PR adds a dashboard_save MCP tool and route that validates and stages a composed dashboard package, while preview and dashboard_apply of a staged package answer package_display_pending and bind nothing. buluoray's blocker 2 at d170224 is met on d8efc89: the save reply carries no preview_url, and the next text, tool text and the new 409 test all say to describe the page in words. One real defect remains. For a root session, _resolve_dashboard_caller returns the slug session: (instance.session_instance_key), so _page_binding (agent_panel.py:2053-2063) builds crewmate:session:. _BOUND_TO_RE (artifact_store/dashboard_package.py:75) rejects that, so every root-session save fails with 400 invalid_package and the agent cannot fix it because it may not send bound_to. Fix: return the slug unchanged when crew_name is empty (it already reads session:), and add a root-session save test. Also fix the api_dashboard_save docstring (agent_panel.py:2070), which still says the body "hands back the link a person opens" and that apply installs it. Other blockers: the branch has a merge conflict with main (mergeable=dirty), and the current-head Design and First Principles CONCERNS have no ai-review-disposition reply. Those are the shared staging file displacing a template preview, the prompt teaching an ask-first step for an invisible save, and the subtraction of the staging write. Please rebase and post a target=design and a target=first-principles disposition for each item. — crew-pr-reviewer (deep re-check)
|
Disposition for the Design Review CONCERNS, carried forward from Correcting the claim both of these were read against. The PR description said #19335 was "stacked on this PR" and would "lift this refusal". That was wrong and it is gone. #19335 merged independently into main ( That merge also changed what is true about drawing, so the prose this verdict quoted has been rewritten rather than defended. Main now DOES draw a bound composed package --
Watch 1 -- a save stops the template flow. Real, and kept deliberately; the "clears when" alternative is the one thing this PR must not do. Taking a second staging file is what makes two pages offered at once, and "keep this one" then names neither -- the shared file is the mechanism that makes The consequence is also smaller than the verdict reads. A template apply is refused only while a package sits in the file, and the refusal is a plain read that discards nothing -- Watch 2 -- the prompt teaches an ask-first step for something a person cannot see. The contradiction was real and the ask-first step is what went, not the save. The member prompt and the tool text no longer tell an agent to ask before saving a composed page: a save changes nothing a reader can see, so there is nothing to ask permission for. What they now say is to DESCRIBE a staged page in words -- its fields and its blocks -- and that there is no link and no apply on this build. The ask-first instruction stays where it is still true, on the template Suggestion -- the Tests on this head: 27 in |
|
Disposition for the First Principles CONCERNS, carried forward from The premise the verdict rests on has changed, and I am not arguing against it -- I am reporting that main moved. The verdict's own words were that the renderer is "in no open PR". It is now in MAIN: #19335 merged as Item 2 -- oversized, subtract the staging write. Not subtracted, and the count the verdict used is why. The subtraction was reasoned from
Those are two different missing pieces, and the second is a write guard rather than a renderer. #19335 landed the reader and did not lift that guard -- it touched no line of What the staging write buys that returning a verdict does not. The suggested subtraction -- return
Clears-when, answered against the second clause rather than the first: the verdict offered "or this base has a counted consumer that reads a staged package instead of refusing it." It does not, and I have not invented one. What I can report is that the consumer the staging write was composing toward is no longer hypothetical -- it is on main, reading bound packages today, and the remaining gap is one guard in one file. Item 10 -- a forged Item 9 -- the surrogate 400, rides along. Agreed as characterised, and it stays: Also on this head, from Joe's review: a root session could not save at all. |
|
Disposition for the Design Review CONCERNS at head Correcting the claim both of these were read against. The PR description said #19335 was "stacked on this PR" and would "lift this refusal". That was wrong and it is gone. #19335 merged into main independently as That merge also changed what is true about drawing, so the prose this verdict quoted has been rewritten rather than defended. Main now DOES draw a bound composed package --
Watch 1 -- a save stops the template flow. Real, and kept deliberately; the "clears when" alternative is the one thing this PR must not do. Taking a second staging file is what makes two pages offered at once, and "keep this one" then names neither -- the shared file is the mechanism that makes The consequence is also smaller than the verdict reads. A template apply is refused only while a package sits in the file, and the refusal is a plain read that discards nothing -- Watch 2 -- the prompt teaches an ask-first step for something a person cannot see. The contradiction was real and the ask-first step is what went, not the save. The member prompt and the tool text no longer tell an agent to ask before saving a composed page: a save changes nothing a reader can see, so there is nothing to ask permission for. What they now say is to DESCRIBE a staged page in words -- its fields and its blocks -- and that there is no link and no apply on this build. The ask-first instruction stays where it is still true, on the template Suggestion -- the Tests on this head: 27 in |
|
Disposition for the First Principles CONCERNS at head The premise the verdict rests on has changed, and I am not arguing against it -- I am reporting that main moved. The verdict's own words were that the renderer is "in no open PR". It is now in MAIN: #19335 merged as Item 2 -- oversized, subtract the staging write. Not subtracted, and the count the verdict used is why. The subtraction was reasoned from
Those are two different missing pieces, and the second is a write guard rather than a renderer. The hosted page landed and that guard was not lifted with it -- #19335 touched no line of What the staging write buys that returning a verdict does not. The suggested subtraction -- return
Clears-when, answered against the second clause rather than the first: the verdict offered "or this base has a counted consumer that reads a staged package instead of refusing it." It does not, and I have not invented one. What I can report is that the consumer the staging write was composing toward is no longer hypothetical -- it is on main, reading bound packages today, and the remaining gap is one guard in one file. Item 10 -- a forged Item 9 -- the surrogate 400, rides along. Agreed as characterised, and it stays: Also on this head, from Joe's review: a root session could not save at all. |
|
Disposition for the Design CONCERNS at head Watch 2 -- the description was cut off before Watch 1 -- saving destroys a template preview that still works. The chain is right, and I am not going to argue it away. I defended the shared staging file on the previous head with "one question at a time", and the rebuttal is correct: that argument assumes both kinds of staged page can be applied, and on this build the package cannot. So the trade is not symmetrical. Walking the chain against the code:
That is a real loss of someone's pending content, not a scope preference, and it is the one class I should not ship on my own judgement. It is also not mine to decide, because the fix the verdict names -- validate-and-return-counts with no write, or a second staging file -- changes the shape a human reviewer already chose. buluoray's review settled this PR on "keep save and stage, refuse the apply", and the maintainer ruled it lands at that scope. An AI lane asking to delete the staging write reverses both, so it goes to the maintainer rather than into a quiet rewrite by me. What I can say precisely, so the decision does not need re-derivation:
Either clears this Watch. I have not picked one. Suggestion -- the staged bytes have no reader on this build, so a validating save gives the same agent-facing behaviour. Correct as stated, and it is Option B above. On the member prompt saying "nothing is stored" while a file is written. Fair, and the wording is now narrower everywhere an agent reads it: nothing is STORED means no |
|
Disposition for the First Principles CONCERNS at head Item 3 -- undeclared: "Not a goal" said the template verbs "keep working exactly as they do today", while a save replaces a pending template preview. The contradiction was real and the claim is withdrawn. That bullet no longer says "exactly as they do today"; it says what is true, which is that Item 2 -- zero consumers. The measurement is right, and the conclusion is a scope decision I am not taking on my own. The count is accurate: I am also not deleting it, for a reason that is about who decides rather than about the merits. buluoray's review settled this PR on "keep save and stage, refuse the apply", and the maintainer ruled it lands at that scope. The subtraction named here reverses both. A review lane and a named human reviewer disagreeing about deleting code is the case where the human's call stands until the human changes it, so this goes up rather than into a quiet rewrite by me. To make that decision cheap, both exits priced from the code:
Item 8 -- the surrogate 400 rides along, and the save path already refuses surrogates via Item 9 -- the forged |
A crewmate could declare a dashboard's Model, View and theme and had nowhere to put them: the panel server held no save verb, so the prompts that tell an agent to save a page named a call that did not exist, and the reader on the base branch had no writer to serve. dashboard_save takes those three declarations and stores them as an artifact of kind="dashboard" bound to the calling crewmate. The binding is derived from the caller the gateway vetted and is never read from the body, so a caller that sends bound_to or kind is refused rather than corrected. Identity reuses dashboard_write's own gate -- strict session resolution on the tool side, _resolve_dashboard_caller on the route side -- and the lookup reuses the read path's resolve_bound_slug, so the write and the read cannot disagree about which artifact is a crewmate's. One crewmate keeps one package. A lookup that cannot prove whether a package exists refuses the save, and a per-binding lock spans the lookup and the write, because the store locks writes individually and two overlapping first saves would otherwise both read absent and both create. Everything the save does on a thread stays there: the store is built inside the worker, and the history session is resolved on the update branch that needs it rather than on the gateway loop, where its succession-chain walk reads the crew log. Validation stays the store's, for every caller rather than this one. That needed a fix one level down: _validate_content measures content by encoding it, and content holding an unpaired surrogate cannot be encoded at all, so the line asking how big the content is also decides whether it can exist. It now refuses such content as an ArtifactValidationError, which gives create, update and settle_blank the refusal a caller can act on instead of a crash. No WebSocket frame is sent: nothing subscribes to the instance-changed frame, so the tab picks a save up on its own poll. Naming the verb in the grant tuple obliges naming it in the member briefing's item 7, which a test reads off that tuple; the prompt byte pins move with it, and the dynamic-dashboard feature-map row gains the write path, its endpoint and the one-package-per-crewmate rule.
dashboard_save stored the package, and the binding it writes IS what decides
whose dashboard a page is. So composing a page WAS installing it: durable state
changed on the agent's say-so, dashboard_write started refusing that crewmate's
fields with package_display_pending, and when the display learns to read
packages the page goes live retroactively without anyone having said yes. The
template path next to it has had the opposite shape all along --
dashboard_preview stages, dashboard_apply installs, and the prompt tells a
crewmate to show the link and ask first.
The save now stages. It runs the artifact store's own write gate,
canonical_package_content, and puts the resulting bytes in the staging file
beside the crewmate's record; the reply carries the ?preview=1 link, the field
and block counts, and the sentence saying what to do with them. A save
broadcasts nothing, because nothing a reader can see has moved.
Checking at STAGING rather than at apply is stage_preview's own reason: a
layout that could never be stored is the agent's to fix while it is still
composing, not something to discover after a person has said yes. Staging the
canonical bytes rather than the declarations is the other half -- the page shown
and the page committed are then one string across the two cycles.
ONE STAGING FILE for both kinds, so one page is offered at a time and "keep this
one" names something. Both readers answer None for the other's payload: a
package carries no html and no manifest, and staged_package_preview wants a
package_content key. The schema check and the expiry window they share move to
_preview_payload, so a stale preview is stale for both.
dashboard_apply is the only writer of the package artifact, and SELECTION,
COMMIT AND DISCARD ARE ONE CLAIM under the staging lock
(instance.claim_package_preview), with the store's per-binding lock nested
inside it. Two locks because they answer two questions and dropping either loses
something: the staging lock makes the page committed the page that was staged,
the per-binding lock makes one crewmate keep one artifact. Reading the staged
page outside the staging lock would be a data loss rather than a stale read -- a
save landing during the artifact write stages a second page, and a discard that
followed the commit would delete THAT page, unstored, with the agent already
told its compose had succeeded. A refusal raised out of the claim leaves the
staged page ALONE, which is what a failed commit needs: the page is still the one
the person approved and the retry has something to commit. The lock is pinned by
a non-blocking probe on the lock file from inside store.create, so no timing
decides the pass.
EVERY NAME A PACKAGE DECLARES IS A JOIN KEY, and the theme tokens are the set
whose grammar hides that. A field name and a block id match
[a-z][a-z0-9_]{0,63}, which no real token survives; a theme token is a CSS
custom property, --[a-z][a-z0-9-]{0,63}, and a lowercase hyphenated look-alike
satisfies it. _credential_shaped_names now scans all three, because the page's
own style references the variable by name -- a redactor rewriting it hands back a
stylesheet pointing at a property that does not exist, so there is no masked form
that still works and refusal is the only answer. The refusal reports a POSITION,
never the name, as the sibling refusals do.
The ?preview=1 read answers a staged package through the same owner-gated route.
It answers the DECLARATIONS rather than a drawn page, which is this base's limit
and not a choice: nothing here renders a package into a document yet, so a body
promising rendered_html would promise a key it cannot fill. instance_version
stays 0 because staging wrote no version.
Its prose goes through the redactor and its KEYS are kept verbatim, which is one
decision rather than two: a declaration is a name, not a value, so redacting it
hides nothing and breaks the document -- the reference stays while the key moves.
_page_safe, the redactor for resolved values, is wrong here for that reason and
for a sharper one: it drops worker_session_key at any depth, so a model field an
agent may legitimately declare under that name would vanish while the block
reading it kept the reference. What keeps a credential out of a key is the save
refusing one, which is the single mechanism and sits where a name can still be
changed; a staged page expires after MAX_PREVIEW_AGE_MS, so no long-lived file
predates that refusal.
A staged package whose bound_to is not the caller's is refused -- at the apply
and on the read -- rather than re-stamped. Re-stamping would change the page
after it was approved, and the binding is the authorization decision.
package_display_pending survives and moves with the write: it is an APPLIED page
whose fields cannot be written yet, so a page left staged refuses nothing. The
save tool's description, its reply and the member briefing's item 7 say staged
rather than stored, the apply tool names both kinds of staged page, and the
prompt byte pins move with them.
Rebased onto the amended base, which moved two things under this branch. The
system spec's save paragraph said the save stores and holds the per-binding lock
across the write; it now describes the staging gate, the apply as the only
writer, and the two locks. And the base dropped the binding lookup's
unreadable_record_count consultation on purpose -- a record the listing never
showed no longer raises BindingLookupIncomplete, because one corrupt file must
not take a library down -- so the test pinning that refusal goes with it, along
with the stub members it was the only caller of.
The apply's frame goes through _broadcast_changed, which the base's rebase onto
main introduced beside it: a crewmate's page is named by its SLUG, and a caller
bound to no crew is named by its SLOT on an owner-only socket. Broadcasting the
slug directly would have sent a root session's change under an empty slug.
The declared-name refusal is asked at BOTH ends, and the predicate moved to the
read's module so there is one of it. A staged page is an ordinary file under
members/<slug>/dashboard/, so the save route is not its only writer: a read that
trusted the save's refusal would be guarding nothing against a file written
directly, which a prompt-injected agent can produce. The read now refuses WHOLE
on it, as the live package read does, because a join key has no masked form that
still works. package_declared_name_spots lives in member_dashboard because that
is the side that cannot delegate, and agent_panel imports it inside the function
the way it already imports read_fields -- member_dashboard imports nothing from
agent_panel, so the pair stays acyclic.
That empties agent_panel's own redactor use, so the NON_EGRESS_REDACTION_MODULES
entry added for it goes too: it named a call that is no longer there, and the
posture allowlist refuses a stale entry. member_dashboard is already a
registered redaction surface.
The staged bytes go through the package's own validator rather than a shape
check of mine. A name scan covers the name sets it knows about; it cannot cover
a key nobody declared, so a credential-shaped key sitting beside a field's own
`type` reached the response, and a `model` with no `types` reached a KeyError and
a 500. PackagePreview.package() now returns parse_package's canonical form or
None, which answers both in one place and for every reader of the preview.
The per-binding lock is gone. It only ever ran inside claim_package_preview's
exclusive lock on instance_dir(slug), and `crewmate:<slug>` names the same
crewmate that directory does -- so it was the same key twice, not two guarantees.
|
Disposition for the Design CONCERNS at head Watch 2 -- the description was cut off before Watch 1 -- saving destroys a template preview that still works. The chain is right, and I am not going to argue it away. I defended the shared staging file on the previous head with "one question at a time", and the rebuttal is correct: that argument assumes both kinds of staged page can be applied, and on this build the package cannot. So the trade is not symmetrical. Walking the chain against the code:
That is a real loss of someone's pending content, not a scope preference, and it is the one class I should not ship on my own judgement. It is also not mine to decide, because the fix the verdict names -- validate-and-return-counts with no write, or a second staging file -- changes the shape a human reviewer already chose. buluoray's review settled this PR on "keep save and stage, refuse the apply", and the maintainer ruled it lands at that scope. An AI lane asking to delete the staging write reverses both, so it goes to the maintainer rather than into a quiet rewrite by me. What I can say precisely, so the decision does not need re-derivation:
Either clears this Watch. I have not picked one. Suggestion -- the staged bytes have no reader on this build, so a validating save gives the same agent-facing behaviour. Correct as stated, and it is Option B above. On the member prompt saying "nothing is stored" while a file is written. Fair, and the wording is now narrower everywhere an agent reads it: nothing is STORED means no |
|
Disposition for the First Principles CONCERNS at head Item 3 -- undeclared: "Not a goal" said the template verbs "keep working exactly as they do today", while a save replaces a pending template preview. The contradiction was real and the claim is withdrawn. That bullet no longer says "exactly as they do today"; it says what is true, which is that Item 2 -- zero consumers. The measurement is right, and the conclusion is a scope decision I am not taking on my own. The count is accurate: I am also not deleting it, for a reason that is about who decides rather than about the merits. buluoray's review settled this PR on "keep save and stage, refuse the apply", and the maintainer ruled it lands at that scope. The subtraction named here reverses both. A review lane and a named human reviewer disagreeing about deleting code is the case where the human's call stands until the human changes it, so this goes up rather than into a quiet rewrite by me. To make that decision cheap, both exits priced from the code:
Item 8 -- the surrogate 400 rides along, and the save path already refuses surrogates via Item 9 -- the forged |
Problem / Motivation
Goal: a crewmate, or a root session, that has composed a dashboard page can STAGE it -- a validated save. Staging is as far as a composed page gets here: the
?preview=1read anddashboard_applyboth answerpackage_display_pendingand bind nothing, so the page a caller already has never freezes. The save reply carries NO link, and the agent-facing text tells an agent to describe the page in words.Merge order: none. This PR is self-contained on main. #19335 ("host an agent-written dashboard page") is NOT stacked on it and never was -- it merged into main independently as
41e2929a2c, and this branch is rebased on top of that.The two refusals share a code and have different reasons. The reader is not what is missing:
member_dashboardresolves the caller's binding and_serve_packagereturnsrendered_html, so main draws a page that is in force. The?preview=1read refuses because a STAGED page is neither an artifact nor a binding -- the hosted page draws a bound artifact, and_preview_recordgoes throughstaged_preview, which answersNonefor a package payload.dashboard_applyrefuses because binding one leavesdashboard_writerefusing every agentic field that caller has (agent_panel.py'spackage.from_packageguard, still live, with no agent verb that unbinds it); #19335 touched no line of that file, so the loss is unchanged. Lifting them is a THIRD change, in no open PR: it lifts the write guard and this apply together, and makes the apply the package's one writer.The dynamic dashboard's design (the approved one-pager for #18642) replaces template picking with composition: an agent declares a Model (which fields the page holds and where each value comes from), a View (the blocks that draw them) and a theme. #18705 built the
kind="dashboard"artifact and its validated write path, and nothing could reach it: the panel server's verbs read and fill a TEMPLATE page's fields or hand an agent a page from a fixed catalog, and none of them stages a composed one. The prompt work on #18758 names "the call that saves a page", which did not exist.Why it matters
Without a save verb the composition design cannot be exercised end to end even for staging, and the prompt and skill work that teaches composition cannot land, because it would teach a verb the product does not have.
Not a goal
from_packagewrite guard, and a reader for a page staged rather than in force.dashboard_write's), no migration of the built-in templates, and no change to which page a caller with no saved package sees.dashboard_applyadditionally RECOGNISES a staged composed package and refuses it, committing nothing._preview_payloadmakes a forged non-numericstaged_msread as stale for both preview readers instead of raising.What changed (motivation -> approach -> change)
The goal is a save that cannot be pointed at somebody else's page and cannot stage a package nothing checked. Two decisions follow, each about which code owns which question.
The binding is the gateway's, never the caller's. A dashboard artifact's
bound_todecides whose tab renders it, so it is an authorization decision rather than a field. The route derives it from the slug the shared panel gate resolved. The tool takesmodel,viewandthemeand nothing else; a caller that sendsbound_toorkindis refused rather than quietly corrected, because an agent told its save succeeded while the page went elsewhere would send the same thing again every cycle.That binding has TWO scopes, because the grammar has two.
_BOUND_TO_REacceptscrewmate:<slug>orsession:<slot key>, and a ROOT SESSION's slug is already the second form --instance.session_instance_keyspells itsession:<digest>. So_page_bindingreturns a session slug unchanged and prefixes only a member slug. Prefixing both builtcrewmate:session:<digest>, which the grammar refuses, and every root-session save answered 400invalid_packagewith no way out: the schema refuses a caller-sentbound_to, so the one key that would have corrected it is the one key an agent may not send. Found by Joe's review atd8efc89e3d.Validation is the store's, at STAGING, for every caller rather than for this one. The package runs
canonical_package_contentfrom #18705 -- closed catalogs, the 256 KiB cap on the bytes actually written, the lone-surrogate scan, the decoder-depth refusal, and the rule that a dashboard owns its content and can never point at a file. A layout that could never be stored is refused while the agent is still composing, and the refusal names the key path and the values that would have been accepted.Making that honest needed a fix one level down.
_validate_contentis the first call in bothcreateandupdateand it measures content by encoding it -- but content holding an unpaired surrogate cannot be encoded at all, so the line asking how big the content is also decides whether it can exist. It raisedUnicodeEncodeError, not anArtifactValidationError, so a caller that answers a bad artifact with 400 answered that one with 500. It now refuses where the promise is made, fixingcreate,updateandsettle_blankfor every kind at once. This is the only tightening in the PR.What that produced:
dashboard_saveonkirocrew-panelwith its schema invalidation.py;POST /api/agent-panel/dashboard/saveon the same strict-internal prefix as its siblings; the caller rules reused rather than rewritten (require_strict_session_keyon the tool side, because a subagent resolves to its parent's slot under the lenient/procwalk, and_resolve_dashboard_calleron the route side); and the grant plus the registration pin in one commit, because the mount test asserts the two sets are equal.The response carries only what its reader reads -- the field and block counts, and NO link. A
preview_urlwas in this reply until the human review showed where it leads: the package read answers 409, andCrewDynamicDashboardturns that into "This dashboard could not be loaded." with a Retry button whose predicate retries the 409. A link whose only outcome is an error card is worse than none, soPackagePreview.wiredrops the key and every agent-facing string says the page cannot be shown or applied here and is to be described in words. The artifact slug and the binding are absent for a different reason: an agent addresses its page by its own identity and cannot choose its binding.One staging file, shared with the template preview, so one page is offered at a time -- which is what lets
dashboard_applytake no arguments and still install the page that was described. Staging a template overwrites it, and a staged page older thanMAX_PREVIEW_AGE_MShas to be saved again. No WebSocket frame is sent: nothing subscribes todashboard_instance_changedand no artifact is written here.Backwards compatibility
Compatible: every existing name, route, tool and validator keeps its behaviour. The diff adds one MCP tool, one route and one argument schema, adds an entry to a grant tuple, and makes one validator refuse content it could never store. On the member read route and
dashboard_apply, a staged composed package now answerspackage_display_pendingwhere no composed package could be staged before, so no existing caller's behaviour changes; the template preview and apply paths are untouched.That validator change is the only tightening, and it rejects nothing any writer can produce today.
_validate_contentnow answers content holding an unpaired surrogate withArtifactValidationError; before, the same content raisedUnicodeEncodeErrorfrom the same line. No caller could store it either way, so no stored artifact becomes unreachable and no accepted write becomes refused -- a crash becomes a refusal. Writer sweep on the base for the three entry points that call it (create,update,settle_blank): every one already propagatesArtifactValidationErrorto a 400, and none caughtUnicodeEncodeError.Removes nothing: no path is hidden, no record or row is deleted, no data is migrated or pruned, and no key or public function is removed or renamed. The test tables whose digests move are pins on values this diff deliberately changes, not capabilities.
Tests
test/test_dashboard_save_tool.py, written before the implementation and run red first.test_a_save_stages_the_page_and_stores_nothingassertspreview_urlis absent from both thestagedbody and thenextsentence. Putting the key back inPackagePreview.wirereddens it, verified by mutation.test_a_root_session_save_stages_under_its_own_bindingresolves a caller with an empty crew name and asession:<digest>slug, asserts the save stages under that slug as its ownbound_to, and asserts the grammar's verdict on both forms so it fails for the reason it names. Written before the fix and run red: it reproduced400 invalid_packagewith'crewmate:session:<digest>' is not a binding.test_the_preview_read_of_a_staged_package_is_refused(intest/test_member_dashboard_routes.py) asserts 409package_display_pendingon?preview=1and that the staged page survives the read. Disabling the branch reddens it with 404no_preview, verified by mutation.test_the_apply_of_a_package_is_refused_until_a_renderer_landsasserts the 409, that nothing is written (store.records/store.updatesempty) and that the staged page is left in place;test_a_refused_package_apply_leaves_template_writes_workingapplies a package and assertsread_package_modelstill answersfrom_package=False, i.e. the live page is NOT frozen and templatedashboard_writekeeps working;test_a_second_apply_of_a_staged_package_is_refused_the_same_wayshows the refusal is a plain read that does not consume the staged page;test_a_staged_page_bound_elsewhere_is_also_refused_at_the_applyshows a mismatched staged file installs nothing;test_an_apply_with_nothing_staged_writes_nothingkeeps the template path unchanged.test_a_store_fault_in_the_package_precheck_answers_like_every_othermakesstaged_package_previewraiseInstanceErrorand asserts 503store_failed, andtest_a_store_fault_in_the_package_read_answers_like_every_otherasserts the read route's own 500dashboard_failed. Moving either call outside its boundary reddens with a raw 500, verified by mutation.test_artifact_update_refuses_a_surrogate_the_same_waydrivesArtifactStore.updateand.createdirectly under the record's own content token and assertsArtifactValidationErrorfrom both, with a control that the same bytes without the surrogate are still accepted.test_a_lone_surrogate_never_reaches_the_real_store_eitherdrives the real store through the route.test_a_credential_shaped_*plustest_an_ordinary_field_name_still_saves/test_an_ordinary_theme_token_still_stages).test_the_real_store_round_trips_a_valid_packagestages and reads back through a realArtifactStore.test_a_caller_with_no_dashboard_slot_is_refusedwrites nothing, andtest_the_tool_refuses_a_caller_whose_identity_is_not_strictasserts no request leaves the process by making the transport raise if it is reached.test_the_binding_comes_from_the_caller_and_the_body_cannot_carry_oneproves a body-suppliedbound_to/kindis refused.test_the_tool_*).test_the_member_grant_names_the_save_toolandtest_the_tool_has_a_registered_argument_schema.