Skip to content

housekeeping: forecast task name + system-message merge (#6) - #10

Merged
Khurdhula-Harshavardhan merged 1 commit into
mainfrom
fix/housekeeping-6
Jul 20, 2026
Merged

housekeeping: forecast task name + system-message merge (#6)#10
Khurdhula-Harshavardhan merged 1 commit into
mainfrom
fix/housekeeping-6

Conversation

@Abhinavexist

Copy link
Copy Markdown
Collaborator

Fixes#6

Addresses the housekeeping items:

1. TaskName omits forecast (#6.1)

The server accepts <task>forecast</task>ALLOWED_USER_TOOLS includes forecast (src/utils/messaging.ts:97-105), and main.ts:203 reads it from an explicit <task> tag. Added forecast to TASK_NAMES and the TaskName literal so create(task="forecast") is typeable, matching the other tasks.

3. task/guard injected as a separate leading system message (#6.3)

prepare() prepended a new{role: "system"} message. But the server reads only the first system message (getAllRequiredMessages breaks on the first role === "system", extracts the tags via a tolerant regex, then splices that one out and uses it as the system prompt). So when the caller already had a system message, the prepended tag-only message became "first" and displaced the caller's real system prompt.

Now the tags are merged into the caller's first system message (when it has string content); the tolerant /<task>([\s\S]*?)<\/task>/ regex still finds them. Falls back to a prepended system message when there's no string-content system message (e.g. list content, which the server can't regex anyway).

2. Fixtures (#6.2)

Already addressed — the mixed-shape precontext fixture (MIXED_PRECONTEXT) is added in #7 alongside the strict-validation fix.

Tests

Added: forecast serializes as a task; tags merge into an existing system message (exactly one system message, contains task + guard + the caller's text). Suite: 26 passing; ruff + mypy --strict clean.

- Add forecast to TASK_NAMES / TaskName: the server accepts
<task>forecast</task> (ALLOWED_USER_TOOLS, messaging.ts:97-105), so it
should be typeable. (#6.1)
- prepare() merges <task>/<guard> tags into the caller's first system
message instead of prepending a second one. The server reads only the
first system message (getAllRequiredMessages), so a prepended tag-only
message displaced the caller's real system prompt. (#6.3)
#6.2 (mixed-shape precontext fixture) is already added in #7.

@Khurdhula-HarshavardhanKhurdhula-Harshavardhan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@Khurdhula-Harshavardhan
Khurdhula-Harshavardhan deleted the fix/housekeeping-6 branch July 20, 2026 23:26
Sign up for freeto 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.

Housekeeping: forecast task, precontext fixtures, system-message injection

2 participants

@Abhinavexist@Khurdhula-Harshavardhan