Skip to content

Fix Codex orchestration, task delivery, folder trust and quotas - #151

Closed
pepechka-kun wants to merge 22 commits into
howdeploy:mainfrom
pepechka-kun:codex/fix-codex-prompt-delivery
Closed

pepechka-kun wants to merge 22 commits into
howdeploy:mainfrom
pepechka-kun:codex/fix-codex-prompt-delivery

Conversation

@pepechka-kun

@pepechka-kun pepechka-kun commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex tasks could remain unsent, MCP tools disappear after thread changes, and worker replies be truncated or discarded during cleanup. Isolated folder trust and quota status also failed for API-backed profiles.

Changes:

  • Expose the enabled orchestration catalog and reconnect MCP helpers to the same authorized PTY launch, preserving identity and revocation checks.
  • Wait for the current empty composer before submitting initial, follow-up and plugin tasks with bracketed paste.
  • Save person-approved folder trust through the host's guarded API while keeping agent configuration writes blocked. Handle API authentication explicitly; optionally read subscription limits from an explicitly bound OmniRoute connection.
  • Preserve and page long worker replies; require an explicit complete result read before closing a completed child. Invalidate receipts on follow-up tasks; active children remain cancelable.
  • Return an immediate, owner-scoped closed receipt for a late wait after cleanup. Bound receipt retention to 256 children and retain no answer/output text; foreign or unknown IDs remain denied.

Validation:

  • Current PR CI and macOS native/package checks: all six checks passed on db0949c.
  • macOS typecheck, production build, native/package checks and secret audit passed. Focused orchestration tests and packaged-helper regressions passed; the earlier full suite passed 2,279 tests with four skips.
  • Installed macOS test: a Bypass Orchestrator on fixed Sol 6.1 created four Auto workers through Jev/OmniRoute. All 31 executor calls completed with HTTP 200 and one attempt each. Full replies arrived before cleanup; all four late waits returned closed, zero wait time and no answer/output. The guard file remained unchanged.
  • Earlier regressions cover real Codex MCP discovery across successive threads, folder trust, follow-up delivery, Unicode/paginated replies, masking, ownership and cancellation.

Problem: automated Codex tasks could reach startup menus, or remain pasted without submission because the paste-burst detector consumed Enter.
Solution: frame initial/follow-up prompts as bracketed paste and submit only after this launch's composer is ready; discard cancelled, timed-out or superseded input.

Preserve paste-only drafts and other providers. Regression tests cover multiline text, startup menus and restart races.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-16T18:00:53.835711Z db0949c Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e8e6cab3f7

ℹ️ 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 thread src/main/services/codexInput.ts Outdated
Problem: API-backed Codex profiles reject account/rateLimits/read, but HOME
reported this expected limitation as a generic protocol error and could keep
old subscription windows after switching profiles.

Solution: inspect structured account/read metadata without refreshing tokens,
report an explicit API-profile status in Russian and English, and clear old
quota windows. Preserve signed-out and genuine protocol failure statuses.

Validation: API-key and custom-provider cases, auth/protocol failures, profile
switching and actual HOME row rendering are covered. The real installed
Codex with the Jev API profile now returns api-profile.
@pepechka-kun pepechka-kun changed the title Fix Codex task submission and launch readiness Fix Codex task delivery and API-profile limits status Oct 15, 2026
Problem: automated task delivery timed out when Codex displayed an alternate built-in empty-composer placeholder.

Solution: recognize exact built-in placeholders while rejecting human drafts and startup gates. Exercise delivery through the terminal manager for every supported placeholder.

Validation: 65 focused launch/control tests, typecheck and secret audit passed.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2891dd0587

ℹ️ 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 thread src/main/services/codexInput.ts
Comment thread src/main/services/codexInput.ts Outdated
Comment thread src/main/services/LimitsService.ts Outdated
Andrey Naumkin added 2 commits October 15, 2026 18:03
Problem: built-in side-thread placeholders were missed; active MCP startup could accept tasks while final startup warnings blocked input.

Solution: cover the full native placeholder lists and gate only active Starting/Booting MCP states. Add delivery regressions for each transition.
Problem: a long-lived app-server kept stale API/ChatGPT provider metadata when config.toml changed without an account switch.

Solution: restart on configuration fingerprint changes and discard old quota windows, while reusing the child for unchanged configuration. Test both profile transitions with an unchanged login.

Validation: 87 focused input, lifecycle and account-scope tests passed; typecheck passed.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0140f4a786

ℹ️ 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 thread src/main/services/codexInput.ts Outdated
Comment thread src/main/services/codexInput.ts Outdated
Andrey Naumkin added 2 commits October 15, 2026 18:31
Problem: transcript suggestions could hide a person's current draft, while wrapped or clipped placeholders stalled narrow terminals.

Solution: inspect the last composer, reconstruct soft-wrapped rows and accept clipped prefixes only with Codex placeholder styling. Cover both delivery paths with real xterm states.
Problem: API-backed Codex profiles cannot report the ChatGPT subscription quota used behind OmniRoute.

Solution: explicitly bind a local gateway connection and read its real usage through the installed CLI. Validate provider/active state, preserve real windows, exclude review quotas from the model gauge and never copy OAuth credentials or substitute another local account.

Validation: live connection quota read and HOME rendering passed; 100 focused integration tests and typecheck passed.
@pepechka-kun pepechka-kun changed the title Fix Codex task delivery and API-profile limits status Fix Codex task delivery and API-profile quota reporting Oct 15, 2026
Problem: macOS GUI launches inherit a restricted PATH, so the OmniRoute npm CLI could not find Node even though CanvasTTY resolved Codex.

Solution: pass the existing resolved CLI child environment to quota reads and cover a restricted GUI PATH. Typecheck and the quota integration suite passed.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: daea420c9f

ℹ️ 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 thread src/main/services/OmniRouteCodexLimits.ts Outdated
Comment thread src/main/services/TerminalManager.ts Outdated
Andrey Naumkin added 2 commits October 15, 2026 19:29
Problem: isolated Codex could not save the folder-trust decision because its config.toml is protected from agent writes.

Solution: confirm new local folders in the authenticated CanvasTTY UI and save only their trust through the host's Codex API, with a version check and private backup. Reuse the bounded RPC transport; keep agent settings and backup access blocked.

Validation: full suite passed (2210 passed, 4 skipped); focused trust/protection tests, typecheck, packaged macOS smoke and secret audit passed. Real Codex on a temporary profile retained trust across launches and reached its composer under CanvasTTY isolation without a trust/persist error.
Problem: OmniRoute quota reset times used seconds where HOME expects milliseconds, and a cached composer-ready flag could submit a later human draft or menu.

Solution: retain epoch milliseconds and keep readiness only for an automation-owned paste-only draft. Submitted tasks and person input require a fresh composer check.

Validation: 45 focused quota, HOME and Codex delivery tests passed, including countdown semantics, later drafts/menus and person edits to automation drafts.
@pepechka-kun pepechka-kun changed the title Fix Codex task delivery and API-profile quota reporting Fix Codex task delivery, folder trust and quota reporting Oct 15, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1e4ee3fe96

ℹ️ 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 thread src/main/services/CodexFolderTrust.ts Outdated
Comment thread src/main/services/CodexFolderTrust.ts Outdated
Comment thread src/main/services/LimitsService.ts Outdated
Andrey Naumkin added 2 commits October 15, 2026 20:54
Empty user layers can arrive as JSON text, and symlinked profile paths fail lexical matching. Decode object layers and use canonical config paths for guarded trust writes and backups; reject alias changes during confirmation.

Validation: serialized and malformed layers, fresh and trusted aliases, canonical backups and alias changes. Installed Codex 0.162.1 persisted trust across repeated temporary-profile launches.
API-profile polls discarded successful gateway quotas, hiding them on timeout or malformed replies. Preserve the last gateway snapshot as stale, clearing it on profile changes or revoked connections.

Validation: CLI success, timeout, malformed response, recovery and source-isolation regressions. Full suite: 2232 passed, 4 skipped; typecheck, production build and secret audit passed.
@pepechka-kun

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3d09039635

ℹ️ 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 thread src/main/services/codexInput.ts Outdated
Comment thread src/main/services/OmniRouteCodexLimits.ts Outdated
Require dim styling for every nonempty Codex placeholder, including material handoffs, so matching user drafts are never submitted. Treat malformed provider listings as protocol failures and retain the stale quota snapshot. Cover both contracts with regression tests.
@pepechka-kun

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f3f296b890

ℹ️ 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 thread src/main/services/TerminalManager.ts
Comment thread src/main/services/codexInput.ts Outdated
Comment thread src/main/ipc/registerIpc.ts
Plugin sends now wait for the Codex composer and bracket task text. Ignore startup phrases in completed transcript while retaining live footer gates. Route person-initiated history launches through the host trust confirmation and recheck cards after confirmation. Add regressions for startup delivery, transcript quotes, trust refusal and closed cards.
@pepechka-kun

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 745f82661f

ℹ️ 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 thread src/main/ipc/registerIpc.ts
Comment thread src/main/services/CodexFolderTrust.ts Outdated
Comment thread src/main/services/LimitsService.ts Outdated
Comment thread src/main/services/materials/HandoffService.ts Outdated
Ranked MCP search could omit explicitly named coordination tools and make an orchestrator report them unavailable. Attach the enabled canvastty_agents catalog directly with Codex's per-server deferred-exposure setting; retain browser discovery and all permission checks.

Add allowlist regressions and a real-Codex synthetic smoke with deferred, direct, restricted and empty catalogs. Validation: 2242 tests passed, 4 skipped; typecheck, build, secret audit and all four Codex 0.162.1 smoke cases passed. A real source-level CanvasTTY run verified Sol 6.1 -> MCP -> Auto worker over Jev/OmniRoute, pwd, completed wait and cleanup.
@pepechka-kun pepechka-kun changed the title Fix Codex task delivery, folder trust and quota reporting Fix Codex orchestration, task delivery, folder trust and quotas Oct 16, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 12525f8644

ℹ️ 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 thread src/main/ipc/registerIpc.ts
Restored Codex cards could bypass host trust, concurrent approvals could write stale configuration versions, account changes could reuse gateway quotas, and wrapped startup menus could accept material tasks.

Check trust before local restore and hold untrusted families; serialize host trust writes per canonical profile while retaining version checks; discard cross-account quota caches and in-flight gateway results; unwrap the screen before handoff readiness checks. Add regression coverage for each boundary.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cb3a4cbccb

ℹ️ 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 thread src/main/services/CodexFolderTrust.ts Outdated
Andrey Naumkin added 6 commits October 16, 2026 11:00
Any launch option skipped host trust, so isolated Codex could not persist trust even when the plugin kept the local profile.

Compare the prepared configuration path before spawning, retain person-scoped trust guards for launch/restart/history, and use read-only trust checks for restoration. Hold descendants until their contributed parent's check finishes. Add coverage for profile identity, isolation ordering, refusal, cancellation and delegation boundaries.
A first launch could fail before sign-in or confirmation because the profile directory did not exist. Create the directory privately before starting app-server and recheck its canonical path; approval remains required to persist folder trust.

Add first-launch approval/refusal regressions; verify both decisions and persisted trust with native Codex in temporary profiles.
New threads start another helper with the same PTY bootstrap capability,
which was rejected after the first helper consumed it. Let bootstrap join
only the same healthy authenticated launch, as the browser bridge does.
Share its reconnect capability so later joins do not strand earlier
helpers. Disconnected, stale, foreign and revoked launches stay rejected.

Add JS/native helper regressions for discovery, scoped worker creation
and cleanup, plus gateway identity, expiry and reconnect checks.
Stop hooks kept only 4K characters, and redaction could cut the beginning
again. Capture up to 64K, mask the whole reply, and return bounded MCP
pages. Refuse closing a child with unread pages and omit duplicate screen
output. Keep decision/status limits unchanged and align control responses.

Cover JS/native hook-to-MCP delivery, escaping, masking expansion, page
ordering, ownership, turn changes, close protection and control-client size.
Short replies returned by wait could be discarded before get_agent_result, leaving later reads outside the subtree. Require an explicit current-result receipt before closing, reset it on follow-up tasks and preserve immediate cancellation of working children. Cover short replies, identical follow-up answers and JS/native MCP parity.
A redundant wait after successful result collection and cleanup returned a subtree error and could be misreported as a failed earlier wait. Keep bounded owner-scoped closure receipts without retaining answers, return closed immediately, and guide orchestration to stop waiting after cleanup. Test read-before-close receipts, active cancellation, foreign/unknown IDs, eviction and JS/native MCP behavior.
@pepechka-kun

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Failed to sample tokens
ℹ️ 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".

@pepechka-kun

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Failed to sample tokens
ℹ️ 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".

@pepechka-kun

Copy link
Copy Markdown
Contributor Author

Superseded by independently tested, single-commit PRs from current main:

All original fixes are covered, and the combined branches were verified locally. Closing this accumulated PR to keep review focused. Historical discussion, branches and commits remain available here; working installations were not changed.

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