Skip to content

feat(website): add the project directory field to the cron job form - #17580

Closed
kyleseaman wants to merge 2 commits into
feat/cron-project-agentsfrom
feat/cron-project-form
Closed

kyleseaman wants to merge 2 commits into
feat/cron-project-agentsfrom
feat/cron-project-form

Conversation

@kyleseaman

@kyleseaman kyleseaman commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Frontend half of the #9201 takeover, by @mbajaj92. Stacked on #17554 (backend), which must land first. The two were split because together the review diff was 1,021,670 bytes, over the review lanes' 1,000,000-byte cap. This commit is @mbajaj92's website/ work from #9201, authored by them and unchanged. When squash-merging, keep the author attribution to mbajaj92 mbajaj.92@gmail.com.

Problem / Motivation

Goal: A scheduled job runs as the agent you picked -- or skips and says why -- and can use the agents a checkout ships.

A scheduled job names an agent. If that name stopped resolving, the job did not
fail — it ran under the default agent instead, and said nothing. The Schedule
page kept showing the name you picked, so a job could run as the wrong agent for
weeks and look green the whole time.

There was also no way to point a job at a checkout. A repo that ships its own
.kiro/agents/ could not lend those agents to a job, so the agent that knows a
repo was unreachable from the schedule.

Why it matters

Silent substitution is the worse half. A job that runs the wrong agent produces
plausible output, so nobody looks. The failure is invisible exactly when it
matters most — an unattended job, running while you are not there.

Not a goal

  • Changing how an UNBOUND chat session resolves its agent. The precedence change
    (a project's agent beats a same-named configured alias) does reach a chat slot
    that is bound to a directory; see Backwards compatibility.
  • Proving project-wins precedence on the KAS or Claude backends. It is established
    on kiro-cli, whose project-first lookup the change matches.
  • Any new agent-authoring surface. A job borrows the agents a checkout already
    ships; it does not create, edit or install one.

What changed (motivation → approach → change)

The backend half (#17554) adds a job's Project directory and resolves its agent against that checkout's .kiro/agents/. This PR is the form and page that expose it: the field on JobForm, a picker that merges the directory's agents with the configured ones (marking a genuine name collision and naming which definition runs), and the Schedule page's Last Error panel keeping a message job's named skip reason readable. A directory change never rewrites the agent pick: Save's resolver check refuses an agent the folder cannot resolve, and the form shows that refusal.

Area What changed there
website/src/components field, picker and selector; ProjectPicker gains a modal prop (a modal Radix Popover) so it works inside the schedule dialog -- a shared component, other callers unchanged
website/src/pages/SchedulePage.tsx the Last Error panel keeps its height (shrink-0) and uses proportional text for jobs without a script, so a message job's skip reason reads as prose
website/src/api the project-scoped roster call
website/src/hooks roster fetch
website/src/types the agent's scope
website/src/i18n copy, across all 13 catalogs

Backwards compatibility

Compatible: the field is optional and absent by default; an unbound job renders and saves exactly as before.

Removes nothing: no existing control or copy key is removed.

Tests

Frontend, in website/src/test/: the project row is the one offered, the marker
appears only on a genuine collision (not on every project row, and not on a
configured agent the directory never declared), its explanation renders as a
visible line naming the definition that runs, the selection is KEPT across a
directory switch, an emptied field and a failed or pending catalog -- Save sends
it and shows the backend's unknown_agent refusal under the Agent picker -- and a
roster fetch failure stays beside the field instead of becoming a form-wide error. The keep-the-pick
tests fail against the earlier form-side reset.

Manual verification

Walked the whole surface on an isolated gateway against two fixture checkouts —
one declaring a colliding agent plus a project-only one, one declaring a
different agent — covering the field, the merged picker, the collision marker,
the A→B directory switch, all three save rejections, and both fire-time skips (from #9201, on the same code).

Screenshots / video

Captured from the real JobForm and the real SchedulePage with only HTTP
responses stubbed, so no frame can show a state the shipped code would not
produce. Each frame was taken by a self-asserting harness that fails rather than writing
an image when the scene is wrong: both that the frame carries the shipped
sentence and that it carries none of the wording an earlier revision used — which
is what let frame 11 go stale once. Frames 4, 9 and 10 come from a harness that
also asserts the Save request carried the kept pick.

Those two harnesses are held back from this diff, not deleted. Every fork AI
review lane fetches git diff BASE...HEAD and fails closed above 1,000,000 bytes
with authentic diff exceeds 1 MB; failing closed (split the PR). With them
included this diff measured 1,033,169 bytes, so all six lanes exited at the fetch
step without reading a line, and the three that fail closed reported
review incomplete while the other three resolved permissively and looked like
verdicts. Dropping the six harness files — which nothing references, no gate
invokes, and vite.config.ts already excludes — brings it to 996,988. They come
back in a follow-up with a verify: entry, the form that makes them a standing
regression test rather than one-off evidence.

1. The field. Labelled Project directory, the same term the folder-settings
field uses. The helper line says what it does in plain words -- Folder this job
works in. Agents saved in this folder also appear in the Agent list below.
-- and
keeps .kiro/agents/ out of the always-visible text. The button reads Choose
folder…
so it no longer shares a name with the picker's own Browse tab.

01-project-directory-field

2. Choose directory…, on the Browse tab. The picker component is the one folder
settings already uses, so the two surfaces behave identically. It opens beside
the button rather than over it.

02-folder-picker-open

3. A bound directory's agents, merged into the picker, with a collision.
repo-smoke comes from the bound folder and says so with folder agent;
kirocrew is configured and carries no such marker (the pre-existing source badge
reads kirocrew on every row, which is what the real roster returns).
release-checklist exists both in the folder and as a saved agent, so the folder's
row is the one offered: its accent-toned chip reads folder's version, and the
line beneath names the winner and says nothing saved changes -- This job runs the
folder's release-checklist. Your saved one is unchanged.
The weaker folder agent
chip is suppressed on that row, since folder's version already entails it.

03-agent-picker-merged

4. The roster fetch failed. The notice stays beside the field, offers Retry,
and says the saved agents are still offered, so a folder that cannot be read
degrades the picker instead of blocking the form. The detail clause is dropped
when the error carries no prose message, rather than rendering bare punctuation.

05-roster-fetch-error

5. Save refuses a relative path, beside the field rather than form-wide.

06-save-error-absolute-path

6. Save refuses a protected system path. The verdict is the shared
resolve_project_path one, so the form and the fire path agree on what is
reachable.

07-save-error-sensitive-path

7. Save refuses a directory that does not exist, so a binding cannot be
stored in a state that would only fail later, unattended.

08-save-error-missing-dir

8. A directory switch keeps the pick. The job used repo-smoke from
release-tools; pointing it at docs-site, which does not define that agent,
leaves the pick as it is. The form cannot tell from its catalogs whether a name
resolves under a folder, so it does not guess.

09-switch-keeps-pick

9. Save decides. The backend's resolver refuses the name for that folder
with a 400 naming the agent and the folder. The form shows it under the Agent
picker, with Pick an agent from this folder., rather than under Save; picking
another agent clears it. The job is never stored with the default agent in place
of the pick.

10-save-refused

10. A fire refused because the directory shadows a Crew Member. The skip
reason renders in the Schedule page's Last Error panel, which keeps its height
and uses proportional text for a message job. The sentence names the shadowed member and both remedies,
because these skips spend no auto-pause strike and so this text is the only
signal there is.

11-last-error-member-shadowed

11. The ordinary unresolved-agent skip, naming the .kiro/agents/ convention
to add the file to rather than only the folder it is missing from -- so the
message carries a remedy and not just a diagnosis. The directory is named
possessively rather than by absolute path: last_error is readable by any
authenticated dashboard token, not only the owner, so the folder itself stays in
the operator's log line.

12-last-error-agent-missing

Related Issues

Part of #8952 (closed by the backend half, #17554)
Stacked on #17554
Supersedes the UI half of #9201 (author @mbajaj92)

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Check the fourth backend refusal: JobForm places save errors by matching three English project_path messages, so the data-home overlap error shows form-wide instead of beside the field.

Suggestions

  • Have the backend return a code for each project_path refusal, the way it already returns unknown_agent at dashboard/handlers/cron.py:1214, and have the form key on that code rather than on raw.includes('project_path must be an absolute path'). A wording change on the backend then can't quietly move the error.

[DESIGN-REVIEWED] 2422f20

Description read

[DESCRIPTION-READ] a2e72a998b76ecc2f2aef481db137d583de45d1a06cd24d7de73a258d8c5af0c

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 7, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — 🟡 CONCERNS

Premise-level review of 2422f206060541e08be362a9c4fe42b1d4db2387 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

The i18n tooling now hardcodes one example path as a pseudolocale exemption. Deleting the example from the copy is the smaller fix.

Not justified as shipped

  • Item 10 — undeclared: gen-pseudolocale.mjs and render-scan.mjs each gain /\/Users\/you\/projects\/myrepo/g, // canonical project-directory example path. That is a single literal special-cased into two shared scanners, and nothing outside the two strings this PR adds uses it. The description's file table never mentions either script.
    Subtraction: delete both PRESERVE/PRESERVED_REGIONS entries and the renderScan.test.ts assertion. Drop the (e.g. /Users/you/projects/myrepo) example from project_directory_must_be_an_absolute_path and project_directory_placeholder in every catalog.
    Clears when: the path literal is gone from the scanners and the copy, or the PR names a second string that needs the same exemption.

What this change ships

Inventory (10 items) — 9 justified

Intent: let a scheduled job point at a checkout and use the agents it ships, with the form showing which agent definition runs. This is an ADDITION.

  1. The job form has an optional Project directory field with a Choose folder… picker — justified
  2. The Agent list merges in the folder's agents, each marked "folder agent" — justified
  3. When a folder agent shares a name with a saved agent, its row says "folder's version" and names the one that runs — justified
  4. Saved agents the server dropped for a bound folder are hidden from the list — justified
  5. Changing the directory keeps the agent pick, and Save's unknown_agent refusal shows under the Agent picker — justified
  6. Save refusals for the directory path are reworded and shown beside the field — justified
  7. If the folder's agent list fails to load, an inline notice offers Retry — justified
  8. ProjectPicker gets a modal mode so it works inside the schedule dialog — justified
  9. The Last Error panel keeps its full height and shows a message job's skip reason as prose — justified
  10. The i18n scanners exempt one example path from pseudolocalization — undeclared

[FIRST-PRINCIPLES-REVIEWED] 2422f20

Description read

[DESCRIPTION-READ] fe63e65e629c90d61f1019e6397709e67119eefd90a801f35ac69ff3b419ed62

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — 🟡 CONCERNS

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

UX-Verdict: CONCERNS

The collision row says "Your saved one is unchanged" about an agent the picker never shows, and a directory switch keeps an invalid agent pick without saying anything until Save.

Watch

  • Collision hint points at a row the user can't see. The hint reads overrides_global_hint: "This job runs the folder's {{name}}. Your saved one is unchanged." That sounds reassuring, but the merge drops the saved row. The blind reader said: "I can't see my own 'release-checklist' listed anywhere, so I can't tell what I'd be giving up" (shot-03). This hits every name collision on a bound job, and it is the case the PR exists to explain. Fix: say what happens to the saved agent, e.g. "This job runs the folder's {{name}}. Your saved {{name}} can't be used while this folder is set."
  • An invalid pick shows no warning until Save. After switching to docs-site, repo-smoke stays picked with no notice (shot-08). Only Save shows the refusal (shot-09). The reader said: "it kept my pick without any warning… I can't tell whether it shows up when I press Save or on its own." This happens on every directory edit and costs a failed save. Fix: when the loaded folder roster doesn't list the current pick, show a muted line under Agent: "Save will check that this folder has repo-smoke."
  • "Folder" and "directory" mean the same thing on one field. The field uses "Project directory", the button "Choose directory…" and the helper "Folder this job works in". "Chat folder" sits further down the same form. The reader listed "folder means two things" and "Directory and folder are also used for the same thing." The PR says the button reads Choose folder…, but en.json ships "browse": "Choose directory…", so that claim doesn't match the shipped string. Fix: either ship "Choose folder…" as the PR describes, or update the description to match.

Suggestions

  • project_directory_must_be_an_absolute_path: replace the jargon. Suggested: "Enter the full path, starting with / (e.g. /home/you/projects/myrepo)." This also matches the /home/… paths used everywhere else.
  • AgentSelector folder-agent rows with no description repeat the name. Show "From this folder" in that line instead.

[UX-REVIEWED] 2422f20

Description read

[DESCRIPTION-READ] 84b254a3ab280a667d85804586365dfedc0fc828da05e7732d239aa8aace0e02

That sha256 names everything this verdict read: the PR description, plus the 14 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 7, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 2422f206060541e08be362a9c4fe42b1d4db2387 — this comment is updated in place on each push.

Review details

No findings that block the merge; two advisory issues in JobForm.tsx's save-error handling.

FINDING — website/src/components/JobForm.tsx:152 — isProjectPathError and friendlyProjectPathError only match three of the backend's four project_path refusals. The fourth is the macOS refusal for a directory that contains the data home (_PROJECT_PATH_OVERLAPS_DATA_HOME, "project_path overlaps Kiro Crew's protected voice runtime / data home", cron.py:2307). Picking a directory like ~ gets that refusal, which skips the directory field and appears as raw backend text, with the wire name project_path, in the notice at the foot of the form → Fix: match the overlap substring in both helpers and map it to a translated string.

FINDING — website/src/components/JobForm.tsx:995 — After an unknown_agent refusal, if the user fixes it by switching to a folder that does define the agent, the old notice stays under the Agent picker. It still names the previous folder and says to pick another agent. That happens because the directory input's onChange and the ProjectPicker onSelect (line 1243) only call setProjectPathSaveError(''), and agentSaveError is cleared only by pickAgent or the next submit → Fix: also call setAgentSaveErrorState('') in both directory-change handlers.

[OPUS-REVIEWED] 2422f20

Verdict parsed from the review's SHA-scoped output markers for commit 2422f206060541e08be362a9c4fe42b1d4db2387.

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

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 2422f206060541e08be362a9c4fe42b1d4db2387 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 2422f20

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

@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 7, 2026
@kyleseaman
kyleseaman force-pushed the feat/cron-project-agents branch from b49ce28 to cced20c Compare October 7, 2026 03:04
@kyleseaman
kyleseaman force-pushed the feat/cron-project-form branch from 6775a10 to c77096e Compare October 7, 2026 03:04
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 7, 2026
@kyleseaman
kyleseaman force-pushed the feat/cron-project-agents branch from cced20c to 522202f Compare October 7, 2026 15:54
@kyleseaman
kyleseaman force-pushed the feat/cron-project-form branch from d698236 to 048a119 Compare October 7, 2026 15:55
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 7, 2026
@kyleseaman
kyleseaman force-pushed the feat/cron-project-agents branch from 522202f to 5d46378 Compare October 7, 2026 17:02
@kyleseaman
kyleseaman force-pushed the feat/cron-project-form branch from 048a119 to 48d2105 Compare October 7, 2026 17:02
@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 readiness: checking Automated validation is still running labels Oct 7, 2026
@kyleseaman
kyleseaman force-pushed the feat/cron-project-form branch from 7c7d335 to 05d87f0 Compare October 14, 2026 14:02
@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 14, 2026
@kyleseaman
kyleseaman force-pushed the feat/cron-project-agents branch from 8d1f4a0 to 77692f9 Compare October 14, 2026 19:34
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

  • No sensitive path changed; nothing to check.

@kyleseaman
kyleseaman force-pushed the feat/cron-project-form branch from 05d87f0 to 9d4d991 Compare October 14, 2026 19:35
@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 labels Oct 14, 2026
@kyleseaman
kyleseaman force-pushed the feat/cron-project-agents branch from 77692f9 to ee8d824 Compare October 14, 2026 21:16
@kyleseaman
kyleseaman force-pushed the feat/cron-project-form branch from 9d4d991 to 015a16c Compare October 14, 2026 21:17
@kyleseaman
kyleseaman force-pushed the feat/cron-project-agents branch from ee8d824 to 19ec803 Compare October 14, 2026 21:44
@kyleseaman
kyleseaman force-pushed the feat/cron-project-form branch from 015a16c to fb4d67a Compare October 14, 2026 21:44
@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 14, 2026
@kyleseaman
kyleseaman force-pushed the feat/cron-project-agents branch from 19ec803 to 407ca28 Compare October 15, 2026 00:08
@kyleseaman
kyleseaman force-pushed the feat/cron-project-form branch from fb4d67a to 91a21df Compare October 15, 2026 00:08
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 15, 2026
@kyleseaman
kyleseaman force-pushed the feat/cron-project-agents branch from 407ca28 to bf2132f Compare October 15, 2026 13:00
@kyleseaman
kyleseaman force-pushed the feat/cron-project-form branch from 91a21df to 1a9122b Compare October 15, 2026 13:00
@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 labels Oct 15, 2026
@kyleseaman
kyleseaman force-pushed the feat/cron-project-agents branch from bf2132f to 3a6f741 Compare October 15, 2026 13:46
@kyleseaman
kyleseaman force-pushed the feat/cron-project-form branch from 1a9122b to 8161484 Compare October 15, 2026 13:46
mbajaj92 and others added 2 commits October 15, 2026 19:19
Frontend half of the cron project-binding work, split from the backend so
each review diff stays under the 1 MB lane cap: the Project directory field
and merged agent picker in JobForm, the collision marker, the reset notices,
locales, and their tests. Backend half: the parent PR in this stack.
…sion winner

A directory change no longer rewrites the agent pick. The form's catalogs
cannot tell whether a name resolves under a folder, so clearing on what they
omit discarded valid bindings and Save then stored the default agent. Save's
own resolver check already refuses an unresolvable agent with a 400 naming the
agent and folder, and the form shows it. Removes the reset notice and its two
catalog keys.

The collision row now says which definition runs ("This job runs the <name>
from this project's .kiro/agents/, not your global one.") and its chip is
warn-toned so it does not read as a source label.

Join the schedule directory picker to a modal Radix Popover so pointer,
focus and dismissal stay inside the dialog layer and keep its draft.
Standalone picker callers keep their existing layer behavior.

Co-authored-by: mbajaj92 <mbajaj.92@gmail.com>
@kyleseaman
kyleseaman force-pushed the feat/cron-project-agents branch from 3a6f741 to 627a6b0 Compare October 15, 2026 19:21
@iamwhatever

Copy link
Copy Markdown
Contributor

Thanks @kyleseaman and @mbajaj92. Closing together with #17554, which this PR is stacked on; see the note there. The need stays tracked in #8952, and a small PR on current main that lets the Schedule page pick a project's agents would be very welcome.

The branch is left untouched, so you can reopen this PR at any time, or open a fresh one on current main, if you want to pick it back up.

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