Skip to content

Freshcodex contract foundation: canonicalize fresh-agent pane identity and stabilize full suite#334

Merged
danshapiro merged 86 commits into
devfrom
freshcodex-contract-foundation
May 10, 2026
Merged

Freshcodex contract foundation: canonicalize fresh-agent pane identity and stabilize full suite#334
danshapiro merged 86 commits into
devfrom
freshcodex-contract-foundation

Conversation

@danshapiro
Copy link
Copy Markdown
Owner

Summary

Boundary-complete identity stabilization for fresh-agent/freshcodex panes across 20 enforcement boundaries, plus provider-aware create/resume and settings normalization.

Core contracts:

  • fresh-agent is the canonical production pane kind; legacy agent-chat is normalized at every ingress boundary
  • Portable durable identity (sessionRef) is the only identity published across devices; runtime handles (sessionId, resumeSessionId, serverInstanceId) are stripped at publication boundaries
  • Claude-backed panes use modelSelection and opaque effort strings; Codex panes use runtime model/sandbox
  • Single Claude durable-ID grammar across shared, client, and server code
  • restoreError suppresses auto-create; nonportable named aliases produce explicit restore errors
  • Fresh-agent create payloads carry sessionRef, modelSelection, and opaque effort through the full WS pipeline
  • Codex create/resume returns durable sessionRef; Claude returns sessionRef only from canonical metadata
  • Settings thunks strip own undefined properties; agentChat/freshAgent aliases mirror correctly

Verification:

  • 1052+ targeted tests pass across 37 client/server test suites
  • Typecheck, lint (0 errors), build, git diff --check all clean
  • Coordinated full suite: 352/353 files pass (1 pre-existing unrelated flake)

Dan Shapiro added 30 commits May 9, 2026 13:51
@danshapiro danshapiro force-pushed the freshcodex-contract-foundation branch from 3c02c46 to 0e67ac4 Compare May 9, 2026 20:52
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

sessionRef: desiredResumeContent.kind === 'agent-chat' ? desiredResumeContent.sessionRef : undefined,
sessionMetadataByKey: buildSessionMetadataByKey(),

P2 Badge Store tab sessionRef for fresh-agent tabs

When opening a fresh-agent session tab, this condition still checks for desiredResumeContent.kind === 'agent-chat', so sessionRef is dropped for the new tab. Fallback matching logic (buildTabFallbackLocator) relies on tab.sessionRef for non-Claude sessions when a layout is temporarily unavailable, so this omission can cause duplicate tab creation or missed session matching during early hydration/repair flows.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +71 to +73
const created = input.resumeSessionId && registration.adapter.resume
? await registration.adapter.resume(input)
: await registration.adapter.create(input)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Resume fresh-agent sessions when only sessionRef is present

The create path only calls adapter.resume when resumeSessionId is set, but this commit also makes durable identity primarily sessionRef (and persisted panes strip legacy resumeSessionId). For restored Freshcodex panes that have sessionRef but no resumeSessionId, this branch falls back to adapter.create, starting a brand-new thread instead of reopening the durable one, so users lose continuity after reload/rehydration.

Useful? React with 👍 / 👎.

@danshapiro danshapiro merged commit ac8c886 into dev May 10, 2026
1 check 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.

1 participant