mirror of
https://github.com/openai/codex.git
synced 2026-11-26 07:26:11 +00:00
[1 of 2] Align goal extension with core behavior (#26547)
## Stack 1. [#26547](https://github.com/openai/codex/pull/26547) - [1 of 2] Align goal extension with core behavior 2. [#26548](https://github.com/openai/codex/pull/26548) - [2 of 2] Move goal runtime to extension ## Why The goal runtime is moving out of `codex-core` and into `codex-goal-extension`. This first PR brings the extension back in line with the current core behavior before the follow-up PR switches app-server sessions over to the extension, so that review can focus on ownership and wiring rather than hidden behavior drift. ## What Changed - Updates the extension `create_goal` and `update_goal` tool schemas/descriptions to match the current core wording for explicit token budgets, blocked-goal audits, resumed blocked goals, and system-owned budget/usage-limit transitions. - Marks `codex-goal-extension` as the live `/goal` extension crate rather than an unwired sketch. - Looks up the live thread before reading goal state for idle continuation, so continuation setup exits early when no live thread can accept the automatic turn.
This commit is contained in:
1 parent
78eba34b41
commit
a8c9530911
4 files changed
+62
-21
No files matched your search
@@ -124,7 +124,19 @@ impl GoalService {
|
||||
.map_err(GoalServiceError::InvalidRequest)?;
|
||||
}
|
||||
|
||||
if let Some(runtime) = self.runtime_for_thread(thread_id)
|
||||
let runtime = self.runtime_for_thread(thread_id);
|
||||
// Hold this through the prepare/write window so idle continuation cannot
|
||||
// launch from goal state that this external mutation is about to change.
|
||||
let _goal_state_permit = match runtime.as_ref() {
|
||||
Some(runtime) => Some(
|
||||
runtime
|
||||
.goal_state_permit()
|
||||
.await
|
||||
.map_err(GoalServiceError::Internal)?,
|
||||
),
|
||||
None => None,
|
||||
};
|
||||
if let Some(runtime) = runtime.as_ref()
|
||||
&& let Err(err) = runtime.prepare_external_goal_mutation().await
|
||||
{
|
||||
tracing::warn!("failed to prepare external goal mutation: {err}");
|
||||
@@ -229,7 +241,19 @@ impl GoalService {
|
||||
state_db: &codex_state::StateRuntime,
|
||||
thread_id: ThreadId,
|
||||
) -> Result<bool, GoalServiceError> {
|
||||
if let Some(runtime) = self.runtime_for_thread(thread_id)
|
||||
let runtime = self.runtime_for_thread(thread_id);
|
||||
// Hold this through the prepare/write window so idle continuation cannot
|
||||
// launch from goal state that this external mutation is about to change.
|
||||
let goal_state_permit = match runtime.as_ref() {
|
||||
Some(runtime) => Some(
|
||||
runtime
|
||||
.goal_state_permit()
|
||||
.await
|
||||
.map_err(GoalServiceError::Internal)?,
|
||||
),
|
||||
None => None,
|
||||
};
|
||||
if let Some(runtime) = runtime.as_ref()
|
||||
&& let Err(err) = runtime.prepare_external_goal_mutation().await
|
||||
{
|
||||
tracing::warn!("failed to prepare external goal mutation: {err}");
|
||||
@@ -242,6 +266,8 @@ impl GoalService {
|
||||
.map_err(|err| {
|
||||
GoalServiceError::Internal(format!("failed to clear thread goal: {err}"))
|
||||
})?;
|
||||
drop(goal_state_permit);
|
||||
drop(runtime);
|
||||
|
||||
if cleared
|
||||
&& let Some(runtime) = self.runtime_for_thread(thread_id)
|
||||
|
||||
Reference in new issue
Block a user