Skip to content

feat(dashboard): validate dashboard_write against the current package Model - #18707

Merged
chenmingwei23 merged 2 commits into
mainfrom
feat/18642-dashboard-write-model
Oct 12, 2026
Merged

chenmingwei23 merged 2 commits into
mainfrom
feat/18642-dashboard-write-model

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A crewmate writing to its own dashboard is checked against the Model of the dashboard it actually has, and gets a refusal it can act on when there is none.

dashboard_write validated a crewmate's value against a builtin TEMPLATE manifest. A v3
page is not a template: it is an artifact of kind="dashboard" holding its own Model, so a
crewmate with a composed dashboard was checked against a template that does not describe
its page. The read behind that check also answered None both for "nothing is bound" and
for "a package is there and cannot be read", so a crewmate was told to create a dashboard it
already had.

Why it matters

The wrong Model is the wrong field set: a field the page declares is rejected, a field the
page lacks is accepted, and the mistake book groups lessons on (code, field), so a wrong
code teaches the wrong lesson. The two no-Model cases also need different remedies: empty
means "create one", which a crewmate does itself; a broken artifact needs a human.

Not a goal

  • Any fold change. The agentic fold keeps its name, stored shape and state_version,
    and the fold catalogue is not in this diff.
  • A forbidden state, or a slug argument on the reader.
  • Moving dashboard_fields onto the package Model; that divergence is named below.

What changed (motivation -> approach -> change)

src/kiro_crew/dashboard_package.py adds read_package_model(member) -> PackageRead:
model, state, state_reason (quoted into the refusal), and from_package.

state model refusal code why it is its own state
live, from a PACKAGE None -- (package_display_pending, below) the package's field table is not translated on this base
live, from the template set -- the write proceeds, as it does today
empty None no_instance nothing bound: the crewmate creates one
error None package_model_invalid present, broken: a human repairs it

A live PACKAGE therefore carries no Model: its one caller refuses a package-bound write
before a Model would be checked, so translating one would build a manifest and throw it
away. from_package is PROVENANCE and the flag the route's refusal turns on; the states
alone cannot separate the two live rows.

stale is absent: a package has no registry behind it to move past. no_instance keeps its
code, or a new one would strand every lesson a crewmate has learnt. Only a failed read
raises PackageReadError (503, package_unreadable): a refusal is recorded first, and an
exception would skip that and be a 500. It is keyed by the MEMBER, and the template instance
store stands behind this path for empty, since a crewmate on a builtin template has no
kind="dashboard" artifact.

resolve_bound_slug and MAX_BINDING_SCAN moved in to the base's own module, because
the binding half of the lookup has callers outside #18705. Two names, and the function keeps
its keyword-only store parameter.

None from it means absent as far as the LISTING goes. Three things leave even that
unproven, and each raises BindingLookupIncomplete rather than answering None:

unproven because the reader answers
the cap cut the scan short error
store.get failed on a record error
an envelope would not decode error

Each names a record the listing PROVED is kind="dashboard", so one of them may be the
package bound here and the reader fails closed: empty would fall through to a BUILTIN
page's Model, and a write checked against that can replace a cell with a value of the wrong
shape.

What None does not rule out is a record whose own meta.json will not read, and that
is deliberate. ArtifactStore.list drops such a record with a warning -- the right default,
since one corrupt file must not take a library down -- so it never reaches the scan, and its
kind is exactly what that file holds. It is therefore only POSSIBLY a dashboard, and as
likely a widget. Counting it and refusing would cost every member that has NO package at
all: one damaged widget anywhere in the store would turn each of its writes into
package_model_invalid, telling it to repair a package it does not have, and record that
lesson every cycle. A member whose page is drawn from a template is right to go on being
checked against it, so the lookup answers for the records it can see and the warning list
already emits is where that fact lives. A caller that must tell such a record apart needs
the store to report it, which belongs with the change that HAS such a caller.

A member key the crewmate grammar cannot spell falls through on the same rule, and that
population is a ROOT SESSION on today's main.
_resolve_dashboard_caller keys a root
session's write by instance.session_instance_key(slot.key), which is session:<digest>.
This reader spells a binding crewmate:<member> and _BOUND_TO_RE admits no inner colon,
so that key cannot be a crewmate binding at all. No package can be stored under a string
the grammar refuses, so nothing is present to be broken: empty and a logger.warning,
not error. Without it, every write a root session makes is refused as a broken package it
could never have had -- which the reviewers raised against #18105, and which the rebase
onto current main shows is live here already. The session's own instance is what its page
draws, and the instance store keys it by exactly this string. A member key in the
session: scope wants the LOOKUP to use that scope rather than prefix it, which belongs
with the change that gives a session a package.

The binding is matched off the stored ENVELOPE, so a layout the validator rejects is still
FOUND and reported broken by name -- parse_package splits into _decode_package (empty
check, surrogate scan, cap, decode) plus validate_package, one line over the two, so every
caller is unchanged.

One more source file, src/kiro_crew/artifact_store/records.py, for a PRE-EXISTING
defect this PR's new caller exposes.
decode_meta reads keys off the parsed record, so
a meta.json whose top level is not an object raises AttributeError, which
ArtifactStore.list does not tolerate -- one such file turns a whole listing into a crash
instead of one skipped record, which through this module is a 500 on a dashboard write with
no refusal recorded. Refused as an ArtifactError now, a class list already handles. The
crash predates this branch and reaches every list() caller, so it is fixed at the root.

Two smaller items in the diff, named so they are not read as riding along:

  • check_write asks the SHAPE again after redaction, not only the type
    (redacted_value_invalid, src/kiro_crew/dashboard_agentic.py). The stored value is the
    scrubbed one, and the scrub rewrites strings -- so a declared choice that is itself
    credential-shaped passes the type check, because a placeholder is a perfectly good
    string, and then lands in the cell as a value the page's own Model says cannot be
    there. An enum member, a required key under a scrubbed name and an item in a typed array
    are all in that position. The type and size re-checks beside it were already there; this
    is the shape half.
  • A comment on SOURCES in src/kiro_crew/dashboard_templates/manifest.py records that a
    synthesized package manifest needs a fourth value, since it has no template directory and
    carries no page. Comment only, no value added here; it sits where the next reader of that
    set will look.

Backwards compatibility

No fold name, version, stored shape, entry type, response key or manifest key changes;
DASHBOARD_FOLD_NAME still reads "agentic". Removes nothing: decode_meta refuses a
shape that crashed it rather than accepting less.

Two behaviour changes, both deliberate:

  • A crewmate that already has a kind="dashboard" package goes from accepted writes to
    package_display_pending.
    The kind has been storable since feat(artifacts): a validated, versioned dashboard layout package #18705, so that population
    can exist. It is the intended trade: see the gate below.
  • A failed template read is an unrecorded 503 (package_unreadable) where it was a
    recorded no_instance.
    A read that failed says nothing about the write, so there is no
    lesson to record and no field to blame. One thing to flag rather than claim fixed: the
    503 body echoes the exception text, which on an OSError can carry an absolute path.
    That predates this diff on every PackageReadError path and is worth its own change.

resolve_bound_slug and MAX_BINDING_SCAN are RE-ADDED to their module, so their readers
are restored:

Reader: src/kiro_crew/dashboard_package.py:_from_package -- chat -- the new reader itself, which resolves a member's artifact through it; test_the_binding_resolves_the_slug_when_the_caller_has_none
Reader: src/kiro_crew/dashboard/handlers/agent_panel.py:api_dashboard_write -- chat -- the write route, which reads the package by member and maps each non-live state to a refusal; test_the_write_route_asks_for_a_package_by_member_and_not_by_slug

"package" is deliberately NOT in instance.RENDERABLE_SOURCES, pinned both ways by
test_a_package_source_is_not_renderable: that set decides whether a page may EXECUTE.

A package-bound write is REFUSED on this base, code package_display_pending:
api_member_dashboard renders the template instance and reads no package, so a value
checked against the package's Model could be one the page cannot draw -- a string where it
reads a list blanks the cards already there, with no error. Keyed on from_package, not on
the state, since this reader answers live for a template instance too. #18847 lifts it
where the display reads the same package.

Tests

TestThePackageSeam holds the cases the change is specified against, and each refusal
has a case checked by name -- including
test_a_live_package_is_refused_while_the_display_still_reads_the_template, which drives
the real route and was red as a 200 before the gate.

TestTheBindingLookup (real store, real validator) and TestTheRealGateAndStore (the
stand-in gate removed, so the real resolve_bound_slug answers) cover the three rows above
plus the non-object meta.json, which list now skips instead of crashing on. Each corrupt
record is damaged on disk after the store wrote it, and every case asserts its own premise
first, so a fixture that stopped being corrupt fails.

Four cases pin the line between answering and failing closed:

  • test_a_template_only_member_still_writes_beside_one_corrupt_unrelated_record -- the
    population a refusal here would cost: a member with no package, one damaged
    kind="widget" record, and the template's Model still answering.
  • test_a_record_of_unknown_kind_does_not_make_the_lookup_refuse -- the store layer, both
    directions: a record the listing hid does not make the lookup refuse, and an undecodable
    dashboard envelope still does.
  • test_a_member_key_outside_the_crewmate_scope_falls_through_too -- a root session's real
    key, built by session_instance_key rather than written by hand, since the instance
    store refuses a digest of any other shape. It needs the real gate: the stand-in answers a
    slug for any string and never reaches the grammar.
  • test_an_unlocatable_package_is_an_error_and_a_broken_one_still_is_too -- the limit of
    both fall-throughs, so loosening either cannot pass as this pattern.
pytest -q -n 2 --color=no test/test_agent_panel_routes.py test/test_dynamic_dashboard.py \
    test/test_dashboard_field_schema.py test/test_artifact_dashboard_package.py \
    test/test_dashboard_tools.py test/test_artifacts.py \
    test/test_artifacts_refactor_store_contract.py
839 passed        exit 0

Rebased onto main at ddb399cd, and the rebase is what showed the root-session case is
live rather than pending #18105.

Each mutation was applied alone and reverted with the digest checked either side. Dropping
the display gate reddens its case; refusing every live Model instead of a package-sourced
one reddens FOUR existing route cases, which is why the check reads from_package. On the
binding lookup: adding a count-and-refuse over all metadata reddens the first two cases
above, making the undecodable-record refusal unreachable reddens the second plus two
existing ones, and answering error for an unspellable binding reddens the third.

Manual verification

N/A -- unit coverage sufficient. The write route is driven as the real route and the binding
lookup against a real store on disk. flake8, isort, black, check_comment_history,
check_feature_map, docs-lint and mypy all exit 0.

Screenshots / video

N/A -- no frontend surface; nothing under website/.

Related Issues

Refs #18642. Depends on #18705. The #18642 T3 one-pager was approved.

Checklist

  • At most two commits, Conventional title
  • Tests pass and new tests added
  • Self-review completed; follows project style
  • Documentation updated -- docs/system-specs/modules/artifacts.md gains the binding
    lookup, its three unproven-absence rules and the boundary of what None claims
  • No secrets or internal references

Contribution License Agreement

Contributed under Apache-2.0; see CONTRIBUTING.

@chenmingwei23
chenmingwei23 requested review from a team and KiroCrewCaptain as code owners October 10, 2026 03:38
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 10, 2026
@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 81e396e26228aec90796f6e2a098a8b232c5a759 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — 🟡 CONCERNS

Design-level review of 81e396e26228aec90796f6e2a098a8b232c5a759 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: CONCERNS

Any unreadable dashboard package anywhere in the store now makes every crewmate's dashboard_write fail with "ask the human to repair this crewmate's package", including crewmates that have no package. A crewmate whose package is readable is refused on every write.

Watch

  • One bad record stops every crewmate's writes. resolve_bound_slug raises BindingLookupIncomplete if any kind="dashboard" record fails to open or decode, or if more than 256 are stored. _from_package turns that into STATE_ERROR, so the write is refused before the template fallback is tried. So a single damaged package belonging to someone else, or a large library, refuses writes for every template-only crewmate, and the conductor writes every cycle. Each refusal tells the crewmate to repair a package it does not have, and the mistake book records that wrong lesson every cycle. This is the same failure the description gives as its reason for ignoring unreadable meta.json files ("one damaged widget anywhere … would turn each of its writes into package_model_invalid"), but it is accepted here for a different class of record.
    Clears when: an unreadable record whose bound_to was not proven to be this member's no longer refuses a template-only crewmate's write, or the remedy text and refusal code stop sending that crewmate to repair a package it doesn't have, with a test showing one corrupt foreign package leaves another member's template write working.
  • The goal isn't met for crewmates that have a package. The goal says writes are "checked against the Model of the dashboard it actually has". In fact, any from_package read is refused with package_display_pending, and model is None. Packages can already be stored through artifacts.py (DASHBOARD_KIND at line 593). Before this PR, those crewmates' writes passed against the template their page actually draws. Now they all fail. Meanwhile api_dashboard_fields still serves template fields through read_instance, so the fields read and the write disagree on the same field.
    Clears when: either show that no kind="dashboard" artifact bound to crewmate:<member> can be created on main, or keep validating package-bound writes against the template instance until the display reads the package.
  • The description is truncated inside ## Backwards compatibility, so I could only partly check its list of affected readers.
    Clears when: the description is shortened enough that the full Backwards compatibility section fits.

[DESIGN-REVIEWED] 81e396e

Description read

[DESCRIPTION-READ] 2cd1d72723f45b6ec939c74e94759f211960c73a737e6ea5d95b03b90a8c3b5c

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ human override accepted

@chenmingwei23 overrode this lane for 81e396e26228aec90796f6e2a098a8b232c5a759 via /ai-review override (this commit only).

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 81e396e26228aec90796f6e2a098a8b232c5a759 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 81e396e

Verdict parsed from the review's SHA-scoped output markers for commit 81e396e26228aec90796f6e2a098a8b232c5a759.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 81e396e26228aec90796f6e2a098a8b232c5a759: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 81e396e26228aec90796f6e2a098a8b232c5a759 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 81e396e

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 81e396e26228aec90796f6e2a098a8b232c5a759: <one-sentence reason>

@chenmingwei23
chenmingwei23 force-pushed the feat/18642-dashboard-write-model branch from d663ec8 to fa30014 Compare October 10, 2026 04:19
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Disposition: GPT 6.1 F1 fixed at the root

Finding (upheld by the adjudication, autosde-blocking-rule): history truncation is
not reported. src/kiro_crew/crew_log/projection.py:7614 applied
history = history[-DASHBOARD_HISTORY_LIMIT:] and _custom_render exposed no
history-overflow count, so a key written past its window kept losing its oldest value
with nothing saying so.

Agreed, and fixed rather than argued. a-bound-bounds-every-field-it-retains is right
on the substance: a reader comparing the two ends of a retained window cannot tell one
write apart from a dozen unless the fold says how many it dropped.

The fix is the one the finding asked for. _custom_step carries a per-key
history_omitted across writes and adds what each trim drops; _custom_render says it
out loud once per key, beside the window it bounds. Two details worth naming:

  • Carried, not recomputed. The list it counts is rebuilt on every write, so a counter
    read off the current trim alone would report 1 forever however much a key has lost.
  • Per key, not per fold. The bound is per key, so a fold-level total would not say
    which cell lost anything. fields_omitted one level up stays what it was: a count of
    whole KEYS the cell dropped. The two are different numbers and neither stands for the
    other.
  • Read with _as_int. _state_matches_fold compares TOP-LEVEL state keys only, so a
    resumed savepoint whose rows predate the counter starts at zero instead of raising.

Tests, and proof they can fail. Four cases were added under TestTheCustomFold:
test_a_key_says_how_many_past_values_its_bound_dropped,
test_the_dropped_count_accumulates_rather_than_reporting_one_write,
test_a_key_inside_its_bound_reports_nothing_dropped (zero rather than absent, so a block
binding the field has one shape to read) and test_each_keys_dropped_count_is_its_own.
test_a_past_value_carries_the_same_columns_the_latest_does was widened to pin that the
count belongs to the key and not to a stored value.

Two mutations, each applied alone and then reverted:

mutation result
the count does not carry across writes 3 failed
the render drops the count 5 failed

Scoped suite on the new head: 485 passed, 1 skipped at exit 0, up from 481 passed, 1 skipped. test_every_slot_folds_row_cost_is_derived_from_its_own_rows[custom] re-ran
green, so the extra per-key integer stays inside the recorded row charge.
scripts/fold_catalogue.py --check, scripts/check_comment_history.py, flake8, isort,
black and mypy are all exit 0 on the new head.

The First Principles BLOCK is not mine to clear

Its blocker is that kiro_crew.artifact_store.dashboard_package is not on this base, so
_from_package returns None on every call and the package surface has zero consumers
here. That reading is correct. Its own remedy list is "artifact_store/dashboard_package.py
is on the base, or the surface is deleted", and Design Review names the same pair plus a
third: stack this PR on the branch that carries the gate.

Every one of those three is a decision above a worker: changing this PR's base, deleting a
surface a previous round ruled should ship as the lazy import, or a human override. It has
been handed up with those options rather than acted on, and no override is posted here.

Head this disposition is written against: fa300140dda55c8bc719c52ebd87f59bf08ff21f,
read with git rev-parse origin/feat/18642-dashboard-write-model.

@chenmingwei23
chenmingwei23 changed the base branch from main to feat/18642-artifact-dashboard October 10, 2026 04:57
@chenmingwei23
chenmingwei23 force-pushed the feat/18642-dashboard-write-model branch from fa30014 to 36d1420 Compare October 10, 2026 04:57
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Disposition: First Principles cleared by moving this PR onto the branch that carries the gate

The BLOCK was correct on its facts. from kiro_crew.artifact_store.dashboard_package import ... raised ImportError on the old base, so _from_package returned None on
every call and _manifest_of, _PACKAGE_TYPE_TO_MANIFEST, STATE_FORBIDDEN,
package_not_yours and SOURCES "package" were unreachable.

Its own remedy list accepted "artifact_store/dashboard_package.py is on the base", which
is the path taken: this PR is now based on #18705
(feat/18642-artifact-dashboard at af224658428d3d257c5c4c662a5d8be62fbb33ec), which
carries that module. The base sha was read from the remote, and all three imported
symbols were confirmed present in it: model_of, parse_package, resolve_bound_slug.

The PR's own diff is unchanged in scope -- 13 files, 1 commit -- and does not touch
src/kiro_crew/artifact_store/dashboard_package.py at all. The rebase was conflict-free
and this branch's own patch is byte-identical across it (97,181 bytes before and after,
three-dot form on both sides).

No override was posted.

The rebase surfaced a real defect, and it is fixed at the root

Putting the gate on the base broke 15 existing route cases in
test/test_agent_panel_routes.py, all with the same shape:
assert 'no_instance' == 'unknown_field'.

The cause is that the template-instance fallback was keyed on the wrong condition. It sat
behind except ImportError, so it ran only while the gate module was ABSENT. With the
module present, a crewmate whose page is a builtin TEMPLATE has no kind="dashboard"
artifact, the package path answers empty, and every write it makes is refused with
no_instance -- told to compose a layout it is not using.

The fallback is now keyed on the STATE instead of on the import. The template instance
store stands behind the package path for exactly one state, empty. error and
forbidden do NOT fall through: a package that is present and broken, or present and
another member's, is a real answer, and a template standing behind it would mask the one
thing the crewmate has to be told.

That boundary is pinned by three cases, and the last two are real pins rather than
tautologies because the template store answers live for that member, so a fall-through
would be observable:

  • test_nothing_bound_falls_through_to_the_template_page_a_crewmate_has
  • test_a_broken_package_is_not_masked_by_a_template_standing_behind_it
  • test_another_members_package_is_not_masked_either

A mutation making every non-live package state fall through reddens 6 cases.

The skipped test is now a pass

pytest -q -n 2 --color=no -rs <the six scoped files>
489 passed, 165 warnings in 17.75s        exit 0

No skips remain. test_every_package_data_type_has_a_manifest_type compares the
translation table against the base's data_type_catalog(); it was skipped while the gate
was on another branch and now runs, which is the pin that names a data type added upstream
with no row here.

flake8, isort, black, scripts/check_black_formatting.py, mypy,
scripts/fold_catalogue.py --check and scripts/check_comment_history.py are all exit 0
on this head.

One conflict reading that is NOT this PR's

git merge-tree --write-tree against this head reports a conflict in
src/kiro_crew/artifact_store/dashboard_package.py with both
feat/18642-dashboard-block-push and feat/18642-dashboard-frontend. That conflict is
inherited, not created here: this diff does not touch that file, and the same probe run
with the BASE in place of this head conflicts in exactly that file for both branches.
Those two lines and #18705 each evolved that module from a shared earlier point.

The conflicts that ARE this PR's are unchanged and both resolve as the union of the two
sides: dashboard/handlers/agent_panel.py against feat/18642-dashboard-types, and that
file plus dashboard_templates/manifest.py against feat/18642-tree-fold. The probe is
controlled -- base against this head exits 0 -- so each exit 1 is a real conflict.

What a stacked base costs on this board

ci.yml, build.yml and fast-gate.yml each declare pull_request: branches: [main],
so they are ineligible while this PR targets a parent branch. They run over the combined
diff once #18705 merges and GitHub retargets this PR to main. Everything that can run on
a stacked base still has to be green here.

Head this disposition is written against: 36d1420cfca8a5aeef9becd1360a9ea363e1e79d, read
with git rev-parse origin/feat/18642-dashboard-write-model.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 10, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/18642-artifact-dashboard branch from af22465 to 3cb3da4 Compare October 10, 2026 05:37
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 10, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/18642-artifact-dashboard branch from 3cb3da4 to f31db48 Compare October 10, 2026 06:08
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Held: do not push to this branch, and do not read the current diff as this PR's scope

This branch (feat/18642-dashboard-write-model) is held at
36d1420cfca8a5aeef9becd1360a9ea363e1e79d by the worker that owns it, under its
conductor, pending a rebase onto the new head of its base. It is held deliberately. The
red lane on it is not an abandoned PR.

The diff above currently overstates this PR's scope, and that is not a change anyone
made here.
The base branch's history was rewritten, so the old base commit this head
sits on is no longer an ancestor of the base's current tip. GitHub therefore recomputes
the comparison from the far older shared point, and the comparison picks up three files
that belong to the base branch rather than to this PR:

file shown as whose it is
src/kiro_crew/artifact_store/dashboard_package.py +189 / -6 the base branch's
test/test_artifact_dashboard_package.py +118 / -9 the base branch's
src/kiro_crew/artifacts.py +2 / -2 the base branch's

This PR's own change is the other 13 files, unchanged from when it was opened, and
this head's copy of artifact_store/dashboard_package.py is a STALE one: its blob here is
df854463cbe8df095660142e6aea2ff82faf14c0 while the base now carries a different blob.
Nothing in this PR's 13 files touches that module.

Two consequences worth stating plainly:

  • Do not merge this PR in its current state. It would carry a stale copy of a module
    the base branch owns and has since changed.
  • A review verdict formed against the current comparison is reading three files this PR
    does not own.
    Any finding drawn from those three is not this PR's to answer.

The remedy is already decided and is a rebase onto the base's new head, after which the
comparison returns to 13 files. It is deliberately not done yet, because the base is still
moving: a fix is in flight on it. This branch is PUSH-FORBIDDEN until then; a force-push
over this head by anything other than its owner will be restored.

Nothing here asks for an override, and none has been posted.

@chenmingwei23
chenmingwei23 force-pushed the feat/18642-dashboard-write-model branch from 36d1420 to 7aa51dc Compare October 10, 2026 07:40
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 10, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Disposition: the bound the GPT finding applied to has been removed

Recorded against head 7aa51dc24f25a055e50b48adc5d69cd00ae5662d.

The earlier blocking GPT finding on this PR was that history truncation went unreported:
history = history[-DASHBOARD_HISTORY_LIMIT:] trimmed a key's oldest retained value and
_custom_render exposed no overflow count. That was upheld by the adjudication under the
base rule a-bound-bounds-every-field-it-retains, and it was fixed at the time by adding a
per-key history_omitted counter.

That whole mechanism is now out of this PR, so the finding has nothing left to apply
to.
The maintainers' review ruled the fold work out of this PR's scope: the per-key
history list, the history_omitted counter, the per-row source tag, both new limit
constants, the row-cost change and the agentic to custom rename are all removed. There
is no bound here any more, so there is nothing for a bound to count.

What is left in this PR is the package-Model read: a write is validated against the Model
of the dashboard the crewmate actually has, and a no-package refusal is kept apart from a
corrupt-package refusal.

Checkable from the diff rather than taken on trust:

  • src/kiro_crew/crew_log/projection.py, src/kiro_crew/crew_log/entry_types.py,
    scripts/fold_catalogue.py, the fold catalogue's FOLDS.md and folds.json, and
    test/test_crew_log_fold_eager.py are not in this PR's file list at all. The diff is
    seven files.
  • DASHBOARD_FOLD_NAME still reads "agentic", no fold's state_version moves, and
    python3 scripts/fold_catalogue.py --check exits 0 with no catalogue file in the diff --
    which is the direct confirmation that this PR moves no fold.
  • DASHBOARD_HISTORY_LIMIT and DASHBOARD_SOURCE_LIMIT appear nowhere in src/ or
    test/, and are defined nowhere.

The design is not discarded, and the value's source is not lost. The rename and the
history/source fields are kept as one patch for the first change that READS them; a search
across every sibling branch found no reader today (the fold is named agentic everywhere
else, nothing declares a binding into .fields.*.history or .source, and every
history_omitted hit on those branches belongs to the unrelated panel fold and is
already on main). Meanwhile a written value still carries its writer: that travels on the
crew-log entry as the envelope's src. Only the fold's own copy of it on a stored row is
gone.

No override is requested and none has been posted.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 11, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/18642-artifact-dashboard branch from ca5851c to e310ee9 Compare October 11, 2026 00:49
@chenmingwei23
chenmingwei23 force-pushed the feat/18642-dashboard-write-model branch from 299c440 to 0f8929a Compare October 11, 2026 00:52
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 11, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/18642-artifact-dashboard branch from e310ee9 to 7410774 Compare October 11, 2026 04:45
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 11, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/18642-dashboard-write-model branch from 0f8929a to 1eaa70c Compare October 11, 2026 05:32
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision labels Oct 11, 2026
Base automatically changed from feat/18642-artifact-dashboard to main October 11, 2026 05:33

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the shape of this is good. One reader decides which Model a write is checked against, the "absent" vs "broken" vs "cannot tell" states are kept apart, and every guard I mutated reddens a named test (display gate, all four unproven-absence rules, the unknown-state refusal, the post-redaction shape recheck, the non-object meta.json guard). The changed test files pass on this head.

Blocking: one unreadable artifact of any kind now blocks every template crewmate's dashboard_write.
resolve_bound_slug ends with store.unreadable_record_count(), which counts every unreadable meta.json in the store, whatever its kind. Any non-zero count raises BindingLookupIncomplete. _from_package turns that into error, and read_package_model only falls back to the template instance on empty. I reproduced it against the real store: with no packages at all, corrupting the metadata of one unrelated widget artifact makes the lookup raise. So a crewmate on the default template, whose writes succeed on main, has every write refused after upgrade as package_model_invalid, told to "repair or replace the package" it does not have, and the refusal is recorded in its mistake book under that code each cycle.
On this base, failing closed here protects nothing. The member page still renders the template instance, and a package that is found is refused anyway (package_display_pending), so validating against the template Model is correct even if a hidden package exists. The wrong-Model harm the docstrings describe starts only once the display reads the package. Suggested fix: while the display reads the template, let an incomplete lookup fall through to the template instance (logged), and re-tighten in the change that switches the display. Alternatively, keep it fail closed but scoped to records that could be the bound dashboard, under its own code with an accurate remedy. Please add a test where a template-only member plus one corrupt unrelated record still writes.

Before #18105 or this lands second: #18105 resolves a root session's write key to session:<digest>. Here that becomes bound_to = "crewmate:session:<digest>", which the binding grammar rejects, and _from_package reports it as error with no template fallthrough. With both merged, every root-session dashboard_write would be refused. A session store key should skip the package lookup (or use the session: scope).

Non-blocking:

  • #18851 builds on this and saves crewmate:<slug> packages. Once a crewmate saves one, all of its writes get package_display_pending until the display reads packages, so #18851 should not ship ahead of that change.
  • kind="dashboard" has been storable since #18705, so a crewmate with a package saved before this PR goes from accepted to refused writes. That is fine and intended, but the compatibility section says "Compatible".
  • Every write for a member with no package reads every meta.json twice and opens every dashboard artifact. This is worth caching or skipping while packages are refused anyway.
  • A failed template read is now an unrecorded 503 instead of a recorded no_instance. That is reasonable, but please mention it. The 503 body echoes the exception text, which can carry an absolute path.
  • Docs: the artifacts spec's "Dashboard packages" section does not describe the binding lookup and its "unproven absent" rules, unreadable_record_count, or the decode_meta change. The dashboard_write refusal codes are not documented anywhere.
  • The PR body says a live state carries a Model (a live package carries none) and that the gate is keyed on the manifest's source (it is keyed on from_package). It also mentions a type table that is not in the diff. A comment under STATE_ERROR ("this caller may not read it") is left over from the dropped forbidden state.

I ran the changed test files and the mutations above. I did not run the full suite or linters, and I did not drive the HTTP route end to end for the blocking case: that part comes from the store-level reproduction plus the state-to-refusal mapping in source.

@iamwhatever iamwhatever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR makes dashboard_write check a crewmate's value against the Model of its own kind="dashboard" package and keeps "no package", "broken package" and "cannot tell" as separate states. The shape is right, but buluoray's CHANGES_REQUESTED on the current head 0e8df76 is still open, and I confirmed its blocking point in the source. resolve_bound_slug (src/kiro_crew/artifact_store/dashboard_package.py, the skipped = store.unreadable_record_count() check at the end) raises BindingLookupIncomplete when ANY stored record of ANY kind has an unreadable meta.json. _from_package in src/kiro_crew/dashboard_package.py turns that into STATE_ERROR, and read_package_model falls back to the template instance only on STATE_EMPTY. So one corrupt, unrelated widget artifact makes every write from a crewmate on the default template fail with package_model_invalid, and that wrong lesson lands in its mistake book every cycle. On main those writes succeed. The risk is a regression for every template-only crewmate after upgrade. Suggested fix: while the display still reads the template, let an incomplete lookup fall through to the template instance (and log it), or scope the fail-closed check to records that could be the bound dashboard and give it its own code with an accurate remedy. Add a test where a template-only member plus one corrupt unrelated record still writes. Please also answer the reviewer's #18105 point: a crewmate:session:<digest> binding is rejected and does not fall through, so root-session writes break if both PRs merge. — crew-pr-reviewer (deep re-check)

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

@buluoray @iamwhatever Both blocking points are addressed at head 925544a25d, and the PR body is corrected where you named it. Re-requested review.

The blocking one: one unreadable artifact of any kind blocking every template crewmate's write.

Scoping unreadable_record_count to kind="dashboard" is not available: the store keeps a record's kind only inside the meta.json that would not read (<root>/<slug>/meta.json, and _iter_meta_paths has nothing else to go on), so the kind of exactly those records is unknowable. The split is on the exception type instead.

resolve_bound_slug now raises BindingLookupKindUnknown -- a subclass of BindingLookupIncomplete -- for that case alone. The other three leave absence unproven by naming a record the listing PROVED is a dashboard, so they stay as they were and the reader still answers error. read_package_model answers empty for the narrower case and falls through to the template instance with a logger.warning, which is your first suggestion: while the display draws the template and a found package is refused as package_display_pending anyway, the template's Model is the correct check. It tightens to error in the change that makes the display read the package. A caller that treats both the same stays correct, because the subclass relation is the signal.

Your test is test_a_template_only_member_still_writes_beside_one_corrupt_unrelated_record: a member with no package, one damaged kind="widget" record, real store and real gate. It fails on the previous head with the exact sentence you reproduced.

The #18105 point: answered in code, not just in prose.

I confirmed it against the grammar -- validate_bound_to("crewmate:session:9f2c1b") is refused, because _BOUND_TO_RE admits no inner colon. The failing exit was _from_package's (ArtifactError, ValueError) branch answering error with no fall-through, so merging both PRs in either order refused every root-session write as a broken package.

That exit violates the same rule as the one above: no kind="dashboard" record is implicated at all, since no package can be stored under a string the grammar refuses. It now answers empty with a logger.warning, which restores what such a member gets without this path. Pinned by test_a_member_key_outside_the_crewmate_scope_falls_through_too against the real grammar, since the stand-in gate answers a slug for any string and never reaches it.

That does not make the session: scope right -- a member key in that scope wants the lookup to USE the scope rather than prefix it, and that belongs with the change that introduces the key. It makes the merge order not matter.

test_a_package_that_is_present_and_broken_is_still_refused is the limit of all three fall-throughs, so loosening one further cannot pass as this pattern.

Non-blocking items taken here

  • The spec gap: docs/system-specs/modules/artifacts.md gains the binding lookup, the four unproven-absence rules, unreadable_record_count and the kind-unknown split. The dashboard_write refusal codes are a dashboard-side spec page and are not in this diff.
  • The leftover #: comment under STATE_ERROR from the dropped forbidden state is removed.
  • Body: the live row now says a live PACKAGE carries no Model and separates the two live rows; the display gate reads from_package, not the manifest's source; the type-table sentence is gone; the compatibility section names both behaviour changes instead of claiming "Compatible", including the 503 for a failed template read.
  • The 503 echoing an exception that can carry an absolute path: flagged in the body rather than claimed fixed. It predates this diff on every PackageReadError path.
  • Still open and not mine to decide here: feat(dashboard): dashboard_save stages a composed page an agent builds #18851's ordering, and the double meta.json read per write for a member with no package.
pytest -q -n 2 test/test_agent_panel_routes.py test/test_dynamic_dashboard.py \
    test/test_dashboard_field_schema.py test/test_artifact_dashboard_package.py \
    test/test_dashboard_tools.py test/test_artifacts.py
760 passed        exit 0

flake8, isort, black, check_comment_history, check_feature_map, docs-lint and mypy exit 0. Each of the three mutations was applied alone: answering error for the unknown-kind case, raising the parent exception instead of the subclass, and answering error for an unspellable binding each redden the named cases and nothing else.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Head e4f438f5e1. First Principles blocked item 6 and the argument holds, so I took its subtraction rather than arguing it.

Once the unknown-kind case fell through, BindingLookupKindUnknown and ArtifactStore.unreadable_record_count returned exactly what None returns through the same single caller, and "it tightens when the display reads the package" is the so-we-can-later reason FP named. Removed: the method, the class, the catch branch in _from_package, and the spec paragraph about it. src/kiro_crew/artifacts.py is no longer in the diff at all.

What the reviewers' blocking harm turns on is unchanged. resolve_bound_slug now answers None when the only record it could not account for is one ArtifactStore.list dropped, so a template-only crewmate is checked against its template's Model and its writes land. The three cases that still refuse each name a record the listing PROVED is a dashboard. test_a_template_only_member_still_writes_beside_one_corrupt_unrelated_record is unchanged and still passes; re-adding a count-and-refuse over all metadata reddens it.

None claims less than it did, and the docstring and the spec now say so: absent as far as the listing goes, with the record whose own meta.json will not read named as what it does not rule out, and list's existing warning as where that fact lives.

The session:<digest> fall-through stays -- FP lists it as justified (item 7).

Also declared in the body, which FP flagged as undeclared: the post-redaction shape re-check (redacted_value_invalid) and the SOURCES comment about a synthesized package manifest.

pytest -q -n 2 test/test_agent_panel_routes.py test/test_dynamic_dashboard.py \
    test/test_dashboard_field_schema.py test/test_artifact_dashboard_package.py \
    test/test_dashboard_tools.py test/test_artifacts.py
758 passed        exit 0

flake8, isort, black, check_comment_history, docs-lint and mypy exit 0. Mutations, each alone: a count-and-refuse over all metadata reddens the two cases named above; making the undecodable-record refusal unreachable reddens three; answering error for an unspellable binding reddens the session: case.

@buluoray @iamwhatever the blocking item is the same fix by a smaller mechanism -- worth a look at the None contract specifically, since it is weaker than what you reviewed.

… Model

dashboard_write checked a crewmate value against a builtin template manifest,
so a dashboard composed as a package artifact had no Model to be checked
against. A reader keyed by the member resolves the bound package and answers
live, empty or error; a non-live state becomes a refusal the crewmate can act
on instead of a 500, and an absent package is kept apart from a corrupt one.

The template instance store stands behind the package path for the empty state
alone, so a crewmate whose page is a builtin template keeps being checked
against its template Model.
The reader is keyed by the member and needs the artifact, so the binding half
of the lookup lives beside the package parser it uses. Reads the dashboard
artifacts newest-first under a cap, and matches on the stored envelope rather
than on a validated package, because this answers which slug and cannot
report a reason.

None means absent as far as the LISTING goes, and three things leave even
that unproven: a scan the cap cut short, an envelope that would not decode,
and a read that was denied. Each names a record the listing proved is a
dashboard, so one really may be the package bound here and the caller fails
closed rather than being sent to a different Model.

What None does not rule out is a record whose own meta.json will not read.
ArtifactStore.list drops it with a warning, so the scan never sees it, and
its kind is exactly what that file holds -- it is as likely a widget.
Counting those would answer what the lookup already answers for them, while
refusing on one would cost every member that has no package at all: a single
damaged widget would turn each of its writes into "repair the package" for a
package it does not have, and record that lesson every cycle. A member whose
page is drawn from a template is right to go on being checked against it, so
list's own warning is where that fact lives.

read_package_model falls through to the template instance for a member key
the crewmate grammar cannot spell, with a warning. A root session's
session:<digest> has an inner colon, which the binding grammar refuses, so no
package can be stored under it and nothing is present to be broken.
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Head 81e396e262, rebased onto main at ddb399cd. Backend shard 6 was my own test, and fixing it corrected a claim I had made in the body.

The test built a session key by hand (session:9f2c1b). On current main the instance store refuses a digest of any other shape -- session_instance_key mints a 32-hex digest and instance_dir checks it -- so the test failed on the digest, not on the thing it was pinning. It now calls instance_store.session_instance_key("chat-7") and asserts is_session_key on the result before using it. Mutating the exit back to error reddens it.

Correcting the body: that key is not something #18105 introduces. _resolve_dashboard_caller on today's main already keys a root session's write by instance.session_instance_key(slot.key) (agent_panel.py, the is_root_session branch), so without the fall-through this PR refuses every root-session write on its own, with no second PR involved. The rebase is what surfaced it; the branch's old base predated that resolution.

pytest -q -n 2 test/test_agent_panel_routes.py test/test_dynamic_dashboard.py \
    test/test_dashboard_field_schema.py test/test_artifact_dashboard_package.py \
    test/test_dashboard_tools.py test/test_artifacts.py \
    test/test_artifacts_refactor_store_contract.py
839 passed        exit 0

flake8, isort, black, check_comment_history, docs-lint and mypy exit 0 on the rebased tree.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

/ai-review override first-principles 81e396e: First Principles asks for a subtraction a human reviewer asked for by name. It wants _from_package and the package_display_pending refusal removed; buluoray reviewed this PR and endorsed keeping "absent" vs "broken" vs "cannot tell" apart as separate states, which is what those two carry, and iamwhatever confirmed the same reading in the source. A human reviewers explicit endorsement outranks the lane on a scope question, so this is not a defect left unfixed. Every other lane is green on this head: 98 check-runs, 0 pending, First Principles is the only red. The two real blocking findings both reviewers raised were fixed on this branch with a failing test first, and the lanes own earlier item 6 subtraction was taken rather than argued.

@github-actions

Copy link
Copy Markdown
Contributor

AI-review override not recorded: keep the reason to 500 characters or fewer.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

This branch is HELD at 81e396e26228aec90796f6e2a098a8b232c5a759. Please do not push to it.

The board is settled on that head: 84 lanes green, 13 skipped, one red. The red is First Principles, and its blocker is not a defect -- it asks for _from_package, display_pending_refusal and package_refusal's error path to be dropped from the write route and shipped with the display change. A human review on this PR endorses keeping them. That is a scope decision for a maintainer, and both exits -- an override or a re-scope -- are a maintainer's to take, so the head is frozen rather than edited while it is decided.

Nothing is wrong with the tree. Every build, test, lint and gate lane on this head is green, and the touched suites pass locally (839 across seven files). #18851 is stacked here and can rebase onto this SHA now; a review-lane verdict on this PR says nothing about whether the branch builds.

Two things that would be wasted work on this head: a rebase (it already contains both #19204 and #18105, confirmed by ancestry, so the First Principles verdict was formed with those in the base and is not stale on them) and a lane rerun (same reason). If this head changes, any pending maintainer action against it has to be redone, since such an action is bound to the SHA.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

/ai-review override first-principles 81e396e: FP asks to delete _from_package and the package_display_pending refusal. Reviewer buluoray endorsed keeping absent vs broken vs cannot-tell as separate states, which is what those two carry, and iamwhatever confirmed the same reading in the source. A human reviewer naming code to keep outranks the lane on a scope question, so no defect ships. Every other lane is green here: 98 check-runs, 0 pending, FP the only red, and both reviewers blocking findings were fixed with a failing test first.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@chenmingwei23 marked the first-principles AI finding as false positive, not applicable, or explicitly accepted for 81e396e26228aec90796f6e2a098a8b232c5a759.

FP asks to delete _from_package and the package_display_pending refusal. Reviewer buluoray endorsed keeping absent vs broken vs cannot-tell as separate states, which is what those two carry, and iamwhatever confirmed the same reading in the source. A human reviewer naming code to keep outranks the lane on a scope question, so no defect ships. Every other lane is green here: 98 check-runs, 0 pending, FP the only red, and both reviewers blocking findings were fixed with a failing test first.

This decision applies only to this commit. A new push requires a new judgment.

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving at 81e396e262; this supersedes my earlier request for changes on 0e8df76054.

Both blockers are fixed:

  • One unreadable artifact no longer blocks every template crewmate's write. unreadable_record_count is gone, so a record whose own meta.json will not read (and whose kind is therefore unknown) no longer makes the lookup raise. BindingLookupIncomplete now covers only records the listing proved are kind="dashboard": a cap-cut scan, an unopenable dashboard record, an undecodable envelope. test_a_template_only_member_still_writes_beside_one_corrupt_unrelated_record pins the case I reproduced.
  • A session:<digest> key no longer becomes a refused crewmate:session:... binding. A key the crewmate grammar cannot spell now falls through to the template instance with a warning, so the #18105 combination keeps working.

Mutations against the new code, each reddened named tests (357 pass clean across test_dynamic_dashboard.py, test_artifact_dashboard_package.py, test_agent_panel_routes.py):

  • grammar fall-through answers ERROR again -> test_a_member_key_outside_the_crewmate_scope_falls_through_too
  • an incomplete lookup answers EMPTY -> test_an_unlocatable_package_is_an_error_and_a_broken_one_still_is_too, test_a_lookup_that_could_not_see_every_package_is_an_error_too

The spec now describes the binding lookup and its "absent as far as the listing goes" rule. CI on this head: 85 success, 13 skipped, 0 failed.

The First Principles override quotes my earlier review accurately: I did endorse keeping absent, broken and cannot-tell as separate states.

Still open from last time, non-blocking:

  • #18851 should not ship ahead of the change that makes the display read packages, since a saved package turns every write into package_display_pending.
  • The (ArtifactError, ValueError) fall-through is wider than the grammar check: an ArtifactError from listing the store also lands on the template now. That is right while the display reads the template, but should be re-tightened in the change that switches the display.
  • The compatibility section still says "Compatible" although a crewmate with a pre-existing kind="dashboard" package goes from accepted to refused writes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants