diff --git a/openspec/changes/archive/2026-11-16-ea-7-failure-reason-per-cause/design.md b/openspec/changes/archive/2026-11-16-ea-7-failure-reason-per-cause/design.md
new file mode 100644
index 0000000..d638c87
--- /dev/null
+++ b/openspec/changes/archive/2026-11-16-ea-7-failure-reason-per-cause/design.md
@@ -0,0 +1 @@
+Решение: cookie `ea_fail` хранит «причина:число» (час). Подсказка «ещё раз» — только если причина совпала и число ≥ 2. Для `setup` при повторе вместо `.button` рендерится `.link`.
diff --git a/openspec/changes/archive/2026-11-16-ea-7-failure-reason-per-cause/proposal.md b/openspec/changes/archive/2026-11-16-ea-7-failure-reason-per-cause/proposal.md
new file mode 100644
index 0000000..f6b561a
--- /dev/null
+++ b/openspec/changes/archive/2026-11-16-ea-7-failure-reason-per-cause/proposal.md
@@ -0,0 +1,3 @@
+# EA-7: причина сбоя и смена подсказки при повторе
+
+Причины сбоя и повторная подсказка появились в EA-3. Здесь доделано: повтор считается только по той же причине; при незавершённой настройке владельца кнопка подключения заменяется скромной ссылкой «Всё равно попробовать ещё раз».
diff --git a/openspec/changes/archive/2026-11-16-ea-7-failure-reason-per-cause/tasks.md b/openspec/changes/archive/2026-11-16-ea-7-failure-reason-per-cause/tasks.md
new file mode 100644
index 0000000..f34ebce
--- /dev/null
+++ b/openspec/changes/archive/2026-11-16-ea-7-failure-reason-per-cause/tasks.md
@@ -0,0 +1,3 @@
+- [x] Счёт неудач по причине
+- [x] Ссылка вместо кнопки при повторной настройке владельца
+- [x] Тексты ru/kk/en, тесты, спека
diff --git a/openspec/specs/calendar-connection/spec.md b/openspec/specs/calendar-connection/spec.md
index c8ba319..c823715 100644
--- a/openspec/specs/calendar-connection/spec.md
+++ b/openspec/specs/calendar-connection/spec.md
@@ -144,6 +144,12 @@
- **GIVEN** подключение уже один раз не удалось по той же причине
- **WHEN** оно не удаётся снова
- **THEN** руководитель видит другой текст, который не предлагает просто повторить
+- **AND** если причина в настройке владельца, вместо кнопки подключения остаётся скромная ссылка «Всё равно попробовать ещё раз»
+
+#### Scenario: Другая причина не считается повтором
+- **GIVEN** предыдущая неудача была по другой причине
+- **WHEN** подключение не удаётся снова
+- **THEN** руководитель видит обычную подсказку для новой причины, а не повторную
#### Scenario: Успешное подключение после неудачи
- **GIVEN** предыдущая попытка не удалась
diff --git a/src/app.tsx b/src/app.tsx
index 80db2bc..240ad58 100644
--- a/src/app.tsx
+++ b/src/app.tsx
@@ -19,7 +19,7 @@ export type AppDeps = {
const CONNECTION_COOKIE = "ea_conn";
const STATE_COOKIE = "ea_state";
const LANG_COOKIE = "ea_lang";
-/** Сколько раз подряд подключение не удалось (час): после второго раза подсказка другая. */
+/** Причина и число неудач подряд, «setup:2» (час): после второго раза по той же причине подсказка другая. */
const FAIL_COOKIE = "ea_fail";
const HOUR_SECONDS = 60 * 60;
const YEAR_SECONDS = 365 * 24 * 60 * 60;
@@ -28,6 +28,11 @@ const CALLBACK_PATH = "/auth/google/callback";
type Env = { Variables: { locale: Locale } };
+function readFailures(raw: string | undefined): { notice: string | null; count: number } {
+ const [notice, count] = (raw ?? "").split(":");
+ return { notice: notice || null, count: Number.parseInt(count ?? "", 10) || 0 };
+}
+
function firstHeaderValue(value: string | undefined): string | undefined {
return value?.split(",")[0]?.trim() || undefined;
}
@@ -112,14 +117,14 @@ export function createApp(deps: AppDeps) {
if (!connection) {
const param = c.req.query("notice");
const notice = NOTICES.find((name) => name === param) ?? null;
- const failures = Number.parseInt(getCookie(c, FAIL_COOKIE) ?? "", 10) || 0;
+ const last = readFailures(getCookie(c, FAIL_COOKIE));
const sample = isMock ? await loadSample() : null;
return c.html(
= 2}
+ repeated={notice !== null && last.notice === notice && last.count >= 2}
sample={sample}
/>,
);
@@ -175,8 +180,9 @@ export function createApp(deps: AppDeps) {
/** Запоминает неудачу и ведёт на главную с причиной; счёт нужен для другой подсказки. */
const fail = (notice: Notice) => {
- const failures = (Number.parseInt(getCookie(c, FAIL_COOKIE) ?? "", 10) || 0) + 1;
- setCookie(c, FAIL_COOKIE, String(failures), cookieOptions(c, HOUR_SECONDS));
+ const last = readFailures(getCookie(c, FAIL_COOKIE));
+ const count = last.notice === notice ? last.count + 1 : 1;
+ setCookie(c, FAIL_COOKIE, `${notice}:${count}`, cookieOptions(c, HOUR_SECONDS));
return c.redirect(`/?notice=${notice}`);
};
diff --git a/src/locales/en.json b/src/locales/en.json
index ca7a450..1adf05f 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -10,6 +10,7 @@
"connect.readonly": "EA only reads your calendar and never changes anything in it.",
"connect.button": "Connect Google Calendar",
"reconnect.button": "Connect the calendar again",
+ "reconnect.anyway": "Try again anyway",
"notice.denied": "The calendar is not connected. To see your plans, allow EA to read your calendar.",
"notice.failed": "The calendar could not be connected. Please try connecting it again.",
"notice.failed.again": "The calendar still could not be connected. Wait a few minutes and try again; if that does not help, tell the product owner.",
diff --git a/src/locales/kk.json b/src/locales/kk.json
index 4906eb8..10efae6 100644
--- a/src/locales/kk.json
+++ b/src/locales/kk.json
@@ -10,6 +10,7 @@
"connect.readonly": "EA күнтізбені тек оқиды және онда ештеңені өзгертпейді.",
"connect.button": "Google күнтізбесін қосу",
"reconnect.button": "Күнтізбені қайта қосу",
+ "reconnect.anyway": "Бәрібір қайталап көру",
"notice.denied": "Күнтізбе қосылмады. Істерді көру үшін EA-ға күнтізбені оқуға рұқсат беріңіз.",
"notice.failed": "Күнтізбені қосу мүмкін болмады. Оны қайта қосып көріңіз.",
"notice.failed.again": "Күнтізбені қайта қосу мүмкін болмады. Бірнеше минут күтіп, қайталап көріңіз; көмектеспесе, өнім иесіне хабарлаңыз.",
diff --git a/src/locales/ru.json b/src/locales/ru.json
index 5f121d3..a431121 100644
--- a/src/locales/ru.json
+++ b/src/locales/ru.json
@@ -10,6 +10,7 @@
"connect.readonly": "EA только читает календарь и ничего в нём не меняет.",
"connect.button": "Подключить календарь Google",
"reconnect.button": "Подключить календарь заново",
+ "reconnect.anyway": "Всё равно попробовать ещё раз",
"notice.denied": "Календарь не подключён. Чтобы видеть дела, разрешите EA чтение календаря.",
"notice.failed": "Не удалось подключить календарь. Попробуйте подключить его заново.",
"notice.failed.again": "Подключить календарь снова не получилось. Подождите несколько минут и попробуйте ещё раз; если не поможет, сообщите владельцу продукта.",
diff --git a/src/styles.ts b/src/styles.ts
index 561e2a7..d2f9e91 100644
--- a/src/styles.ts
+++ b/src/styles.ts
@@ -38,6 +38,7 @@ p { margin: 0 0 12px; }
.note.error { background: var(--err-bg); color: var(--err-text); }
.note.error.inline { margin: 20px 0 0; border-left: 4px solid currentColor; font-weight: 600; }
.note.error.inline + .button { margin-top: 12px; }
+.link { display: inline-block; margin-top: 4px; color: var(--accent); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
section.sample { margin-top: 32px; padding-top: 20px; border-top: 1px dashed var(--line); }
section.sample > h2 { font-size: 18px; margin: 0 0 4px; }
diff --git a/src/views.tsx b/src/views.tsx
index 7d79167..3a4c117 100644
--- a/src/views.tsx
+++ b/src/views.tsx
@@ -70,9 +70,15 @@ export function ConnectPage(props: {
{t(locale, props.repeated ? `notice.${notice}.again` : `notice.${notice}`)}
)}
-
- {t(locale, notice ? "reconnect.button" : "connect.button")}
-
+ {notice && props.repeated && notice === "setup" ? (
+
+ {t(locale, "reconnect.anyway")}
+
+ ) : (
+
+ {t(locale, notice ? "reconnect.button" : "connect.button")}
+
+ )}
{props.sample && (
diff --git a/test/app.test.ts b/test/app.test.ts
index d505c80..4c72278 100644
--- a/test/app.test.ts
+++ b/test/app.test.ts
@@ -209,6 +209,17 @@ describe("calendar-connection / Понятная причина неудачи",
expect(first).toContain("ещё не настроено до конца");
expect(second).toContain("Повторные попытки не помогут");
expect(second).not.toBe(first);
+ expect(second).toContain("Всё равно попробовать ещё раз");
+ expect(second).not.toContain("Подключить календарь заново");
+ });
+
+ it("Scenario: Другая причина не считается повтором", async () => {
+ const { client } = stubGoogle();
+ const visitor = browser(appWith(client));
+ await failOnce(visitor, client, new GoogleError("invalid_client", { kind: "setup" }));
+ const text = await failOnce(visitor, client, new GoogleError("no token", { kind: "consent" }));
+ expect(text).toContain("Google не передал нужное разрешение");
+ expect(text).not.toContain("по-прежнему");
});
it("Scenario: Успешное подключение после неудачи", async () => {