Skip to content

Resume goals after quota recovery - #113

Merged
merefield merged 3 commits into
mainfrom
feat/goal-quota-resume
Nov 19, 2026
Merged

merefield merged 3 commits into
mainfrom
feat/goal-quota-resume

Conversation

@merefield

Copy link
Copy Markdown
Owner

Why

When Codex stops a goal for quota, a scheduled message such as “continue” does not resume the native goal. This adds an explicit, one-shot action without treating arbitrary slash commands as scheduled prompts.

Behaviour

  • Terminal and writable web: choose Resume after quota recovery in /goal when the goal is active or usage-limited. It uses the existing scheduled follow-up slot, leaves the composer available, and can be cancelled there.
  • For an active goal, wait for Codex to report a quota stop, then for a newer quota reading. For an already stopped goal, wait for a new reading after arming. Dispatch requires available quota, the original account and goal, and an eligible idle shared app-server session. Never redeem a reset or buy credits.
  • Disarm on a known goal/account change or cancellation; defer on inconclusive data. Keep the queue in memory, and never retry an uncertain write. The README, slash-command guide and intro post cover these behaviours and the daemon’s lack of an atomic conditional goal update.

Validation

  • Full Go suite; targeted race-enabled scheduler, app-server and control tests.
  • Svelte checks and two targeted Chromium scheduler regressions.
  • Production duplication gate passed against the existing baseline.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A critical active issue prevents goal resumes from being dispatched, leaving armed triggers pending indefinitely after quota recovery.

1 open issue
What changed in this PR

Adds a one-shot Resume after quota recovery workflow for native Codex goals across terminal and writable web controls, with quota observation, account and goal validation, cancellation, documentation, localization, and tests.

Changes:

  • Added goal-resume scheduling and guarded native app-server dispatch.
  • Updated terminal, web, generated frontend, localization, and documentation surfaces.
  • Added scheduler, control-path, app-server, and browser coverage.
  • Critical issue: the internal resume dispatch cannot claim its queued job, so the native resume callback is never invoked.
File Description
web/​tests/​browser.spec.ts Adds browser coverage for cancelling goal-resume triggers while preserving composer content.
web/​src/​SessionActions.svelte Renders goal-resume actions while keeping the composer available.
web/​src/​contracts.generated.ts Adds scheduled goal-resume fields to the generated browser contracts.
README.md Documents goal-resume behavior, safeguards, and limitations.
intro-post.md Introduces the quota-recovery goal-resume workflow.
internal/​web/​schedules.go Reports goal-resume state and integrates shared goal polling.
internal/​web/​dist/​index.html Points the embedded web application to the rebuilt frontend bundle.
internal/​web/​dist/​assets/​index-D8GWc666.js Removes the superseded embedded frontend bundle.
internal/​web/​control_commands.go Arms and disarms goal-resume triggers through reviewed web commands.
internal/​web/​control_commands_test.go Tests web goal-resume arming, confirmation, and replay protection.
internal/​ui/​monitor_schedule.go Integrates goal-resume polling into terminal scheduling.
internal/​ui/​monitor_schedule_toggle.go Hides ordinary scheduling controls while a goal trigger occupies the slot.
internal/​ui/​monitor_schedule_panel.go Displays goal-trigger status and cancellation controls.
internal/​ui/​monitor_queue.go Displays goal-resume entries in the terminal follow-up queue.
internal/​ui/​monitor_prompt.go Prevents goal triggers from replacing ordinary composer scheduling hints.
internal/​ui/​monitor_commands.go Arms and disarms goal-resume triggers through terminal commands.
internal/​schedule/​queue.go Adds goal-trigger state and dispatch handling to the in-memory queue.
internal/​schedule/​goal_resume.go Implements goal-resume arming, polling, validation, disarming, and dispatch.
internal/​schedule/​goal_resume_test.go Tests stop detection, quota freshness, disarming, slot conflicts, and uncertainty.
internal/​i18n/​locales/​zh-Hans.json Adds Simplified Chinese goal-resume strings.
internal/​i18n/​locales/​tr.json Adds Turkish goal-resume strings.
internal/​i18n/​locales/​sv.json Adds Swedish goal-resume strings.
internal/​i18n/​locales/​ru.json Adds Russian goal-resume strings.
internal/​i18n/​locales/​pt-PT.json Adds European Portuguese goal-resume strings.
internal/​i18n/​locales/​pt-BR.json Adds Brazilian Portuguese goal-resume strings.
internal/​i18n/​locales/​nl.json Adds Dutch goal-resume strings.
internal/​i18n/​locales/​nb.json Adds Norwegian goal-resume strings.
internal/​i18n/​locales/​ja.json Adds Japanese goal-resume strings.
internal/​i18n/​locales/​it.json Adds Italian goal-resume strings.
internal/​i18n/​locales/​fr.json Adds French goal-resume strings.
internal/​i18n/​locales/​fi.json Adds Finnish goal-resume strings.
internal/​i18n/​locales/​et.json Adds Estonian goal-resume strings.
internal/​i18n/​locales/​es.json Adds Spanish goal-resume strings.
internal/​i18n/​locales/​en-GB.json Adds English goal-resume strings.
internal/​i18n/​locales/​de.json Adds German goal-resume strings.
internal/​i18n/​locales/​da.json Adds Danish goal-resume strings.
internal/​codex/​session_queue.go Generalizes live-session capability lookup.
internal/​codex/​session_queue_unix.go Uses subscribed connections for native queue access.
internal/​codex/​session_goal_unix.go Recognizes the goal-resume command path.
internal/​codex/​session_goal_unix_test.go Tests native goal identity, account, idle-state, and write validation.
internal/​codex/​session_goal_resume.go Defines goal-resume targets, interfaces, and errors.
internal/​codex/​session_goal_resume_unix.go Implements account checks, observation, preflight, and native goal resumption.
internal/​codex/​session_goal_commands_unix.go Adds the reviewed goal-resume command choice and guarded execution.
internal/​codex/​session_commands.go Adds shared command digesting and goal-resume success messaging.
internal/​codex/​session_commands_unix.go Keeps the virtual goal-resume action out of direct RPC execution.
internal/​codex/​daemon_status_unix.go Provides subscribed connection lookup for goal operations.
docs/​slash-command-support.md Documents /goal resume-after-quota support and local trigger semantics.

Review effort: Lite

Comment thread internal/schedule/queue.go Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human review is warranted because delayed cross-layer native goal writes involve quota freshness, reconnects, concurrent mutations, and scheduler races that cannot be fully validated without atomic server-side updates and live shared-app-server testing.

No open issues 🎉

1 resolved since last review

Review effort: Lite

@merefield
merefield merged commit 15fa5ce into main Nov 19, 2026
9 checks passed
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.

2 participants