Repository navigation
fix(schedule): list long job results as a preview, read them per job - #32000
bolichen97 wants to merge 1 commit into
Conversation
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Each item follows from the measured list cost of more than 10 MB per read, and the new per-job route has two real consumers. What this change shipsInventory (8 items) — 8 justifiedIntent: let people with many long-output scheduled jobs load the Schedule page quickly while still seeing each job's whole last result and error. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 1b27c6f Description read[DESCRIPTION-READ] 3df6aa18fa0b1cce67a6b070774cb250b7e44b2ccc10495e599e83069b5e7819 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS No design-level blocker: the list sends a preview, a new per-job read returns the whole text, and the take-away readers are listed. Notes
[DESIGN-REVIEWED] 1b27c6f Description read[DESCRIPTION-READ] 4685753a0d0cf2f0014f1b730ab56504b6b673fa7c1aab6aa0e08193a290dd40 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 |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks. The blind reader read both new notices correctly, and screenshots show each one with and without its failure state. Notes
[UX-REVIEWED] 1b27c6f Description read[DESCRIPTION-READ] a25d116b056369a3f1bdb4828d02b2c7002544e101153fb9639bd158f48a8e2f That sha256 names everything this verdict read: the PR description, plus the 8 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 |
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: |
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: |
5f88d4f to
51a95fe
Compare
|
Rebased: main moved in docs/feature-map/README.md, docs/system-specs/modules/learn-cron-dashboard.md, src/kiro_crew/dashboard/handlers/init.py, src/kiro_crew/dashboard/server_runtime/mcp_routes.py, test/test_dashboard_server_composition_contract_reach.py and website/src/test/ApiClient.refactor.surface.test.ts since this head went green (a47c2d4 -> 2552c90); CI re-running. The route-table digest conflict is resolved by recomputing it on the rebased table (339 rows). The same push fixes this head's reds: the cron facade's type-checking manifest now names [operator: bolichen97] |
[operator: bolichen97] |
51a95fe to
76dde3e
Compare
|
Rebased: main moved in docs/app-kit/api-reference.md, docs/feature-map/README.md, docs/system-specs/modules/learn-cron-dashboard.md, src/kiro_crew/dashboard/handlers/init.py, src/kiro_crew/dashboard/handlers/cron.py, src/kiro_crew/dashboard/handlers/cron_board.py, src/kiro_crew/dashboard/server_runtime/mcp_routes.py and test/test_dashboard_server_composition_contract_reach.py since this head went green (2552c90 -> 5f7f8d1); CI re-running. [operator: bolichen97] |
[operator: bolichen97] |
|
[operator: bolichen97] Backend Tests shard 2 (Linux and Windows) fail on |
76dde3e to
7c02453
Compare
|
Rebased: main moved in docs/feature-map/README.md, docs/system-specs/modules/learn-cron-dashboard.md, website/src/pages/SchedulePage.tsx, website/src/i18n/locales/en.manual.json, website/src/i18n/locales/en-XA.json and the bn, de, es, fr, hi, it, ja, ko, pt, ru and zh-CN catalogs in website/src/i18n/locales/ since this head went green (5f7f8d1 -> f58c3cf); CI re-running. [operator: bolichen97] |
fd43faf to
d55789b
Compare
|
Rebased: main moved in docs/feature-map/README.md, docs/system-specs/modules/app-notifications.md, docs/system-specs/modules/learn-cron-dashboard.md, website/src/test/ApiClient.refactor.surface.test.ts and the i18n catalogs in website/src/i18n/locales since this head went green (3703c2e -> 80cf3df); CI re-running. The new base carries the fixes for the two main reds that held fd43faf: #35541 (the [operator: bolichen97] |
|
[operator: bolichen97] Correction to the note above: this push did not dismiss buluoray's approval. GitHub carried it to d55789b, since the rebase left the patch unchanged, so the PR still holds that approval. |
d55789b to
beb4ddf
Compare
|
Rebased: main moved in docs/app-kit/api-reference.md, docs/feature-map/README.md, docs/system-specs/modules/app-notifications.md, docs/system-specs/modules/learn-cron-dashboard.md, src/kiro_crew/dashboard/handlers/init.py, src/kiro_crew/dashboard/server_runtime/mcp_routes.py, test/test_dashboard_server_composition_contract_reach.py, website/src/api/client/cron.ts, website/src/components/notifications/NotificationDetailPanel.tsx, website/src/pages/SchedulePage.tsx, website/src/test/ApiClient.refactor.surface.test.ts and the i18n catalogs in website/src/i18n/locales since this head went green (80cf3df -> a45e97a); CI re-running. GitHub reported this PR as conflicting. The three conflicts each kept both sides: the Schedule row in @buluoray this push dismissed your approval of d55789b; the change since is this rebase only. [operator: bolichen97] |
|
Re-sync budget reset This head's three re-syncs are spent, and its Backend Tests shard 3 (Linux and Windows) are red only on [operator: bolichen97] |
GET /api/crons redacted and sent every job's whole last_result and
last_error on every read, so one Schedule page load at 500 jobs with
20 KB results took seconds. The list now carries the first 1,000
characters of each whole-text redaction, which goes through the
dashboard's display redaction cache, so a re-read redacts only the
results that changed. Both fields stay redacted like every other cron
field whatever the owner's redaction setting. GET /api/crons/{id}
returns one job's row with both whole under the same app-ownership
gate and audit as the other per-job reads. The job dialog and the
notification panel's "Fix with Crew" read it for the whole result and
error.
Closes #24605
|
Rebased: main moved in docs/app-kit/api-reference.md, docs/feature-map/README.md, docs/system-specs/modules/app-notifications.md, docs/system-specs/modules/learn-cron-dashboard.md, docs/system-specs/modules/security.md, src/kiro_crew/dashboard/handlers/init.py, src/kiro_crew/dashboard/handlers/cron.py, src/kiro_crew/dashboard/handlers/cron_board.py, src/kiro_crew/dashboard/server_runtime/mcp_routes.py, src/kiro_crew/redaction_seams.py, test/fixtures/dashboard_mcp_route_table.txt, test/test_cron_list_build_off_loop.py, test/test_member_memory_api.py, website/src/components/notifications/NotificationDetailPanel.tsx, website/src/pages/SchedulePage.tsx, website/src/test/ApiClient.refactor.surface.test.ts and the i18n catalogs in website/src/i18n/locales since this head went green (a45e97a -> 7a3cec9); CI re-running. GitHub reported the branch as conflicting with main in Main's #37408 (one redaction switch) changed what this PR builds on, so this push also makes two adjustments:
The patch was gated again on main at f6a144e on Ubuntu 24.04. These all pass:
With 300 jobs whose results are about 20 KB each and carry a token on their first line, and the owner's redaction setting off and then on, every listed result was at most 1,000 characters and the start of the per-job read's text, the token was in neither body, an unknown id answered 404 Main has since moved to 7a3cec9. It changed none of this PR's code or test files, none of the redaction modules the list goes through, and no code that reads a cron job's The reds on the previous head do not carry over: Backend Tests shard 3 (Linux and Windows) failed only [operator: bolichen97] |
|
resolution: removed -- the list preview redacted only the opening of each result, and the redaction decides some matches from text past the cut, so the list now redacts each whole result through the display redaction cache and cuts that; the tests that pinned the removed opening-only redaction (the near-the-cut corpus, which no longer imports on main, and the encoded and PEM duplicates of the cut invariant) are gone
[operator: bolichen97] |
beb4ddf to
1b27c6f
Compare
Problem / Motivation
Goal: The Schedule page loads its job list quickly even with hundreds of jobs whose runs return long results, and the job dialog still shows each job's whole last result and last error.
GET /api/cronsredacts and sends every job's fulllast_resultandlast_error. With 500 jobs whose runs return about 20 KB each, one list read takes most of a second or more and its body is over 10 MB, even after the list build moved off the gateway's event loop (#24685). The list cannot simply be cut, because the job dialog shows the whole result and error from the list entry.Why it matters
Anyone with many scheduled jobs that produce long output waits on every Schedule page load and reload, and the gateway spends that time redacting text the page never shows.
Not a goal
messagein the list. The job form fills and compares the message field from the list entry, so it stays whole.What changed (motivation → approach → change)
Redacting every job's whole result on every read was most of a list read's cost, and the page needs only the opening of each one: the row tooltip and the partial-block badge, whose phrase starts the error.
last_result/last_errorGET /api/crons(the Schedule list)GET /api/crons/{id}(new, one job)Each result is still redacted whole before it is cut, so the preview masks everything the whole text's redaction masks, however far past the cut the text that decides a match lies. The redaction goes through the dashboard's display redaction cache, the one the chat view already uses (
_redact_for_display, the credential pass): it keeps each answer under a keyed digest of the text and of every setting the pass reads, so a list re-read redacts only the results the cache does not hold. That pass opens the chat seam, which the owner's redaction setting stands down, so the list runs it insidealways_scan(a row inredaction_seams.py): the two fields stay redacted like every other cron field, whatever the setting. The first read after a gateway start still redacts every result, as main does; every body is about a tenth of main's. The new per-job read uses the same app-ownership gate and audit as the other per-job reads (_refuse_foreign_app_job,crons.get) and answers 404job_not_foundfor an unknown job.Two screens read the whole text through a new
api.cron(id)(api/client/cron.ts):last_run_tsis the list row's, so a read that is still pending or has failed after a new run never shows the earlier run's text. If that read fails while the preview is on screen, a notice says the full text could not be loaded, that the text below may be cut short and that the job's settings are not affected. That sentence is one new catalog key,pages.schedulePage.full_run_text_load_failed, inwebsite/src/i18n/locales/en.manual.jsonand every translated catalog, withen-XA.jsonregenerated.NotificationDetailPanel.tsx) hands over the job's whole result from the same per-job read, not from the list, which now holds only its opening. If that read fails (a job deleted since, say), a notice under the button says Fix with Crew sends the text shown, which is cut short. The panel is an overlay that may sit over an unsaved draft, so the notice offers no agent hand-off. Its sentence is one new catalog key,components.notifications.notificationDetailPanel.could_not_load_the_whole_result_button_sends_the_cut_text, inwebsite/src/i18n/locales/en.jsonand every translated catalog, withen-XA.jsonregenerated.The dialog's Last Output and Last Error, with their per-job read and its notice, are one component,
JobRunTextinSchedulePageJobRunText.tsx, which keepsSchedulePage.tsxunder the 2,000-line cap. The list carries no length fields: both screens read the job, so nothing else needs to know where the cut fell. The owning specs (learn-cron-dashboard.md,app-notifications.md, andsecurity.md's list ofalways_scansites), the feature map, the App Kit route table, the sharedcronJobsQuerynote and theCronJobtype (types/index.jobs.ts) say the list carries a preview.Backwards compatibility
Breaking:
GET /api/cronsreturns at most the first 1,000 characters of each job'slast_resultandlast_error; a reader that needs the whole text readsGET /api/crons/{job_id}. Writer sweep on origin/main @ 7a3cec9: nothing writes these fields through the route; the readers are listed below.Reader: website/src/pages/SchedulePageJobRunText.tsx:JobRunText -- crew page -- reads
api.cron(id)for the whole text;SchedulePage.test.tsx"the detail dialog shows the whole last output, read for the job, not the list preview"Reader: website/src/components/notifications/NotificationDetailPanel.tsx:fixWithCrew -- notifications -- reads
api.cron(job_id)for a cut note's whole result;NotificationDetailPanel.fixWithCrew.test.tsx"stages the job's whole last result for a cron note whose body the store cut"Reader: website/src/pages/SchedulePage.tsx:status cell
title-- crew page -- a tooltip, the opening is what it can showReader: website/src/utils/cronPartlyBlocked.ts:isPartlyBlocked -- crew page -- its pattern is anchored at the start of
last_error, which the preview keepsReader: docs/app-kit/api-reference.md:listCrons -- app -- an app gets the preview from the list and reads one job whole from
GET /api/crons/{job_id}, both stated in the referenceReader: packages/kirocrew-client-py/kirocrew_client/client.py:list_crons -- app -- returns the list as served, so a caller gets the preview; no caller in the repository reads these two fields from it
Reader: src/kiro_crew/mcp_cron_list_render.py:_render_cron_list_full -- chat -- reads the cron store, not this route
Tests
test/test_cron_list_build_off_loop.py::TestResultPreview: with the owner's redaction setting off (the shipped default), the list carries the first 1,000 characters of the whole text's redaction, so a credential the cut lands in shows as the redaction tag, andGET /api/crons/{id}masks it in the whole result (red withoutalways_scan); a second list read redacts no unchanged result again, with the setting off too;GET /api/crons/{id}returns the whole redacted result, and 404job_not_foundfor an unknown id. The owner view still reaches the worker (main'stest_owner_view_scope_reaches_the_worker).test/test_r16_cron_app_read_ownership.py: the new route joins the per-job read table, so an app is refused a job it does not own (403, auditeddenied), reads its own (auditedallowed), and the owner reads every job.test/test_dashboard_cron_path_id.py: an empty or over-long job id is a 400 before the store is read.website/src/test/SchedulePage.test.tsx: the dialog shows the whole last output from the per-job read, not the list's preview; a failed per-job read shows the notice and keeps the preview, and the next cron refresh reads the job again, shows the whole text and drops the notice; after a new run, a failed re-read shows that run's output, not the earlier run's error kept in the cache (red without thelast_run_tscheck).website/src/test/NotificationDetailPanel.fixWithCrew.test.tsx: a cut cron note's hand-off carries the whole result served byapi.cron, not the list; when that read fails, the notice says the text it sends is cut short and the click still sends the note as stored (red without the notice).test/test_redaction_one_setting.pyreads theALWAYS_REDACTED_SITESrow against thealways_scancall.test/test_cron_handler_facade.py,test/test_member_memory_api.py, the MCP route-table rows (test/fixtures/dashboard_mcp_route_table.txt) andApiClient.refactor.surface.test.tslist the new route and client method.test/test_cron_list_build_off_loop.pyran green 20 times at-n0and in three shuffled orders of its tests (seeds 24605, 7, 1234);NotificationDetailPanel.fixWithCrew.test.tsxandSchedulePage.test.tsxran green 10 times in a row and once in shuffled order (--sequence.shuffle, seed 1794856978513).Proof: not provable -- other: the new tests import
api_cron_getand_LIST_TEXT_PREVIEW, so reverting the whole change stops them at collection rather than at an assertionManual verification
Timed the real
api_cronshandler on a Linux host (Ubuntu 24.04, 8 vCPU, load average about 2.5 to 3, main at 899d458), 500 jobs whose results are about 20 KB of multi-line text: the first read, then the median of the next five reads in the same process, with the owner's redaction setting off (the shipped default) and on.A result the redaction changes costs the cache about twice its length, so 500 such results overflow its 16 MiB bound and are redacted again on every read, and each such read also pushes the chat view's cached redactions out of the cache they share, which main's list never wrote to; at 300 of them a re-read took 0.10 s. On this change, in both positions of the setting, the token is in neither the list nor the per-job read, every listed result is at most 1,000 characters and equals the start of the redacted whole text,
GET /api/crons/{job_id}returns the whole redacted text, an unknown id answers 404job_not_found, and a short result is listed whole.Against the SPA built from this change with every API answered from fixtures, a job whose 60-line result the list cut at 1,000 characters: when the per-job read answered, the dialog showed the output to its last line; when it answered 404, the dialog showed the notice above the preview, with no server text and no button. A cut cron notification for that job: when the per-job read answered, the panel showed no notice; when it answered 404, the notice under Fix with Crew said the text it sends is cut short.
Screenshots / video
The job dialog shows the whole last output, read for the job (scrolled to its end, well past the list's 1,000-character preview):
When the per-job read fails, the dialog says what failed and what is shown instead, and keeps the list's preview:
A cut cron notification whose job's whole result could not be read (404): the notice under Fix with Crew says the text it sends is cut short (dark, then light):
The same notification when the read answers: no notice, and Fix with Crew sends the whole result:
Related Issues
Closes #24605
Sibling sweep
Swept: git grep -nE "last_result|last_error|"summary"|"trace"" -- src/kiro_crew/dashboard/handlers/
Sibling: src/kiro_crew/dashboard/handlers/cron_runs.py:366 -- not affected -- history reads are paged (at most 200 runs) and the store keeps a 200-character summary
Pattern harvest
Rule candidate: a preview of text the dashboard redacts is cut from the whole text's redaction (
_redact_for_display, which caches it), never redacted from a cut, because the redaction decides some matches from text past any cut.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)