Skip to content

FEAT: support session goals and live goal status - #94

Merged
merefield merged 3 commits into
mainfrom
feat/session-goals
Nov 4, 2026
Merged

merefield merged 3 commits into
mainfrom
feat/session-goals

Conversation

@merefield

@merefield merefield commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Why

Codex can pursue a session goal across turns, but Codexometer previously offered neither /goal controls nor a reliable indication of whether pursuit was active, paused, stalled or limited. This adds goal support through the shared app-server, without guessing goal state from inactivity or conflating it with turn/approval status.

Changes

Shared goal adapter

  • Read and observe session-specific goals using thread/goal/get, thread/goal/updated and thread/goal/cleared, with periodic snapshot reconciliation.
  • Bound background reconciliation to four workers and one shared 500 ms response budget, after publishing core telemetry. Deferred goals remain stale and retain polling priority; newer runtime/goal notifications cannot be overwritten by timeout fallback.
  • Support /goal, /goal <objective>, /goal edit, /goal pause, /goal resume and /goal clear, plus a total token-budget editor (/goal budget <integer|unlimited>).
  • Preserve native edit semantics and retained budgets. Set/resume can start work immediately; pause/clear do not interrupt an already-running turn.
  • Keep mutations guarded by default, scoped to the selected loaded session, freshly revalidated and verified after acknowledgment. Never automatically retry an uncertain mutation. Existing --no-confirm policy applies.
  • Handle unsupported servers, failed observations, reconnects, session closure and racing notifications without resurrecting cleared goals or presenting stale state as verified.
  • Keep typed objective/budget reviews out of the in-memory catalogue cache; ordinary goal menus retain normal cached browsing.

Terminal and web presentation

  • Keep /goal compact: one non-selectable state/objective overview, explicit Create/Edit/Replace choices, short action-specific guidance, and separate current/proposed values in confirmation reviews. Completed menu labels navigate correctly rather than becoming objective text.
  • Add official goal labels, including PURSUING GOAL, GOAL STALLED and paused/limited/complete states, independently of WORKING, approval and TURN COMPLETE.
  • Place goal status immediately below configured statusline fields in terminal session telemetry; place it right-aligned on the full-detail bottom border before COPY, preserving button geometry and prioritising controls on narrow screens.
  • Reflect per-session goal status beneath row metadata and alongside full-detail footer controls in web mode. Read-only web mode remains read-only.
  • Goals stay attached to their actual root session rather than being merged from linked agents.
  • Add terminal labels for all 17 supported locales and update README, intro post and command-support inventory.
  • Regenerate embedded frontend assets. No dependency or maintained-version change.

Validation

  • Full Go race/coverage suite, with the complete 17-locale rendering matrix run separately.
  • Goal RPC lifecycle, session isolation, budget/Unicode limits, fresh confirmation, semantic drift, stale reads, clear/close races and no-retry regressions using synthetic local app-server fixtures.
  • Repeated race tests cover 256 stalled sessions, bounded worker count/shared deadline, continued core telemetry, healthy/deferred batches, cancellation/disconnect cleanup and preservation of newer goal/runtime notifications.
  • Terminal startup/update/clear, responsive footer/COPY hit-target and nested goal-input review regressions; goal layout tests also run natively on Windows.
  • Explicit sanitised, capability-free web projection tests.
  • Svelte/TypeScript/format checks and production frontend build.
  • All 108 browser tests, including read-only responsive placement and guarded goal objective/budget/pause/resume/clear controls.
  • go vet ./... and git diff --check.

Goal observation/control requires a loaded, goal-enabled shared app-server. Unsupported/file-only modes do not invent goal state. Codexometer adds no local goal persistence; Codex remains authoritative. No live user goals were created or modified during testing.

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 finding remains: synchronous goal refreshes can serialize up to 2-second RPC timeouts across many sessions, severely delaying Fetch and live telemetry.

1 open issue
What changed in this PR

Adds session-goal support backed by the shared app-server, with guarded /goal commands, authoritative live status, terminal and web presentation, localization, documentation, and regenerated frontend assets.

Changes:

  • Adds goal observation, reconciliation, lifecycle mutations, budget editing, validation, stale-state handling, and post-mutation verification.
  • Displays goal states independently from turn, approval, and working status in terminal and web interfaces.
  • Adds browser, Go, projection, concurrency, localization, and responsive-layout coverage.
  • Updates documentation, command support inventory, and embedded frontend assets.

Review findings:

  • Critical — internal/codex/session_goal_unix.go:106: Synchronous goal refreshes can serialize up to a two-second timeout per subscribed session, delaying telemetry for hundreds of seconds. Use concurrent reads or a shared deadline. (1 vote)
  • Moderate — internal/codex/session_goal_unix.go:47: The 256-entry observation cache silently drops later sessions, leaving live goal status incorrect and causing repeated refresh attempts. Evict unsubscribed entries or provide an explicit fallback. (1 vote)
  • Moderate — internal/codex/session_goal_commands_unix.go:63: Browser maxlength counts UTF-16 code units while backend validation counts UTF-8 runes, preventing valid objectives containing more than 2,048 astral characters. Use rune-aware client-side validation or adjust the advertised limit. (1 vote)
  • Moderate — internal/ui/monitor_commands_inline.go:122: Direct root forms such as /goal Finish the report and /goal pause do not reach the goal-input branch while root suggestions are open. Handle root queries directly. (1 vote)
  • Nit — internal/ui/monitor_commands.go:683: The Goal updated. notice bypasses localization despite translations existing in every locale. Use i18n.Text. (1 vote)
File Description
web/​tests/​browser.spec.ts Adds browser coverage for goal display, responsive placement, and guarded commands.
web/​src/​StatusLine.svelte Renders goal status in the web status line.
web/​src/​state.svelte.ts Adds frontend session-goal state types.
web/​src/​Sessions.svelte Displays goals in session rows and detail footers.
web/​src/​SessionCopy.svelte Supports compact copy-control placement.
web/​src/​SessionCommands.svelte Adds goal command input and review handling.
web/​src/​GoalStatus.svelte Provides web goal-status presentation and stale styling.
README.md Documents goal commands, states, limits, and semantics.
intro-post.md Documents the user-facing goal workflow and presentation.
internal/​web/​state.go Projects sanitized goal telemetry into web snapshots.
internal/​web/​session_goal_test.go Tests isolated, sanitized, read-only goal projection.
internal/​web/​dist/​index.html References regenerated frontend assets.
internal/​web/​dist/​assets/​index-DiPYjudz.css Removes the superseded stylesheet bundle.
internal/​web/​dist/​assets/​index-CqJz1WRL.css Adds regenerated goal-status and compact-footer styles.
internal/​web/​control_commands.go Adds goal mutation success messaging.
internal/​ui/​monitor.go Places goal status beneath terminal telemetry fields.
internal/​ui/​monitor_statusline.go Integrates goal status with terminal footer geometry.
internal/​ui/​monitor_goal.go Implements terminal goal rendering and footer layout.
internal/​ui/​monitor_goal_test.go Tests goal ordering, stale handling, layout, and hit targets.
internal/​ui/​monitor_context.go Places goal status before full-detail footer controls.
internal/​ui/​monitor_commands.go Adds goal reviews, navigation, and result handling.
internal/​ui/​monitor_commands_inline.go Supports inline goal command input and review paths.
internal/​ui/​model.go Stores and synchronizes per-session goals.
internal/​i18n/​locales/​zh-Hans.json Adds Simplified Chinese goal labels and messaging.
internal/​i18n/​locales/​tr.json Adds Turkish goal labels and messaging.
internal/​i18n/​locales/​sv.json Adds Swedish goal labels and messaging.
internal/​i18n/​locales/​ru.json Adds Russian goal labels and messaging.
internal/​i18n/​locales/​pt-PT.json Adds European Portuguese goal labels and messaging.
internal/​i18n/​locales/​pt-BR.json Adds Brazilian Portuguese goal labels and messaging.
internal/​i18n/​locales/​nl.json Adds Dutch goal labels and messaging.
internal/​i18n/​locales/​nb.json Adds Norwegian Bokmål goal labels and messaging.
internal/​i18n/​locales/​ja.json Adds Japanese goal labels and messaging.
internal/​i18n/​locales/​it.json Adds Italian goal labels and messaging.
internal/​i18n/​locales/​fr.json Adds French goal labels and messaging.
internal/​i18n/​locales/​fi.json Adds Finnish goal labels and messaging.
internal/​i18n/​locales/​et.json Adds Estonian goal labels and messaging.
internal/​i18n/​locales/​es.json Adds Spanish goal labels and messaging.
internal/​i18n/​locales/​en-GB.json Adds English goal labels and messaging.
internal/​i18n/​locales/​de.json Adds German goal labels and messaging.
internal/​i18n/​locales/​da.json Adds Danish goal labels and messaging.
internal/​codex/​session_settings_unix_test.go Extends app-server fixtures for goal RPC behavior.
internal/​codex/​session_prompt_unix.go Clears goal state when sessions close.
internal/​codex/​session_goal.go Defines goal state, labels, cloning, usage, and command helpers.
internal/​codex/​session_goal_unix.go Implements goal observation, notifications, reconciliation, and command normalization.
internal/​codex/​session_goal_unix_test.go Tests lifecycle, isolation, stale reads, races, validation, and no-retry behavior.
internal/​codex/​session_goal_test.go Tests labels, cloning, linked-session isolation, bounds, and cache policy.
internal/​codex/​session_goal_commands_unix.go Implements goal menus, validation, mutations, confirmation, and verification.
internal/​codex/​session_commands.go Extends command-path validation for goal inputs and budgets.
internal/​codex/​session_commands_unix.go Registers and dispatches the goal command family.
internal/​codex/​session_command_cache.go Keeps typed goal reviews out of the catalogue cache.
internal/​codex/​live_usage.go Carries root-session goals into live usage snapshots.
internal/​codex/​daemon_status.go Adds goals to daemon status snapshots.
internal/​codex/​daemon_status_unix.go Tracks goal observations, notifications, subscriptions, and refreshes.
docs/​slash-command-support.md Marks /goal as implemented in the command inventory.

Review effort: Lite

Comment thread internal/codex/session_goal_unix.go Resolved
@merefield
merefield merged commit e2c2679 into main Nov 4, 2026
6 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