Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions docs/system-specs/modules/crew-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -2563,14 +2563,16 @@ says what wakes it ("Wakes when a task reports back, or every 15 min", the
loop's interval in short unit words, so a translation reads `15 分ごと`, never
`15mごと`); line three is the facts a person acts on -- last check (or
"Has not checked yet"), "Next in" only while the next due time is still
ahead (a late loop promises nothing), and the open-item count from the masked
crew-board read (`GET /api/crew-board`, omitted while unread or when the slot
owns no ledger, a 404 that is not retried). A stopped patrol replaces last/next
with one phrase: "You paused it" (`manual` / `user_stop`), "Hit its 7d time
limit" (`runtime_budget`), "Hit its check limit" (`cycle_cap`), "Stopped while
waiting for your approval" (`approval_stalled` / `approval_stall`), "Its chat
was closed" (`session_close`), and the plain "Stopped" for every other code,
never the raw value. A stop that is a FAILURE
ahead (a late loop promises nothing; "Next in 13 min", the same short unit
words the schedule rows' countdowns use, so ja reads `次回は13 分後`), and
the open-item count from the masked crew-board read (`GET /api/crew-board`,
omitted while unread or when the slot owns no ledger, a 404 that is not
retried). A stopped patrol replaces last/next with one phrase: "You paused
it" (`manual` / `user_stop`), "Hit its 7 days time limit" (`runtime_budget`,
the limit in short unit words too), "Hit its check limit" (`cycle_cap`),
"Stopped while waiting for your approval" (`approval_stalled` /
`approval_stall`), "Its chat was closed" (`session_close`), and the plain
"Stopped" for every other code, never the raw value. A stop that is a FAILURE
(`session_start_failures`, `session_unavailable`: "It could not start a check";
`structural_terminal`, `model_refused`, `interrupted_cycle`,
`consecutive_failures`: "Its last check failed"; `sentinel_dropped`,
Expand Down
2 changes: 1 addition & 1 deletion website/scripts/capture-crewmate-panel-ia.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ async function captureScheduleVariant(frame, file, expected) {
'Last check 2m ago', 'Next in 1', '3 tasks open', 'Pause', 'Your schedules',
])
await captureScheduleVariant('ledger-stopped', '02d-card-schedules-patrol-paused-light.png', [
'Watching its tasks', 'Paused', 'Hit its 7d time limit', '3 tasks still open', 'Resume',
'Watching its tasks', 'Paused', 'Hit its 7 days time limit', '3 tasks still open', 'Resume',
])
await browser.close()
await new Promise((resolve) => srv.close(resolve))
Expand Down
2 changes: 1 addition & 1 deletion website/src/i18n/en.context.json
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@
"pages.membersPage.patrol_wakes": "Second line of that row: the Bot wakes when one of its tasks reports back, and otherwise at most every {{interval}} (a duration in unit words, like '15 min' or '1 hr 30 min').",
"pages.membersPage.patrol_pause": "Verb on a button: pause the Bot's watch over its tasks. Not the noun.",
"pages.membersPage.patrol_resume": "Verb on a button: resume a paused watch. Not the noun.",
"pages.membersPage.patrol_stopped_runtime": "One-phrase reason the watch stopped: it ran up to its time budget of {{limit}} (a short duration like '7d').",
"pages.membersPage.patrol_stopped_runtime": "One-phrase reason the watch stopped: it ran up to its time budget of {{limit}} (a duration in unit words, like '7 days').",
"pages.membersPage.patrol_stopped_cycles": "One-phrase reason the watch stopped: it did as many checks as it was allowed.",
"components.markdownPanel.select_any_text_or_drag_across_an_image_to_add_i": "One-time tip at the top of the file viewer, shown only when the device has a mouse or trackpad: the reader can select text, or drag a box across an image, to add comments, then send them to the chat together. On a touch-only device the text-only tip shows instead.",
"components.commentOverlay.comment_on_the_boxed_area": "Accessible name of the text field in the comment box for a box drawn on an image in the file viewer (also opened by the keyboard 'Comment on this image' button). It parallels the text composer's 'Comment on the selected text', so the field and its 'Add comment' button never read the same; 'boxed area' is the part of the image inside the drawn box.",
Expand Down
20 changes: 15 additions & 5 deletions website/src/pages/members/CrewOnItsOwn.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen, fireEvent, within } from '@testing-library/react'
import { cleanup, render, screen, fireEvent, within } from '@testing-library/react'
// `/all` for the Japanese catalog: `../../i18n` registers English only.
import { i18next } from '../../i18n/all'
import type { LegacyGoalLoop, StructuredMonitor } from '../../monitoring/automation'
Expand Down Expand Up @@ -76,7 +76,7 @@ describe('CrewOnItsOwn', () => {
expect(row).toHaveTextContent('Watching its tasks')
expect(row).toHaveTextContent('Wakes when a task reports back, or every 15 min')
const facts = within(row).getByTestId('crew-patrol-facts')
expect(facts).toHaveTextContent('Last check 2m ago · Next in 13m · 3 tasks open')
expect(facts).toHaveTextContent('Last check 2m ago · Next in 13 min · 3 tasks open')
const toggle = within(row).getByTestId('crew-patrol-toggle')
expect(toggle).toHaveTextContent('Pause')
fireEvent.click(toggle)
Expand All @@ -91,6 +91,16 @@ describe('CrewOnItsOwn', () => {
expect(row).toHaveTextContent('タスクから報告があったとき、または15 分ごとに起動します')
})

it('says the next check and the time limit in unit words inside the Japanese sentence (#35442)', async () => {
onTestFinished(() => i18next.changeLanguage('en'))
await i18next.changeLanguage('ja')
const { row } = setup()
expect(within(row).getByTestId('crew-patrol-facts')).toHaveTextContent('次回は13 分後')
cleanup()
const stopped = setup({ loop: { ...LOOP, active: false, stoppedReason: 'runtime_budget', nextDueAt: 0 } }).row
expect(within(stopped).getByTestId('crew-patrol-facts')).toHaveTextContent('7 日の時間制限に達しました')
})

it('shows none of the budget bookkeeping the Profile readout used to, and leaks no prompt or path', () => {
const { row } = setup()
const text = row.textContent ?? ''
Expand All @@ -109,11 +119,11 @@ describe('CrewOnItsOwn', () => {

it('an unknown open count and a patrol that never checked read as such', () => {
const { row } = setup({ loop: { ...LOOP, lastFireAt: 0 }, openTasks: null })
expect(within(row).getByTestId('crew-patrol-facts')).toHaveTextContent(/^Has not checked yet · Next in 13m$/)
expect(within(row).getByTestId('crew-patrol-facts')).toHaveTextContent(/^Has not checked yet · Next in 13 min$/)
})

it.each([
['runtime_budget', 'Hit its 7d time limit'],
['runtime_budget', 'Hit its 7 days time limit'],
['cycle_cap', 'Hit its check limit'],
['manual', 'You paused it'],
['user_stop', 'You paused it'],
Expand Down Expand Up @@ -153,7 +163,7 @@ describe('CrewOnItsOwn', () => {
it('a failed open-task count is said under the row, and the facts carry no count', () => {
const { row } = setup({ openTasks: null, countFailed: true })
expect(screen.getByTestId('crew-patrol-count-error')).toHaveTextContent('Could not count its open tasks.')
expect(within(row).getByTestId('crew-patrol-facts')).toHaveTextContent(/^Last check 2m ago · Next in 13m$/)
expect(within(row).getByTestId('crew-patrol-facts')).toHaveTextContent(/^Last check 2m ago · Next in 13 min$/)
})

it('a write in flight disables the control; a refused write shows as an error notice', () => {
Expand Down
20 changes: 17 additions & 3 deletions website/src/pages/members/CrewScheduleList.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { describe, it, expect, vi } from 'vitest'
import { describe, it, expect, vi, onTestFinished } from 'vitest'
import { render, screen, fireEvent, within } from '@testing-library/react'
// `/all` for the Japanese catalog: `../../i18n` registers English only.
import { i18next } from '../../i18n/all'
import CrewScheduleList from './CrewScheduleList'
import type { CronJob } from '../../types'

Expand Down Expand Up @@ -103,7 +105,7 @@ describe('CrewScheduleList rows', () => {
job({ id: 'late', name: 'late', next_run_ts: NOW - 300 }),
])
const byName = rowByName
expect(byName('soon')).toHaveTextContent(/Next in 1h.*30m/)
expect(byName('soon')).toHaveTextContent(/Next in 1 hr.*30 min/)
expect(byName('paused')).not.toHaveTextContent(/Next in/)
expect(byName('late')).not.toHaveTextContent(/Next in/)
})
Expand All @@ -120,7 +122,19 @@ describe('CrewScheduleList rows', () => {
const next = screen.getByTestId('crew-schedule-next')
expect(next).toHaveTextContent('Up next')
expect(next).toHaveTextContent('sooner')
expect(next).toHaveTextContent('Runs in 10m')
expect(next).toHaveTextContent('Runs in 10 min')
})

it('says the countdowns in unit words inside the Japanese sentences (#35442)', async () => {
onTestFinished(() => i18next.changeLanguage('en'))
await i18next.changeLanguage('ja')
setup([
job({ id: 'a', name: 'sooner', next_run_ts: NOW + 13 * 60 }),
job({ id: 'b', name: 'later', next_run_ts: NOW + 90 * 60 }),
])
expect(screen.getByTestId('crew-schedule-next')).toHaveTextContent('13 分後に実行')
expect(rowByName('sooner')).toHaveTextContent('次回は13 分後')
expect(rowByName('later')).toHaveTextContent('次回は1 時間30 分後')
})

it('has no Up next card when nothing enabled is due', () => {
Expand Down
4 changes: 3 additions & 1 deletion website/src/pages/members/CrewScheduleList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export function inDuration(remaining: number): string {
const h = Math.floor((remaining % 86400) / 3600)
const m = Math.floor((remaining % 3600) / 60)
const parts: Array<[number, 'day' | 'hour' | 'minute']> = d > 0 ? [[d, 'day'], [h, 'hour']] : h > 0 ? [[h, 'hour'], [m, 'minute']] : [[Math.max(m, 1), 'minute']]
return fmtDuration(parts, { dropZero: true })
// `short`, not fmtUnit's narrow default: it sits inside a sentence, where ja
// reads `13 分後`, not `13m後`.
return fmtDuration(parts, { dropZero: true, unitDisplay: 'short' })
}

function lastRunFailed(job: CronJob): boolean {
Expand Down
Loading