Skip to content

feat(events): add evented execution timelines#181

Open
sozercan wants to merge 15 commits into
mainfrom
contract
Open

feat(events): add evented execution timelines#181
sozercan wants to merge 15 commits into
mainfrom
contract

Conversation

@sozercan

@sozercan sozercan commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • Expands the original shared execution event contract into the full P0 evented runtime: event taxonomy, severity/stream normalization, store/API/worker DTOs, fixtures/fakes, and redaction/truncation rules for public payloads.
  • Adds durable SQLite execution event persistence with per-task sequence allocation, session-level cursors, indexed list/latest/delete operations, concurrency coverage, cleanup on task/session deletion, and low-cardinality execution event metrics.
  • Wires eventing end-to-end through controller, API, and workers: controller lifecycle events, an internal worker submission endpoint guarded by current-task service-account auth, public task/session event list APIs, and SSE streams with after resume, heartbeats, reconnect safety, and terminal task completion frames.
  • Instruments AI and agent runtime workers with best-effort events for worker lifecycle, model requests/messages, context truncation, tool calls, workspace preparation, runtime commands, result submission, and artifact upload outcomes.
  • Adds operator/user surfaces for session timelines, task trace read models, checkpoint-based task forking with sanitized provenance context, durable approval read/decision flows, and CLI commands for events, follow, trace, fork, approvals, approve, and decline.
  • Documents the endpoints, ordering/resume semantics, redaction caveats, metrics, troubleshooting guidance, P0 operator notes, post-P0 checklist, and harness protocol preparation.

Notable behavior

  • Task streams are persisted as (namespace, streamType=task, streamID=<task>, seq); session timelines are derived read models with separate stable session cursors.
  • Public event payloads are sanitized before persistence and returned only through redacted/truncated API and SSE responses; metrics intentionally avoid task names, session names, event IDs, tool call IDs, and other high-cardinality labels.
  • Worker event submission is best-effort and forbidden from writing terminal task events or approval decision events; controller-owned paths record terminal lifecycle events and user approval decisions.
  • Task SSE streams close with a stream_complete frame on terminal task events, while session SSE streams remain open because sessions can receive future task events.
  • Task forking validates the requested checkpoint and creates a new Task with provenance annotations and bounded sanitized context; it does not clone a workspace snapshot.

Validation

  • make lint-fix
  • make test
  • go test ./internal/events ./internal/store ./internal/store/sqlite -run ExecutionEvent -v
  • go test ./internal/api -run 'ExecutionEvent|SubmitExecutionEvent|Task.*Events|Session.*Events|Stream|Reconnect|Trace|Fork|Approval' -v
  • go test ./internal/controller -run 'Task.*Event|ExecutionEvent' -v
  • go test ./workers/common -run 'Event|RunAgent.*Event|AgentRuntime.*Event' -v
  • go test ./workers/ai -run Event -v
  • $autoreview / .agents/skills/autoreview/scripts/autoreview --mode local completed cleanly on the stacked eventing slices.
  • PR feat(events): add evented execution timelines #181 GitHub checks are passing, including Go lint/tests, UI lint/tests, Docusaurus build, live agent/Copilot/GitHub OIDC/security E2E, agent-substrate E2E, and repository monitor smoke checks.

Copilot AI review requested due to automatic review settings June 11, 2026 20:13

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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR introduces the Wave 0 shared execution event contract, establishing the foundational type system, validation logic, redaction/truncation rules, store interfaces, API DTOs, and worker-side recorder abstractions for task execution timeline events.

Changes:

  • Added event taxonomy (types, severities, stream type), normalization, validation, and redaction/truncation contract in internal/events.
  • Added store-facing ExecutionEvent/filter/store interfaces with an in-memory fake implementation, API DTOs with store-to-DTO conversion, and worker EventRecorder with no-op/fake implementations.
  • Added reusable fixture timelines for downstream testing and Wave 0/Wave 1 development documentation.
Show a summary per file
File Description
internal/events/execution_event.go Defines Wave 0 event type constants, severity constants, stream type, and validation/normalization helpers
internal/events/redaction.go Implements redaction (secrets), truncation (size limits), and sanitization for event payloads
internal/events/execution_event_test.go Tests for event taxonomy, severity normalization, and redaction/truncation logic
internal/store/execution_event.go Store-facing ExecutionEvent struct, ExecutionEventFilter, ExecutionEventStore interface, and in-memory fake
internal/store/execution_event_test.go Tests for store filter normalization, validation, append/list/delete operations
internal/api/execution_event_dto.go API DTOs for event submission, response, and list response; store-to-DTO conversion
internal/api/execution_event_dto_test.go Tests for DTO serialization, conversion, sanitization, and fixture validation
workers/common/event_recorder.go Worker-side EventRecorder interface, no-op and fake implementations, event option helpers
workers/common/event_recorder_test.go Tests for fake and no-op event recorders
internal/testdata/execution-events/*.json Fixture timelines for basic, tool-using, and failed task scenarios
docs/development/execution-events-wave-0.md Documents dependency graph and Wave 1 issue slicing

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 13/13 changed files
  • Comments generated: 2

Comment thread internal/events/execution_event.go
Comment thread internal/events/execution_event.go
@sozercan sozercan changed the title [codex] wave 0 shared execution event contract feat(events): add wave 0 execution event contract Jun 11, 2026
@sozercan sozercan marked this pull request as ready for review June 11, 2026 20:28
Copilot AI review requested due to automatic review settings June 11, 2026 20:28
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
@sozercan sozercan changed the title feat(events): add wave 0 execution event contract feat(events): add shared execution event contract Jun 11, 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: 5138ba7ffa

ℹ️ 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 internal/events/redaction.go Outdated
Comment thread internal/store/execution_event.go

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.

Copilot's findings

  • Files reviewed: 13/13 changed files
  • Comments generated: 2

Comment thread internal/events/execution_event.go
Comment thread internal/events/execution_event.go
Copilot AI review requested due to automatic review settings June 12, 2026 02:45

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.

Copilot's findings

  • Files reviewed: 13/13 changed files
  • Comments generated: 2

Comment thread internal/api/execution_event_dto.go
Comment thread internal/api/execution_event_dto_test.go
Copilot AI review requested due to automatic review settings June 12, 2026 03:11

@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: ca397cf119

ℹ️ 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 internal/events/redaction.go

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.

Copilot's findings

  • Files reviewed: 13/13 changed files
  • Comments generated: 4

Comment thread internal/store/execution_event.go
Comment thread internal/api/execution_event_dto.go Outdated
Comment thread workers/common/event_recorder_test.go Outdated
Comment thread internal/store/execution_event.go
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Merge PR #182 into contract after stacked PRs #183, #184, and #187 landed, checks passed, and review threads were clear.

Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Copilot AI review requested due to automatic review settings June 12, 2026 11:23

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.

Copilot's findings

Files not reviewed (1)
  • api/v1alpha1/zz_generated.deepcopy.go: Generated file
  • Files reviewed: 59/60 changed files
  • Comments generated: 3

Comment thread cmd/cli/events.go
Comment thread internal/controller/task_controller.go Outdated
Comment thread cmd/cli/events.go

@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: 89fbd4aaa9

ℹ️ 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 internal/api/internal_execution_event_handlers.go Outdated
Comment thread workers/ai/main.go
Comment thread workers/ai/main.go
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Copilot AI review requested due to automatic review settings June 13, 2026 17:28

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.

Copilot's findings

Files not reviewed (1)
  • api/v1alpha1/zz_generated.deepcopy.go: Generated file
  • Files reviewed: 77/78 changed files
  • Comments generated: 2

Comment thread website/sidebars.js
Comment thread internal/api/internal_execution_event_handlers.go

@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: 79b066cc9e

ℹ️ 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 internal/api/task_trace_handlers.go Outdated
Comment thread internal/controller/task_controller.go Outdated
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>

@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: 4137624387

ℹ️ 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 internal/api/execution_event_handlers.go Outdated
Comment thread internal/harness/mapper.go Outdated
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Copilot AI review requested due to automatic review settings June 13, 2026 19:13

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.

Copilot's findings

Files not reviewed (1)
  • api/v1alpha1/zz_generated.deepcopy.go: Generated file
Comments suppressed due to low confidence (4)

workers/ai/main.go:1

  • firstNonEmpty is duplicated identically in workers/common/event_recorder_http.go (line 230). Since the workers/ai package already imports workers/common, consider removing this local copy and using common.firstNonEmpty (after exporting it), or extracting it to a shared utility. The same applies to eventContent (line 1010) which mirrors agentRuntimeEventContent in workers/common/agent_runtime.go (line 818). Having two copies means bug fixes or behavioral changes must be applied in both places.
    workers/ai/main_test.go:1
  • The _ = req assignment is unnecessary—Go does not require suppressing unused-variable warnings for function parameters. If req is not used in the function body, rename it to _ to match the first parameter's style. If it is intended for future use, simply remove the _ = req line.
    internal/store/sqlite/sqlite.go:1
  • The rowid fallback on line 638 (used when session_seq = 0) is from a different numeric namespace than logical session sequences. If a database has existing events with session_seq = 0 and large rowid values, the backfill will seed latest_seq with those rowid values, causing future session sequences to start at unexpectedly high numbers. Consider using COUNT(*) over the session's events or 0 as the fallback instead of rowid, so the post-migration sequence allocator starts from a predictable baseline.
    workers/ai/main_test.go:1
  • assertEventTypesPresent is functionally identical to assertRecordedEventTypes in workers/common/agent_runtime_test.go (line 60). While test helpers in different _test packages can't be shared directly, consider extracting this into a shared test helper package (e.g., workers/common/testutil) to avoid maintaining two copies of the same assertion logic.
  • Files reviewed: 78/79 changed files
  • Comments generated: 1

Comment thread internal/api/fork_handlers.go Outdated

@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: eb419bc35f

ℹ️ 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 internal/api/approval_handlers.go Outdated
Comment thread internal/api/fork_handlers.go Outdated
sozercan added 2 commits June 13, 2026 13:41
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Copilot AI review requested due to automatic review settings June 13, 2026 20:06

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.

Copilot's findings

Files not reviewed (1)
  • api/v1alpha1/zz_generated.deepcopy.go: Generated file
  • Files reviewed: 78/79 changed files
  • Comments generated: 2

Comment thread docs/development/harness-protocol-mvp.md Outdated
Comment thread workers/ai/main.go Outdated
sozercan added 2 commits June 13, 2026 14:17
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Copilot AI review requested due to automatic review settings June 13, 2026 20:24

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.

Copilot's findings

Files not reviewed (1)
  • api/v1alpha1/zz_generated.deepcopy.go: Generated file
  • Files reviewed: 78/79 changed files
  • Comments generated: 2

Comment thread internal/harness/mapper.go Outdated
return nil
}

func MapFrameToExecutionEvent(frame HarnessEventFrame, ctx EventMapContext) (*store.ExecutionEvent, error) {
Comment thread workers/ai/main.go Outdated
Comment on lines +1018 to +1025
func firstNonEmpty(values ...string) string {
for _, value := range values {
if strings.TrimSpace(value) != "" {
return value
}
}
return ""
}

@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: 7009a8386e

ℹ️ 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 internal/api/fork_handlers.go Outdated
Comment on lines +123 to +126
spec.Prompt = strings.TrimSpace(req.Prompt)
if spec.AI != nil {
spec.AI.Prompt = strings.TrimSpace(req.Prompt)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Pass fork context into the created task

When POST /fork is used with an afterSeq (including the CLI flow with orka task fork --after ... --prompt ...), this only replaces the task prompt with the caller text; the computed forkCtx is returned after the Task is already created and only summarized in annotations, and no worker path reads those fork annotations. The forked task therefore has neither the selected checkpoint events nor a workspace snapshot, so it cannot actually continue from the requested event sequence; include the bounded fork context in the created Task's worker-visible context before creation.

Useful? React with 👍 / 👎.

Comment on lines +128 to +133
content, err := json.Marshal(map[string]string{
"approvalID": approvalID,
"decision": decision,
"reason": strings.TrimSpace(req.Reason),
"actor": actor,
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep approval IDs outside truncatable reason payloads

When an approval decision includes a large reason (large enough to push this JSON over MaxExecutionEventContentJSONBytes), the store sanitization replaces the whole content object with a truncated marker before persistence. For approval requests that only carry approvalID and no ToolCallID (which the API/tests allow), approvals.Derive can no longer associate the terminal decision with the pending approval, so the decision response can be empty and the approval remains pending. Bound the reason separately or store the decision identity in fields that survive content truncation.

Useful? React with 👍 / 👎.

newName = generatedForkTaskName(sourceName)
}

spec := *source.Spec.DeepCopy()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Clear schedules when creating fork tasks

When the source task is a scheduled task, this full spec copy preserves spec.schedule (and related scheduling fields) on the fork. The controller checks task.Spec.Schedule in the pending phase before creating a Job, so a checkpoint fork of a scheduled source is moved back onto the cron schedule instead of running the requested fork once, and it may repeat later as a scheduled task. Clear scheduling fields for forked tasks unless the request explicitly asks for a scheduled fork.

Useful? React with 👍 / 👎.

Comment on lines +325 to +328
if err != nil {
logf.FromContext(ctx).Error(
err,
"failed to record task lifecycle execution event",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Requeue when terminal event recording fails

When the event store transiently rejects the terminal lifecycle append, this helper only logs the failure. completeTask gets one later retry via handleCompleted, but handleCompleted also swallows the append error and can return without requeueing, leaving a terminal Task with no TaskSucceeded/TaskFailed/TaskCancelled event. Since task SSE completion is driven by those terminal events rather than task status, followers can remain open indefinitely after the store recovers; surface the failure from the terminal path or requeue until the terminal event is persisted.

Useful? React with 👍 / 👎.

Signed-off-by: Sertac Ozercan <sozercan@gmail.com>

@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: d274079395

ℹ️ 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 +169 to +173
- `ApprovalRequested`,
- `ApprovalApproved`,
- `ApprovalDeclined`,
- `ApprovalExpired`,
- `ApprovalCancelled`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Don't document terminal approvals as worker events

This list tells worker authors they can submit terminal approval events, but SubmitExecutionEvent rejects ApprovalApproved, ApprovalDeclined, ApprovalExpired, and ApprovalCancelled as worker terminal events with 403; only ApprovalRequested is worker-emittable, while decisions go through the approval decision API. Following this reference will make worker integrations fail as soon as they try to report a decision or expiry.

Useful? React with 👍 / 👎.

Comment thread cmd/cli/events.go
Comment on lines +246 to +249
if ctx.Err() != nil {
fmt.Fprintf(cmd.ErrOrStderr(), "Resume with --after %d\n", lastSeq) //nolint:errcheck
}
return reader.Err()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Treat interrupted follows as a clean exit

When a user stops orka task follow or orka session follow with Ctrl-C/SIGTERM, ctx.Err() is set and the SSE scanner commonly reports context canceled; this branch prints the resume cursor but then returns reader.Err(), so Cobra still exits with an error for the normal stop path. The existing chat/log streaming paths suppress stream errors once the signal context is canceled, and this follow command should do the same after printing the resume hint.

Useful? React with 👍 / 👎.

Comment on lines +82 to +84
if strings.TrimSpace(event.TaskName) == "" {
event.TaskName = streamID
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Force worker events to use the routed task name

When a worker includes a non-empty taskName that differs from the streamID in this internal route, this only fills the field when it is missing and never overwrites or rejects the spoofed value. The writer check proves the caller owns streamID, but session timelines and event DTOs display event.TaskName, so a buggy worker for task A can persist rows attributed to task B; derive TaskName from the route just like SessionName is derived from the Task.

Useful? React with 👍 / 👎.

Comment thread cmd/cli/events.go
Comment on lines +113 to +114
if after >= 0 {
bodyMap["afterSeq"] = after

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject explicit negative fork checkpoints

When a user runs orka task fork --after -5, Cobra records the negative value but this sentinel check treats every negative after as if the flag were omitted, so the request body leaves out afterSeq and the server forks from the latest event instead of returning its non-negative afterSeq validation error. Distinguish the default sentinel from an explicitly changed flag, otherwise a mistyped checkpoint can create a fork from the wrong point in the timeline.

Useful? React with 👍 / 👎.

Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Copilot AI review requested due to automatic review settings June 13, 2026 22:42

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.

Copilot's findings

Files not reviewed (1)
  • api/v1alpha1/zz_generated.deepcopy.go: Generated file
  • Files reviewed: 81/82 changed files
  • Comments generated: 1

Comment on lines +22 to +25
EnvOrkaControllerURL = "ORKA_CONTROLLER_URL"
EnvOrkaTaskNamespace = "ORKA_TASK_NAMESPACE"
EnvOrkaTaskName = "ORKA_TASK_NAME"
EnvOrkaSessionName = "ORKA_SESSION_NAME"

@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: 1b4ceb4c74

ℹ️ 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 workers/general/main.go
if err := submitResult(workDir, output); err != nil {
return err
}
recordGeneralResultSubmitted(eventRecorder, taskName, len(output))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Emit artifact events from general workers

When a general worker writes files under /tmp/artifacts, submitResult calls UploadArtifacts() before this ResultSubmitted event is recorded, but this path never emits ArtifactUploadCompleted or ArtifactUploadFailed. As a result, successful uploads from general/container tasks are missing from task trace (which only populates artifacts from those event types), and if artifact upload fails after the result was submitted, the timeline shows only a worker failure with no result or artifact-upload event explaining what happened.

Useful? React with 👍 / 👎.

Comment on lines +240 to +244
encoded, err := json.Marshal(forkCtx)
if err != nil {
return err
}
contextBlock := "Fork context through execution event checkpoint:\n" + string(encoded)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Bound fork context before embedding in Task specs

When forking a long task whose recent events include large contentText or JSON payloads, this marshals the whole bounded-by-count fork context directly into the new Task prompt. Since each event can still carry tens of KiB after redaction/truncation and up to 200 events are included, the generated Task object can become multi-MiB and be rejected by the Kubernetes API, making POST /fork fail for exactly the long traces this checkpoint path targets; apply a byte budget or summarize before writing the context into the spec.

Useful? React with 👍 / 👎.

Comment on lines +147 to +148
`CREATE INDEX IF NOT EXISTS idx_execution_events_session
ON execution_events(namespace, session_name, seq)`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Index session streams by their session cursor

This index is keyed by the per-task seq, but the session APIs page and order by the derived session_seq/effective_session_seq cursor in ListSessionExecutionEvents. For long-lived sessions, every orka session follow poll with a high after cursor still has to scan the session's historical rows to compute/list later session events instead of seeking to the cursor, so idle followers become O(total session events); add an index on the session cursor (and type if needed) or use the maintained cursor table for latest-seq reads.

Useful? React with 👍 / 👎.

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