Skip to content

Commit f92d48f

Browse files
committed
Merge branch 'main' of https://github.com/CopilotKit/OpenBot into claude/flat-rows-sections-8f2829
# Conflicts: # app/src/components/responsibilities/goal-page.tsx # app/src/components/routines/new-routine-page.tsx # app/src/components/routines/routine-page.tsx # app/src/components/suggestions/check-in-page.tsx
2 parents a415874 + 2243c7b commit f92d48f

34 files changed

Lines changed: 9584 additions & 1055 deletions

‎.github/workflows/ci.yml‎

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,22 +1159,54 @@ jobs:
11591159
REPOSITORY: ${{ github.repository }}
11601160
RUN_ID: ${{ github.run_id }}
11611161
RUN_ATTEMPT: ${{ github.run_attempt }}
1162+
# What failed, one line per job, from this attempt's jobs (every page, slurped). A job that
1163+
# stopped its run at its first failure is recorded as cancelled, and so is every job it
1164+
# stopped, `changes` included, so the results above cannot say which job it was: it is
1165+
# the cancelled job with a failed step, and the first such is named as the one that
1166+
# stopped the run. Left out, as consequences of an earlier failure: a job that started
1167+
# after the stop (only always() jobs start on a cancelled run), and `tests` when a shard
1168+
# did not pass, since its check is that every shard passed. A job's full name is one line,
1169+
# never split at its commas ("format, lint, types"). A run cancelled with no failed job
1170+
# says so, so it is not mistaken for a stop (scripts/verify-failures.test.ts).
1171+
NAME_FAILURES: |
1172+
def line: "\(.name) failed at \"\(.failed_at.name)\"";
1173+
[.[].jobs[]] as $jobs
1174+
| ([$jobs[] | select(any(.steps[]?; .conclusion == "failure"))
1175+
| . + {failed_at: first(.steps[] | select(.conclusion == "failure"))}]
1176+
| sort_by(.failed_at.completed_at)) as $failed
1177+
| any($jobs[]; (.name | startswith("tests (shard ")) and .conclusion != "success" and .conclusion != "skipped") as $shard_down
1178+
| [$failed[] | select(.name != "tests" or ($shard_down | not))] as $failed
1179+
| [$failed[] | select(.conclusion == "cancelled")] as $stoppers
1180+
| if ($stoppers | length) > 0 then
1181+
$stoppers[0] as $stop
1182+
| "Stopped the run: \($stop | line). Its log shows why; the jobs it stopped are marked cancelled.",
1183+
($failed[] | select(.name != $stop.name and .started_at <= $stop.failed_at.completed_at) | "Also failed: \(line).")
1184+
elif ($failed | length) > 0 then
1185+
$failed[] | "Failed: \(line)."
1186+
elif any($jobs[]; .conclusion == "cancelled") then
1187+
"No job failed: the run was cancelled from outside it, by a newer push, the merge queue or a person."
1188+
else empty end
11621189
run: |
11631190
set -euo pipefail
11641191
echo "$RESULTS"
11651192
if [ -n "$QUEUE_RUN" ]; then
11661193
echo "::notice::Tested in the merge queue: $QUEUE_RUN"
11671194
echo "Tested in the merge queue: $QUEUE_RUN" >> "$GITHUB_STEP_SUMMARY"
11681195
fi
1169-
# The jobs with a failed step, named first: a job that stopped its run at its first failure
1170-
# is recorded as cancelled, and so is every job it stopped, `changes` included.
1196+
# What failed, named before every red exit (NAME_FAILURES above says how), on the job and
1197+
# at the top of the run's summary.
11711198
name_failures() {
1172-
if ! failed=$(gh api --paginate "repos/$REPOSITORY/actions/runs/$RUN_ID/attempts/$RUN_ATTEMPT/jobs?per_page=100" \
1173-
--jq '.jobs[] | select(any(.steps[]?; .conclusion == "failure")) | .name'); then
1199+
local named line
1200+
if ! named=$(gh api --paginate "repos/$REPOSITORY/actions/runs/$RUN_ID/attempts/$RUN_ATTEMPT/jobs?per_page=100" \
1201+
| jq -rs "$NAME_FAILURES"); then
11741202
echo "::warning::Could not read this run's jobs to name the ones that failed."
1175-
elif [ -n "$failed" ]; then
1176-
echo "::error::Failed: $(echo "$failed" | paste -sd ',' - | sed 's/,/, /g'). Their logs show the step that failed."
1203+
return 0
11771204
fi
1205+
while IFS= read -r line; do
1206+
[ -n "$line" ] || continue
1207+
echo "::error::$line"
1208+
echo "- $line" >> "$GITHUB_STEP_SUMMARY"
1209+
done <<< "$named"
11781210
}
11791211
if [ "$CHANGES" != success ]; then
11801212
name_failures

‎app/src/components/channels/composer/composer.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
} from "react";
3131
import { attachmentModality } from "@/components/channels/chat-messages";
3232
import { IconWaveform } from "@/components/icons/waveform";
33+
import { TrialNote } from "@/components/plan/trial-note";
3334
import { useTouchTyping } from "@/hooks/use-touch-typing";
3435
import {
3536
attachmentAddress,
@@ -2092,6 +2093,8 @@ export function Composer({
20922093
</div>
20932094
</DictationSurface>
20942095
</form>
2096+
{/* Under the box once most of the free trial is used: components/plan/trial-note.tsx. */}
2097+
<TrialNote />
20952098
</div>
20962099
);
20972100
}
@@ -2191,6 +2194,7 @@ export function Composer({
21912194
</div>
21922195
</DictationSurface>
21932196
</form>
2197+
<TrialNote />
21942198
{/* The notice's invisible copy, below the box: see above. Hidden from everyone and inert. */}
21952199
<div
21962200
aria-hidden="true"

‎app/src/components/organizations/organization-settings-page.tsx‎

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ import {
7676
employeePaysForOthers,
7777
employeeTrialUsedUp,
7878
organizationNeedsCard,
79+
trialRunningLow,
7980
usePlan,
8081
} from "@/lib/plan/queries";
8182
import {
@@ -84,6 +85,7 @@ import {
8485
OTHERS_NEED_A_CARD,
8586
planSummary,
8687
trialUsed,
88+
WHEN_USED_UP,
8789
} from "@/lib/plan/words";
8890
import { cn } from "@/lib/utils";
8991
import { queryClient } from "@/query-client";
@@ -192,9 +194,10 @@ function NameRow({
192194
* divider, where no plan is needed or while it is read.
193195
*
194196
* On the free trial it shows how much of it is used, as a bar and a percentage
195-
* (`freeRunsUsedPercent`, the person's own share). Never a count or a limit: the server sends
196-
* neither while runs are left. A CopilotKit employee who has used it all keeps the full bar, with
197-
* the line that says their runs are free.
197+
* (`freeRunsUsedPercent`, the person's own share), and a line on what happens at 100%. Never a
198+
* count or a limit: the server sends neither while runs are left. From 80% used it offers the card
199+
* under the bar, where the server sent the way to add one (`addCardUrl`). A CopilotKit employee
200+
* who has used it all keeps the full bar, with the line that says their runs are free.
198201
*/
199202
function PlanRow() {
200203
const plan = usePlan();
@@ -211,15 +214,21 @@ function PlanRow() {
211214
{/* Level with the title, as beside a row's description. */}
212215
<ItemContent className="min-w-0">
213216
<ItemTitle>Plan</ItemTitle>
214-
<Progress className="mt-0.5 gap-x-3 gap-y-2" value={used}>
215-
<ProgressLabel className="font-normal text-muted-foreground text-xs">
217+
{/* The primitive's own bar, with the row's own text size. */}
218+
<Progress className="mt-1 gap-x-3 gap-y-2" value={used}>
219+
<ProgressLabel className="font-normal text-muted-foreground">
216220
Free trial
217221
</ProgressLabel>
218-
<ProgressValue className="text-xs">
222+
<ProgressValue className="text-foreground">
219223
{() => trialUsed(used)}
220224
</ProgressValue>
221225
</Progress>
222-
{employeeTrialUsedUp(plan) ? (
226+
{/* An employee's runs never pause: they get their own line once it is all used. */}
227+
{plan.copilotKitEmployee !== true ? (
228+
<ItemDescription className="mt-1.5 line-clamp-none">
229+
{WHEN_USED_UP}
230+
</ItemDescription>
231+
) : employeeTrialUsedUp(plan) ? (
223232
<ItemDescription className="mt-1.5 line-clamp-none">
224233
{COPILOTKIT_EMPLOYEE_LINE}
225234
</ItemDescription>
@@ -245,6 +254,21 @@ function PlanRow() {
245254
</a>
246255
</>
247256
) : null}
257+
{/*
258+
* Once most of it is used, where the server sent the way to add a card. Under the bar,
259+
* as the employee's button is, so the bar keeps its width in a narrow window.
260+
*/}
261+
{trialRunningLow(plan) && plan.addCardUrl ? (
262+
<a
263+
className={cn(
264+
buttonVariants({ size: "sm", variant: "outline" }),
265+
"mt-2 self-start",
266+
)}
267+
href={plan.addCardUrl}
268+
>
269+
{cardAction(plan)}
270+
</a>
271+
) : null}
248272
</ItemContent>
249273
</Item>
250274
</>

0 commit comments

Comments
 (0)